edu.cuny.cat.comm
Interface Infrastructure<M extends Message>

Type Parameters:
M - the type of messages that can be transmitted through the infrastructure between a client and a server.
All Known Subinterfaces:
CatpInfrastructure
All Known Implementing Classes:
CallBasedInfrastructureImpl, QueueBasedInfrastructureImpl, SocketBasedInfrastructureImpl

public interface Infrastructure<M extends Message>

The interface representing a communication infrastructure on which a client can connect to a listening server and communicates.

An infrastructure may be synchronous or asynchronous. In the former case, messages are sent and processed before the control returns and the whole catp system, including the game server and the clients, is typically in a single-threaded process, while in the latter case, messages are sent and the control immediately returns and there are multiple threads with each for the game server or one of the clients.

For example, SocketBasedInfrastructureImpl and QueueBasedInfrastructureImpl are asynchronous, and CallBasedInfrastructureImpl is synchronous. SocketBasedInfrastructureImpl is used in a distributed actual competition, and CallBasedInfrastructureImpl can speed up the execution of an experiment significantly.

Version:
$Revision: 1.11 $
Author:
Jinzhong Niu

Method Summary
 void cleanUp()
          cleans up after finishing using this infrastructure.
 ClientConnector<M> createClientConnector()
          can be invoked by a GameClient to create a ClientConnector so as to connect to a GameServer.
 ServerConnector<M> createServerConnector()
          can be invoked by a GameServer to create a ServerConnector so as to be able to wait for connection requests from GameClients.
 boolean isSynchronous()
           
 

Method Detail

createClientConnector

ClientConnector<M> createClientConnector()
can be invoked by a GameClient to create a ClientConnector so as to connect to a GameServer.

Returns:
an instance of ClientConnector

createServerConnector

ServerConnector<M> createServerConnector()
can be invoked by a GameServer to create a ServerConnector so as to be able to wait for connection requests from GameClients.

Returns:
an instance of ServerConnector

isSynchronous

boolean isSynchronous()
Returns:
true if the message passing based on this infrastructure is synchronous; false otherwise.

cleanUp

void cleanUp()
cleans up after finishing using this infrastructure.