server.framework.network
Class ServerSocketCommunicator.SenderThread

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

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

Thread that is responsible for sending messages to the socket's associated client.


Constructor Summary
ServerSocketCommunicator.SenderThread()
          Initialises the message queue.
 
Method Summary
 void run()
          Sends messages that are waiting to be sent.
 void sendMessage(java.lang.String message)
          Called when a new message is to be sent.
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServerSocketCommunicator.SenderThread

public ServerSocketCommunicator.SenderThread()
Initialises the message queue.

Method Detail

run

public void run()
Sends messages that are waiting to be sent. When the send queue is empty, this thread sleeps until new messages to be sent arrive. The thread uses the associated SocketWrapper object to send the messages, and the implementation of the sending is therefore abstracted from this method.

Specified by:
run in interface java.lang.Runnable

sendMessage

public void sendMessage(java.lang.String message)
Called when a new message is to be sent. Adds the message to the message queue, and notifies the sender thread that messages are waiting to be sent.

Parameters:
message - The message to be sent.

stop

public void stop()