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
This commit is contained in:
PSp..om 2011-03-21 23:06:27 +00:00
parent 76d0d9ef5d
commit 16c6b13564

View File

@ -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