|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.grinder.communication.StreamSender
net.grinder.communication.ClientSender
public final class ClientSender
Class that manages the sending of messages to a server.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface net.grinder.communication.BlockingSender |
|---|
BlockingSender.NoResponseException |
| Method Summary | |
|---|---|
Message |
blockingSend(Message message)
Send the given message and await a response. |
static ClientSender |
connect(ClientReceiver clientReceiver)
Factory method that makes a Sender around the existing TCP
connection owned by the supplied ClientReceiver. |
static ClientSender |
connect(Connector connector,
Address address)
Factory method that makes a TCP connection and returns a corresponding Sender. |
boolean |
isShutdown()
Return whether we are shutdown. |
void |
send(Message message)
Send the given message. |
void |
sendKeepAlive()
Send a no-op message that keeps this connection alive. |
void |
shutdown()
Cleanly shutdown the Sender. |
protected static void |
writeMessageToStream(Message message,
OutputStream stream)
|
| Methods inherited from class net.grinder.communication.StreamSender |
|---|
writeMessage |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static ClientSender connect(Connector connector,
Address address)
throws CommunicationException
Sender.
This class only supports synchronous communication, so the server can only
use address for identification purposes. For asynchronous
communication, see ClientReceiver.
connector - Connector to use to make the connection to the server.address - Identifies the client process.
CommunicationException - If failed to connect.
public static ClientSender connect(ClientReceiver clientReceiver)
throws CommunicationException
Sender around the existing TCP
connection owned by the supplied ClientReceiver.
clientReceiver - We create a paired Sender for this
Receiver.
CommunicationException - If failed to connect.public void shutdown()
Sender. Ignore most errors,
connection has probably been reset by peer.
shutdown in interface BlockingSendershutdown in interface Sendershutdown in class StreamSender
public Message blockingSend(Message message)
throws CommunicationException
The input stream is that of our socket. This method should only be used where the sender can guarantee that the input stream will be free for exclusive use - we don't lock out external processes from interrupting the stream.
blockingSend in interface BlockingSendermessage - A Message.
CommunicationException - If an error occurs.
public void sendKeepAlive()
throws CommunicationException
CommunicationException - If the connection has been terminated.
public final void send(Message message)
throws CommunicationException
send in interface Sendermessage - A Message.
CommunicationException - If an error occurs.
protected static final void writeMessageToStream(Message message,
OutputStream stream)
throws IOException
IOExceptionpublic boolean isShutdown()
true if and only if we are shut down.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||