uk.ac.vamsas.client.picking
Class SocketManager

java.lang.Object
  extended byuk.ac.vamsas.client.picking.SocketManager
All Implemented Interfaces:
IPickManager

public class SocketManager
extends java.lang.Object
implements IPickManager

Concrete implementation of the IPickManager interface that uses sockets for message communication. An instance of this class attempts to run the central server for other clients; failing that, it attempts to connect to an existing server instead.


Constructor Summary
SocketManager()
          Constructs a new PickManager.
 
Method Summary
 void registerMessageHandler(IMessageHandler handler)
          Registers a message handler with the manager that allows the manager to perform a method callback on that object whenever a message is received.
 void sendMessage(Message message)
          Sends a message to other clients.
 void shutdown()
          Shutsdown the pick manager processes, terminating any connections to other clients.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SocketManager

public SocketManager()
Constructs a new PickManager. This method will return immediately, while a looping thread runs that attempts to run the server or connect to an existing server.

Method Detail

registerMessageHandler

public void registerMessageHandler(IMessageHandler handler)
Registers a message handler with the manager that allows the manager to perform a method callback on that object whenever a message is received.

Specified by:
registerMessageHandler in interface IPickManager
Parameters:
handler - the message handler to register

sendMessage

public void sendMessage(Message message)
Sends a message to other clients.

Specified by:
sendMessage in interface IPickManager
Parameters:
message - the message to send

shutdown

public void shutdown()
Description copied from interface: IPickManager
Shutsdown the pick manager processes, terminating any connections to other clients.

Specified by:
shutdown in interface IPickManager