Added additional trace logging.

cleanup_build_scripts
Paul Speed 9 years ago
parent 15afcfb735
commit 99742a76f2
  1. 5
      jme3-networking/src/main/java/com/jme3/network/base/DefaultClient.java
  2. 4
      jme3-networking/src/main/java/com/jme3/network/base/DefaultServer.java
  3. 14
      jme3-networking/src/main/java/com/jme3/network/base/MessageListenerRegistry.java

@ -389,6 +389,7 @@ public class DefaultClient implements Client
protected void startServices()
{
log.fine("Starting client services.");
// Let the services know we are finally started
services.start();
}
@ -447,6 +448,10 @@ public class DefaultClient implements Client
protected void dispatch( Message m )
{
if( log.isLoggable(Level.FINER) ) {
log.log(Level.FINER, "{0} received:{1}", new Object[]{this, m});
}
// Pull off the connection management messages we're
// interested in and then pass on the rest.
if( m instanceof ClientRegistrationMessage ) {

@ -326,6 +326,10 @@ public class DefaultServer implements Server
protected void dispatch( HostedConnection source, Message m )
{
if( log.isLoggable(Level.FINER) ) {
log.log(Level.FINER, "{0} received:{1}", new Object[]{source, m});
}
if( source == null ) {
messageListeners.messageReceived( source, m );
} else {

@ -50,26 +50,34 @@ import java.util.logging.Logger;
*/
public class MessageListenerRegistry<S> implements MessageListener<S>
{
static Logger log = Logger.getLogger(MessageListenerRegistry.class.getName());
static final Logger log = Logger.getLogger(MessageListenerRegistry.class.getName());
private List<MessageListener<? super S>> listeners = new CopyOnWriteArrayList<MessageListener<? super S>>();
private Map<Class,List<MessageListener<? super S>>> typeListeners
private final List<MessageListener<? super S>> listeners = new CopyOnWriteArrayList<MessageListener<? super S>>();
private final Map<Class,List<MessageListener<? super S>>> typeListeners
= new ConcurrentHashMap<Class,List<MessageListener<? super S>>>();
public MessageListenerRegistry()
{
}
@Override
public void messageReceived( S source, Message m )
{
boolean delivered = false;
boolean trace = log.isLoggable(Level.FINER);
for( MessageListener<? super S> l : listeners ) {
if( trace ) {
log.log(Level.FINER, "Delivering {0} to:{1}", new Object[]{m, l});
}
l.messageReceived( source, m );
delivered = true;
}
for( MessageListener<? super S> l : getListeners(m.getClass(),false) ) {
if( trace ) {
log.log(Level.FINER, "Delivering {0} to:{1}", new Object[]{m, l});
}
l.messageReceived( source, m );
delivered = true;
}

Loading…
Cancel
Save