server.framework.network
Class ServerSocketCommunicator.ReceiverThread

java.lang.Object
  extended by server.framework.network.ServerSocketCommunicator.ReceiverThread
All Implemented Interfaces:
java.lang.Runnable
Enclosing class:
ServerSocketCommunicator

protected class ServerSocketCommunicator.ReceiverThread
extends java.lang.Object
implements java.lang.Runnable

Thread responsible for listening to the connection, and detecting when new messages arrive. When this happens, the thread calls the notifyAboutMessageReceived(). Between each loop in the listen thread, the thread sleeps for an amount of time specified by the SLEEP_TIME variable, to avoid occupying too much resources.


Field Summary
static int SLEEP_TIME
           
 
Constructor Summary
ServerSocketCommunicator.ReceiverThread()
           
 
Method Summary
 void run()
          The loop listening for incoming messages on the connection.
 void setMessageSize(int messageSize)
          Sets the message size used for the UDP communication.
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SLEEP_TIME

public static final int SLEEP_TIME
See Also:
Constant Field Values
Constructor Detail

ServerSocketCommunicator.ReceiverThread

public ServerSocketCommunicator.ReceiverThread()
Method Detail

run

public void run()
The loop listening for incoming messages on the connection. The thread uses the associated SocketWrapper object to receive the messages, and the implementation of the receival is therefore abstracted from this method.

Specified by:
run in interface java.lang.Runnable

stop

public void stop()

setMessageSize

public void setMessageSize(int messageSize)
Sets the message size used for the UDP communication.

Parameters:
messageSize - The message size.