org.glassfish.grizzly.nio.tmpselectors
Class TemporarySelectorWriter

java.lang.Object
  extended by org.glassfish.grizzly.AbstractWriter<SocketAddress>
      extended by org.glassfish.grizzly.nio.tmpselectors.TemporarySelectorWriter
All Implemented Interfaces:
Writer<SocketAddress>
Direct Known Subclasses:
TCPNIOTemporarySelectorWriter, UDPNIOTemporarySelectorWriter

public abstract class TemporarySelectorWriter
extends AbstractWriter<SocketAddress>

Author:
oleksiys

Field Summary
protected  TemporarySelectorsEnabledTransport transport
           
 
Constructor Summary
TemporarySelectorWriter(TemporarySelectorsEnabledTransport transport)
           
 
Method Summary
 int getTimeout()
           
 TemporarySelectorsEnabledTransport getTransport()
           
 void setTimeout(int timeout)
           
 Future<WriteResult<Buffer,SocketAddress>> write(Connection connection, SocketAddress dstAddress, Buffer buffer, CompletionHandler<WriteResult<Buffer,SocketAddress>> completionHandler, Interceptor<WriteResult> interceptor)
          Method writes the buffer to the specific address.
 Future<WriteResult<Buffer,SocketAddress>> write(Connection connection, SocketAddress dstAddress, Buffer buffer, CompletionHandler<WriteResult<Buffer,SocketAddress>> completionHandler, Interceptor<WriteResult> interceptor, long timeout, TimeUnit timeunit)
          Method writes the message to the specific address.
protected  int write0(Connection connection, SocketAddress dstAddress, Buffer buffer, WriteResult currentResult, long timeout, TimeUnit timeunit)
          Flush the buffer by looping until the Buffer is empty
protected abstract  int writeNow0(Connection connection, SocketAddress dstAddress, Buffer buffer, WriteResult currentResult)
           
 
Methods inherited from class org.glassfish.grizzly.AbstractWriter
write, write, write, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

transport

protected final TemporarySelectorsEnabledTransport transport
Constructor Detail

TemporarySelectorWriter

public TemporarySelectorWriter(TemporarySelectorsEnabledTransport transport)
Method Detail

getTimeout

public int getTimeout()

setTimeout

public void setTimeout(int timeout)

write

public Future<WriteResult<Buffer,SocketAddress>> write(Connection connection,
                                                       SocketAddress dstAddress,
                                                       Buffer buffer,
                                                       CompletionHandler<WriteResult<Buffer,SocketAddress>> completionHandler,
                                                       Interceptor<WriteResult> interceptor)
                                                throws IOException
Method writes the buffer to the specific address.

Parameters:
connection - the Connection to write to
dstAddress - the destination address the buffer will be sent to
buffer - the buffer, from which the data will be written
completionHandler - CompletionHandler, which will get notified, when write will be completed
interceptor - Interceptor, which will be able to intercept control each time new portion of a data was written from a buffer. The interceptor can decide, whether asynchronous write is completed or not, or provide other processing instructions.
Returns:
Future, using which it's possible to check the result
Throws:
IOException

write

public Future<WriteResult<Buffer,SocketAddress>> write(Connection connection,
                                                       SocketAddress dstAddress,
                                                       Buffer buffer,
                                                       CompletionHandler<WriteResult<Buffer,SocketAddress>> completionHandler,
                                                       Interceptor<WriteResult> interceptor,
                                                       long timeout,
                                                       TimeUnit timeunit)
                                                throws IOException
Method writes the message to the specific address.

Parameters:
connection - the Connection to write to
dstAddress - the destination address the message will be sent to
message - the message, from which the data will be written
completionHandler - CompletionHandler, which will get notified, when write will be completed
Returns:
Future, using which it's possible to check the result
Throws:
IOException

write0

protected int write0(Connection connection,
                     SocketAddress dstAddress,
                     Buffer buffer,
                     WriteResult currentResult,
                     long timeout,
                     TimeUnit timeunit)
              throws IOException
Flush the buffer by looping until the Buffer is empty

Parameters:
channel - SelectableChannel
bb - the Buffer to write.
Returns:
The number of bytes written
Throws:
IOException

getTransport

public TemporarySelectorsEnabledTransport getTransport()

writeNow0

protected abstract int writeNow0(Connection connection,
                                 SocketAddress dstAddress,
                                 Buffer buffer,
                                 WriteResult currentResult)
                          throws IOException
Throws:
IOException


Copyright © 2009 SUN Microsystems. All Rights Reserved.