Top Fields Constructors Methods
org.glassfish.grizzly.nio.tmpselectors

public abstract Class TemporarySelectorWriter

extends AbstractWriter<SocketAddress>
Class Inheritance
Known Direct Subclasses
org.glassfish.grizzly.nio.transport.TCPNIOTemporarySelectorWriter, org.glassfish.grizzly.nio.transport.UDPNIOTemporarySelectorWriter
Annotations
@SuppressWarnings:deprecation
Imports
java.io.IOException, java.net.SocketAddress, java.nio.channels.SelectableChannel, .SelectionKey, .Selector, java.util.concurrent.TimeUnit, org.glassfish.grizzly.AbstractWriter, .Buffer, .CompletionHandler, .Connection, .WriteHandler, .WriteResult, org.glassfish.grizzly.asyncqueue.MessageCloner, .WritableMessage, org.glassfish.grizzly.nio.NIOConnection

Author
oleksiys

Field Summary

Modifier and TypeField and Description
protected final TemporarySelectorsEnabledTransport

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
canWrite(final Connection<L> connection)

Implements org.glassfish.grizzly.Writer.canWrite.

Return true if the connection has not exceeded it's maximum size in bytes of pending writes, otherwise false.

private static void
failure(final Throwable failure, final CompletionHandler<WriteResult<WritableMessage, SocketAddress>> completionHandler)

public TemporarySelectorsEnabledTransport
public void
notifyWritePossible(final Connection<L> connection, final WriteHandler writeHandler)

Implements org.glassfish.grizzly.Writer.notifyWritePossible.

Registers WriteHandler, which will be notified ones at least one byte can be written.

public void
write(final Connection<SocketAddress> connection, final SocketAddress dstAddress, final WritableMessage message, final CompletionHandler<WriteResult<WritableMessage, SocketAddress>> completionHandler, final MessageCloner<WritableMessage> messageCloner)

Implements org.glassfish.grizzly.Writer.write.

Method writes the WritableMessage to the specific address.

public void
write(Connection<SocketAddress> connection, SocketAddress dstAddress, WritableMessage message, CompletionHandler<WriteResult<WritableMessage, SocketAddress>> completionHandler, final PushBackHandler pushBackHandler)

Implements org.glassfish.grizzly.Writer.write.

Deprecated

Method writes the WritableMessage to the specific address.

public void
write(Connection<SocketAddress> connection, SocketAddress
the destination address the message will be sent to
dstAddress
,
WritableMessage
the WritableMessage, from which the data will be written
message
,
CompletionHandler<WriteResult<WritableMessage, SocketAddress>>
org.glassfish.grizzly.CompletionHandler, which will get notified, when write will be completed
completionHandler
,
long timeout, TimeUnit timeunit)

Method writes the WritableMessage to the specific address.

public void
write(Connection<SocketAddress> connection, SocketAddress
the destination address the message will be sent to
dstAddress
,
WritableMessage
the WritableMessage, from which the data will be written
message
,
CompletionHandler<WriteResult<WritableMessage, SocketAddress>>
org.glassfish.grizzly.CompletionHandler, which will get notified, when write will be completed
completionHandler
,
final PushBackHandler pushBackHandler, long timeout, TimeUnit timeunit)
References Deprecated PushBackHandler is deprecated or references (maybe indirectly) at least one deprecated element.

Method writes the WritableMessage to the specific address.

protected long

Returns:

The number of bytes written.
write0
(final NIOConnection connection, final SocketAddress
the destination address.
dstAddress
,
final WritableMessage message, final WriteResult<WritableMessage, SocketAddress>
the result of the write operation
currentResult
,
final long
operation timeout value value
timeout
,
final TimeUnit
the timeout unit
timeunit
)

Flush the buffer by looping until the Buffer is empty

protected abstract long
Inherited from org.glassfish.grizzly.AbstractWriter:
writewritewritewrite

Field Detail

transportback to summary
protected final TemporarySelectorsEnabledTransport transport

Constructor Detail

TemporarySelectorWriterback to summary
public TemporarySelectorWriter(TemporarySelectorsEnabledTransport transport)

Method Detail

canWriteback to summary
public boolean canWrite(final Connection<L> connection)

Implements org.glassfish.grizzly.Writer.canWrite.

Doc from org.glassfish.grizzly.Writer.canWrite.

Return true if the connection has not exceeded it's maximum size in bytes of pending writes, otherwise false.

Annotations
@Override
failureback to summary
private static void failure(final Throwable failure, final CompletionHandler<WriteResult<WritableMessage, SocketAddress>> completionHandler)
getTransportback to summary
public TemporarySelectorsEnabledTransport getTransport()
notifyWritePossibleback to summary
public void notifyWritePossible(final Connection<L> connection, final WriteHandler writeHandler)

Implements org.glassfish.grizzly.Writer.notifyWritePossible.

Doc from org.glassfish.grizzly.Writer.notifyWritePossible.

Registers 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.

Annotations
@Override
writeback to summary
public void write(final Connection<SocketAddress> connection, final SocketAddress dstAddress, final WritableMessage message, final CompletionHandler<WriteResult<WritableMessage, SocketAddress>> completionHandler, final MessageCloner<WritableMessage> messageCloner)

Implements org.glassfish.grizzly.Writer.write.

Doc from org.glassfish.grizzly.Writer.write.

Method writes the WritableMessage to the specific address.

Annotations
@Override
writeback to summary
public void write(Connection<SocketAddress> connection, SocketAddress dstAddress, WritableMessage message, CompletionHandler<WriteResult<WritableMessage, SocketAddress>> completionHandler, final PushBackHandler pushBackHandler)

Implements org.glassfish.grizzly.Writer.write.

Doc from org.glassfish.grizzly.Writer.write.

Deprecated

Method writes the WritableMessage to the specific address.

Annotations
@Deprecated
@Override
writeback to summary
public 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.

Parameters
connection:Connection<SocketAddress>

the org.glassfish.grizzly.Connection to write to

dstAddress:SocketAddress

the destination address the message will be sent to

message:WritableMessage

the WritableMessage, from which the data will be written

completionHandler:CompletionHandler<WriteResult<WritableMessage, SocketAddress>>

org.glassfish.grizzly.CompletionHandler, which will get notified, when write will be completed

writeback to summary
public void write(Connection<SocketAddress> connection, SocketAddress dstAddress, WritableMessage message, CompletionHandler<WriteResult<WritableMessage, SocketAddress>> completionHandler, final PushBackHandler pushBackHandler, long timeout, TimeUnit timeunit)

References Deprecated

PushBackHandler is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Method writes the WritableMessage to the specific address.

Parameters
connection:Connection<SocketAddress>

the org.glassfish.grizzly.Connection to write to

dstAddress:SocketAddress

the destination address the message will be sent to

message:WritableMessage

the WritableMessage, from which the data will be written

completionHandler:CompletionHandler<WriteResult<WritableMessage, SocketAddress>>

org.glassfish.grizzly.CompletionHandler, which will get notified, when write will be completed

write0back to summary
protected long write0(final NIOConnection connection, final SocketAddress dstAddress, final WritableMessage message, final WriteResult<WritableMessage, SocketAddress> currentResult, final long timeout, final TimeUnit timeunit) throws IOException

Flush the buffer by looping until the Buffer is empty

Parameters
connection:NIOConnection

the org.glassfish.grizzly.Connection.

dstAddress:SocketAddress

the destination address.

currentResult:WriteResult<WritableMessage, SocketAddress>

the result of the write operation

timeout:long

operation timeout value value

timeunit:TimeUnit

the timeout unit

Returns:long

The number of bytes written.

writeNow0back to summary
protected abstract long writeNow0(NIOConnection connection, SocketAddress dstAddress, WritableMessage message, WriteResult<WritableMessage, SocketAddress> currentResult) throws IOException