Added some comments about the multi-threaded nature
of message event dispatch. This is one of the reasons I thought the existing services need to be checked for 'correctness' re: multithreading. Even in the current implementations, a message listener may be called by different threads. git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7046 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
0b481135e3
commit
b1e52b865a
@ -34,7 +34,16 @@ package com.jme3.network;
|
||||
|
||||
|
||||
/**
|
||||
* Listener notified about new messages
|
||||
* Listener notified about new messages.
|
||||
*
|
||||
* <p>Note about multithreading: on the server, these messages may
|
||||
* be delivered by more than one thread depending on the server
|
||||
* implementation used. Listener implementations should treat their
|
||||
* shared data structures accordingly and set them up for multithreaded
|
||||
* access. The only threading guarantee is that for a single
|
||||
* HostedConnection, there will only ever be one thread at a time
|
||||
* and the messages will always be delivered to that connection in the
|
||||
* order that they were delivered.</p>
|
||||
*
|
||||
* @version $Revision$
|
||||
* @author Paul Speed
|
||||
|
@ -117,6 +117,16 @@ public interface Server
|
||||
/**
|
||||
* Adds a listener that will be notified when any message or object
|
||||
* is received from one of the clients.
|
||||
*
|
||||
* <p>Note about MessageListener multithreading: on the server, message events may
|
||||
* be delivered by more than one thread depending on the server
|
||||
* implementation used. Listener implementations should treat their
|
||||
* shared data structures accordingly and set them up for multithreaded
|
||||
* access. The only threading guarantee is that for a single
|
||||
* HostedConnection, there will only ever be one thread at a time
|
||||
* and the messages will always be delivered to that connection in the
|
||||
* order that they were delivered. This is the only restriction placed
|
||||
* upon server message dispatch pool implementations.</p>
|
||||
*/
|
||||
public void addMessageListener( MessageListener<? super HostedConnection> listener );
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user