Constructor and Description |
---|
FanOutServerSender(Acceptor acceptor,
ConnectionType connectionType,
int numberOfThreads)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected Address |
getAddress(ResourcePool.Resource resource)
Return the address of a socket.
|
protected net.grinder.communication.ResourcePool |
getResourcePool()
Allow subclasses to access the resource pool.
|
boolean |
isShutdown()
Return whether we are shutdown.
|
protected OutputStream |
resourceToOutputStream(ResourcePool.Resource resource)
Return an output stream from a socket resource.
|
void |
send(Address address,
Message message)
Send a message to a particular address.
|
void |
send(Message message)
Send the given message.
|
void |
shutdown()
Shut down this sender.
|
protected void |
writeAddressedMessage(Address address,
Message message)
Send a message.
|
protected void |
writeMessage(Message message)
Send a message.
|
protected static void |
writeMessageToStream(Message message,
OutputStream stream) |
public FanOutServerSender(Acceptor acceptor, ConnectionType connectionType, int numberOfThreads) throws Acceptor.ShutdownException
acceptor
- Acceptor.connectionType
- Connection type.numberOfThreads
- Number of sender threads to use.Acceptor.ShutdownException
- If the acceptor has been shutdown.public void send(Address address, Message message) throws CommunicationException
address
- Address to send message to.message
- The message.CommunicationException
- If an error occurs.protected OutputStream resourceToOutputStream(ResourcePool.Resource resource) throws CommunicationException
resource
- The resource.CommunicationException
- If the output stream could not be
obtained from the socket.protected Address getAddress(ResourcePool.Resource resource)
resource
- The resource.null
if the socket has no address.protected final void writeMessage(Message message) throws CommunicationException
message
- The message.IOException
- If an error occurs.CommunicationException
protected final void writeAddressedMessage(Address address, Message message) throws CommunicationException
message
- The message.IOException
- If an error occurs.CommunicationException
protected final net.grinder.communication.ResourcePool getResourcePool()
public final void send(Message message) throws CommunicationException
send
in interface Sender
message
- A Message
.CommunicationException
- If an error occurs.protected static final void writeMessageToStream(Message message, OutputStream stream) throws IOException
IOException
public boolean isShutdown()
true
if and only if we are shut down.Copyright © 2000-2014. All Rights Reserved.