Log the client registration steps.

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7020 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
PSp..om 14 years ago
parent 90c01777ae
commit 2825885560
  1. 22
      engine/src/networking/com/jme3/network/base/DefaultServer.java

@ -37,6 +37,8 @@ import java.nio.ByteBuffer;
import java.util.*; import java.util.*;
import java.util.concurrent.*; import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicLong;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.jme3.network.*; import com.jme3.network.*;
import com.jme3.network.kernel.*; import com.jme3.network.kernel.*;
@ -53,6 +55,8 @@ import com.jme3.network.serializing.Serializer;
*/ */
public class DefaultServer implements Server public class DefaultServer implements Server
{ {
static Logger log = Logger.getLogger(DefaultServer.class.getName());
private boolean isRunning = false; private boolean isRunning = false;
private AtomicLong nextId = new AtomicLong(0); private AtomicLong nextId = new AtomicLong(0);
private Kernel reliable; private Kernel reliable;
@ -215,7 +219,7 @@ public class DefaultServer implements Server
protected void registerClient( KernelAdapter ka, Endpoint p, ClientRegistrationMessage m ) protected void registerClient( KernelAdapter ka, Endpoint p, ClientRegistrationMessage m )
{ {
Connection addedConnection = null; Connection addedConnection = null;
// generally this will only be called by one thread but it's // generally this will only be called by one thread but it's
// important enough I won't take chances // important enough I won't take chances
synchronized( this ) { synchronized( this ) {
@ -227,7 +231,10 @@ public class DefaultServer implements Server
Connection c = connecting.remove(tempId); Connection c = connecting.remove(tempId);
if( c == null ) { if( c == null ) {
c = new Connection(); c = new Connection();
} log.log( Level.FINE, "Registering client for endpoint, pass 1:{0}.", p );
} else {
log.log( Level.FINE, "Refining client registration for endpoint:{0}.", p );
}
// Fill in what we now know // Fill in what we now know
if( ka == fastAdapter ) { if( ka == fastAdapter ) {
@ -267,7 +274,9 @@ public class DefaultServer implements Server
// Best to do this outside of the synch block to avoid // Best to do this outside of the synch block to avoid
// over synchronizing which is the path to deadlocks // over synchronizing which is the path to deadlocks
if( addedConnection != null ) { if( addedConnection != null ) {
// Nnow we can notify the listeners about the log.log( Level.INFO, "Client registered:{0}.", addedConnection );
// Now we can notify the listeners about the
// new connection. // new connection.
fireConnectionAdded( addedConnection ); fireConnectionAdded( addedConnection );
@ -385,7 +394,12 @@ public class DefaultServer implements Server
public Set<String> attributeNames() public Set<String> attributeNames()
{ {
return Collections.unmodifiableSet(sessionData.keySet()); return Collections.unmodifiableSet(sessionData.keySet());
} }
public String toString()
{
return "Connection[ id=" + id + ", reliable=" + reliable + ", fast=" + fast + " ]";
}
} }
protected class Redispatch implements MessageListener<HostedConnection> protected class Redispatch implements MessageListener<HostedConnection>

Loading…
Cancel
Save