|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.grinder.communication.ServerReceiver
public final class ServerReceiver
Manages the receipt of messages from many clients.
| Constructor Summary | |
|---|---|
ServerReceiver()
|
|
| Method Summary | |
|---|---|
void |
receiveFrom(Acceptor acceptor,
ConnectionType[] connectionTypes,
int numberOfThreads,
long idleThreadPollDelay,
long inactiveClientTimeOut)
Registers a new Acceptor from which the ServerReceiver
should process messages. |
void |
shutdown()
Shut down this receiver. |
Message |
waitForMessage()
Block until a message is available, or another thread has called shutdown(). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ServerReceiver()
| Method Detail |
|---|
public void receiveFrom(Acceptor acceptor,
ConnectionType[] connectionTypes,
int numberOfThreads,
long idleThreadPollDelay,
long inactiveClientTimeOut)
throws CommunicationException
Acceptor from which the ServerReceiver
should process messages. Actively polls connections of the given types for
messages, de-serialises them, and queues them for retrieval using
waitForMessage().
A single ServerReceiver can listen to messages from multiple
Acceptors. You can register the same Acceptor with
multiple ServerReceivers, but then there is no way of
controlling which receiver will receive messages from a given
Acceptor.
acceptor - Acceptor.connectionTypes - Type of connections to listen for.numberOfThreads - How many threads to dedicate to processing the Acceptor. The
threads this method spawns just read, deserialise, and queue. Set
numberOfThreads to the number of concurrent streams
you expect to be able to read.idleThreadPollDelay - Time in milliseconds that an idle thread should sleep if there are
no sockets to process.inactiveClientTimeOut - How long before we consider a client connection that presents no
data to be inactive.
CommunicationException - If this ServerReceiver has been shutdown.
public Message waitForMessage()
throws CommunicationException
shutdown(). Typically called from a message dispatch loop.
Multiple threads can call this method, but only one thread will receive a given message.
waitForMessage in interface Receivernull if shut down.
CommunicationException - If an error occurred receiving a message.public void shutdown()
shutdown in interface Receiver
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||