Fix client message listeners threading. They may be

called by either the UDP or TCP thread but it will
not be at the same time.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7067 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
PSp..om 14 years ago
parent 76d0d9ef5d
commit 16c6b13564
  1. 7
      engine/src/networking/com/jme3/network/base/DefaultClient.java

@ -305,7 +305,12 @@ public class DefaultClient implements Client
close();
}
messageListeners.messageReceived( this, m );
// Make sure client MessageListeners are called single-threaded
// since it could receive messages from the TCP and UDP
// thread simultaneously.
synchronized( this ) {
messageListeners.messageReceived( this, m );
}
}
protected class Redispatch implements MessageListener

Loading…
Cancel
Save