public abstract class TemporarySelectorWriter extends AbstractWriter<SocketAddress>
Writer.Reentrant| Modifier and Type | Field and Description |
|---|---|
protected TemporarySelectorsEnabledTransport |
transport |
| Constructor and Description |
|---|
TemporarySelectorWriter(TemporarySelectorsEnabledTransport transport) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canWrite(Connection connection)
Return
true if the connection has not exceeded it's maximum size in bytes of pending writes, otherwise
false. |
TemporarySelectorsEnabledTransport |
getTransport() |
void |
notifyWritePossible(Connection connection,
WriteHandler writeHandler)
Registers
WriteHandler, which will be notified ones at least one byte can be written. |
void |
write(Connection<SocketAddress> connection,
SocketAddress dstAddress,
WritableMessage message,
CompletionHandler<WriteResult<WritableMessage,SocketAddress>> completionHandler,
long timeout,
TimeUnit timeunit)
Method writes the
WritableMessage to the specific address. |
void |
write(Connection<SocketAddress> connection,
SocketAddress dstAddress,
WritableMessage message,
CompletionHandler<WriteResult<WritableMessage,SocketAddress>> completionHandler,
MessageCloner<WritableMessage> messageCloner)
Method writes the
WritableMessage to the specific address. |
void |
write(Connection<SocketAddress> connection,
SocketAddress dstAddress,
WritableMessage message,
CompletionHandler<WriteResult<WritableMessage,SocketAddress>> completionHandler,
PushBackHandler pushBackHandler)
Deprecated.
|
void |
write(Connection<SocketAddress> connection,
SocketAddress dstAddress,
WritableMessage message,
CompletionHandler<WriteResult<WritableMessage,SocketAddress>> completionHandler,
PushBackHandler pushBackHandler,
long timeout,
TimeUnit timeunit)
Method writes the
WritableMessage to the specific address. |
protected long |
write0(NIOConnection connection,
SocketAddress dstAddress,
WritableMessage message,
WriteResult<WritableMessage,SocketAddress> currentResult,
long timeout,
TimeUnit timeunit)
Flush the buffer by looping until the
Buffer is empty |
protected abstract long |
writeNow0(NIOConnection connection,
SocketAddress dstAddress,
WritableMessage message,
WriteResult<WritableMessage,SocketAddress> currentResult) |
write, write, write, writeprotected final TemporarySelectorsEnabledTransport transport
public TemporarySelectorWriter(TemporarySelectorsEnabledTransport transport)
public void write(Connection<SocketAddress> connection, SocketAddress dstAddress, WritableMessage message, CompletionHandler<WriteResult<WritableMessage,SocketAddress>> completionHandler, MessageCloner<WritableMessage> messageCloner)
WritableMessage to the specific address.connection - the Connection to write todstAddress - the destination address the WritableMessage will be sent tomessage - the WritableMessage, from which the data will be writtencompletionHandler - CompletionHandler, which will get notified, when write will be
completedmessageCloner - the MessageCloner, which will be able to clone the message in case it can't be
completely written in the current thread.@Deprecated public void write(Connection<SocketAddress> connection, SocketAddress dstAddress, WritableMessage message, CompletionHandler<WriteResult<WritableMessage,SocketAddress>> completionHandler, PushBackHandler pushBackHandler)
WritableMessage to the specific address.connection - the Connection to write todstAddress - the destination address the WritableMessage will be sent tomessage - the WritableMessage, from which the data will be writtencompletionHandler - CompletionHandler, which will get notified, when write will be
completedpushBackHandler - PushBackHandler, which will be notified if message
was accepted by transport write queue or refusedpublic void write(Connection<SocketAddress> connection, SocketAddress dstAddress, WritableMessage message, CompletionHandler<WriteResult<WritableMessage,SocketAddress>> completionHandler, long timeout, TimeUnit timeunit)
WritableMessage to the specific address.connection - the Connection to write todstAddress - the destination address the message will be sent tomessage - the WritableMessage, from which the data will be writtencompletionHandler - CompletionHandler, which will get notified, when write will be
completedpublic void write(Connection<SocketAddress> connection, SocketAddress dstAddress, WritableMessage message, CompletionHandler<WriteResult<WritableMessage,SocketAddress>> completionHandler, PushBackHandler pushBackHandler, long timeout, TimeUnit timeunit)
WritableMessage to the specific address.connection - the Connection to write todstAddress - the destination address the message will be sent tomessage - the WritableMessage, from which the data will be writtencompletionHandler - CompletionHandler, which will get notified, when write will be
completedprotected long write0(NIOConnection connection, SocketAddress dstAddress, WritableMessage message, WriteResult<WritableMessage,SocketAddress> currentResult, long timeout, TimeUnit timeunit) throws IOException
Buffer is emptyconnection - the Connection.dstAddress - the destination address.message - currentResult - the result of the write operationtimeout - operation timeout value valuetimeunit - the timeout unitIOExceptionpublic TemporarySelectorsEnabledTransport getTransport()
protected abstract long writeNow0(NIOConnection connection, SocketAddress dstAddress, WritableMessage message, WriteResult<WritableMessage,SocketAddress> currentResult) throws IOException
IOExceptionpublic boolean canWrite(Connection connection)
true if the connection has not exceeded it's maximum size in bytes of pending writes, otherwise
false.connection - the Connection to test whether or not the specified number of bytes can be written to.true if the connection has not exceeded it's maximum size in bytes of pending writes, otherwise
falsepublic void notifyWritePossible(Connection connection, WriteHandler writeHandler)
WriteHandler, which will be notified ones at least one byte can be written.
This method call is equivalent to call notifyWritePossible(connection, writeHandler, 1);
Note: using this method from different threads simultaneously may lead to quick situation changes, so at time
WriteHandler is called - the queue may become busy again.connection - ConnectionwriteHandler - WriteHandler to be notified.Copyright © 2017–2020 Oracle Corporation. All rights reserved.