|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.cuny.cat.comm.QueueBasedInfrastructureImpl
public class QueueBasedInfrastructureImpl
The class implements a queue-based message-passing infrastructure for catp.
It is similar to SocketBasedInfrastructureImpl in the sense that both
are asynchronous. They differ in two aspects:
QueueBasedInfrastructureImpl does not require network resources, thus
for instance avoiding possible port conflicts as in
SocketBasedInfrastructureImpl, but
SocketBasedInfrastructureImpl supports the real distributed game
playing over the Internet and is the only available infrastructure
implementation for actual competitions while
QueueBasedInfrastructureImpl implies multiple threads with each for
the game server or one of the waitingClients inside a single process.
Default Base
| queue_based_infrastructure |
SocketBasedInfrastructureImpl,
CallBasedInfrastructureImpl| Field Summary | |
|---|---|
protected java.util.Map<java.lang.Object,QueueBasedCatpConnection> |
connections
|
static java.lang.String |
P_DEF_BASE
|
protected org.apache.commons.collections15.Buffer<QueueBasedCatpClientConnector> |
waitingClients
|
| Constructor Summary | |
|---|---|
QueueBasedInfrastructureImpl()
|
|
| Method Summary | |
|---|---|
QueueBasedCatpConnection |
acceptClient(QueueBasedCatpServerConnector server)
|
void |
cleanUp()
cleans up after finishing using this infrastructure. |
void |
closeConnection(java.lang.Object connector)
|
QueueBasedCatpConnection |
connectToServer(QueueBasedCatpClientConnector client)
|
ClientConnector<CatpMessage> |
createClientConnector()
can be invoked by a GameClient to create a
ClientConnector so as to connect to a
GameServer. |
ServerConnector<CatpMessage> |
createServerConnector()
can be invoked by a GameServer to create a
ServerConnector so as to be able to wait for connection requests
from GameClients. |
void |
freeServerConnector(QueueBasedCatpServerConnector server)
frees the waiting ServerConnector. |
static QueueBasedInfrastructureImpl |
getInstance()
|
boolean |
isSynchronous()
|
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String P_DEF_BASE
protected org.apache.commons.collections15.Buffer<QueueBasedCatpClientConnector> waitingClients
protected java.util.Map<java.lang.Object,QueueBasedCatpConnection> connections
| Constructor Detail |
|---|
public QueueBasedInfrastructureImpl()
| Method Detail |
|---|
public static QueueBasedInfrastructureImpl getInstance()
public ClientConnector<CatpMessage> createClientConnector()
InfrastructureGameClient to create a
ClientConnector so as to connect to a
GameServer.
createClientConnector in interface Infrastructure<CatpMessage>QueueBasedCatpClientConnector.public ServerConnector<CatpMessage> createServerConnector()
InfrastructureGameServer to create a
ServerConnector so as to be able to wait for connection requests
from GameClients.
createServerConnector in interface Infrastructure<CatpMessage>QueueBasedCatpServerConnector.public QueueBasedCatpConnection connectToServer(QueueBasedCatpClientConnector client)
public QueueBasedCatpConnection acceptClient(QueueBasedCatpServerConnector server)
throws ConnectionException
ConnectionExceptionpublic void freeServerConnector(QueueBasedCatpServerConnector server)
ServerConnector.
server - the waiting ServerConnector.public void cleanUp()
Infrastructure
cleanUp in interface Infrastructure<CatpMessage>public void closeConnection(java.lang.Object connector)
public boolean isSynchronous()
isSynchronous in interface Infrastructure<CatpMessage>public java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||