org.glassfish.grizzly.nio.tmpselectors
Class TemporarySelectorWriter

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

public abstract class TemporarySelectorWriter
extends AbstractWriter<java.net.SocketAddress>

Author:
oleksiys

Field Summary
protected  TemporarySelectorsEnabledTransport transport
           
 
Constructor Summary
TemporarySelectorWriter(TemporarySelectorsEnabledTransport transport)
           
 
Method Summary
 TemporarySelectorsEnabledTransport getTransport()
           
 GrizzlyFuture<WriteResult<Buffer,java.net.SocketAddress>> write(Connection connection, java.net.SocketAddress dstAddress, Buffer buffer, CompletionHandler<WriteResult<Buffer,java.net.SocketAddress>> completionHandler, Interceptor<WriteResult<Buffer,java.net.SocketAddress>> interceptor)
          Method writes the buffer to the specific address.
 GrizzlyFuture<WriteResult<Buffer,java.net.SocketAddress>> write(Connection connection, java.net.SocketAddress dstAddress, Buffer message, CompletionHandler<WriteResult<Buffer,java.net.SocketAddress>> completionHandler, Interceptor<WriteResult<Buffer,java.net.SocketAddress>> interceptor, long timeout, java.util.concurrent.TimeUnit timeunit)
          Method writes the message to the specific address.
protected  int write0(NIOConnection connection, java.net.SocketAddress dstAddress, Buffer buffer, WriteResult<Buffer,java.net.SocketAddress> currentResult, long timeout, java.util.concurrent.TimeUnit timeunit)
          Flush the buffer by looping until the Buffer is empty
protected abstract  int writeNow0(NIOConnection connection, java.net.SocketAddress dstAddress, Buffer buffer, WriteResult<Buffer,java.net.SocketAddress> currentResult)
           
 
Methods inherited from class org.glassfish.grizzly.AbstractWriter
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

write

public GrizzlyFuture<WriteResult<Buffer,java.net.SocketAddress>> write(Connection connection,
                                                                       java.net.SocketAddress dstAddress,
                                                                       Buffer buffer,
                                                                       CompletionHandler<WriteResult<Buffer,java.net.SocketAddress>> completionHandler,
                                                                       Interceptor<WriteResult<Buffer,java.net.SocketAddress>> interceptor)
                                                                throws java.io.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:
java.io.IOException

write

public GrizzlyFuture<WriteResult<Buffer,java.net.SocketAddress>> write(Connection connection,
                                                                       java.net.SocketAddress dstAddress,
                                                                       Buffer message,
                                                                       CompletionHandler<WriteResult<Buffer,java.net.SocketAddress>> completionHandler,
                                                                       Interceptor<WriteResult<Buffer,java.net.SocketAddress>> interceptor,
                                                                       long timeout,
                                                                       java.util.concurrent.TimeUnit timeunit)
                                                                throws java.io.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:
java.io.IOException

write0

protected int write0(NIOConnection connection,
                     java.net.SocketAddress dstAddress,
                     Buffer buffer,
                     WriteResult<Buffer,java.net.SocketAddress> currentResult,
                     long timeout,
                     java.util.concurrent.TimeUnit timeunit)
              throws java.io.IOException
Flush the buffer by looping until the Buffer is empty

Parameters:
connection - the Connection.
dstAddress - the destination address.
buffer - the Buffer to write.
currentResult - the result of the write operation
timeout - operation timeout value value
timeunit - the timeout unit
Returns:
The number of bytes written.
Throws:
java.io.IOException

getTransport

public TemporarySelectorsEnabledTransport getTransport()

writeNow0

protected abstract int writeNow0(NIOConnection connection,
                                 java.net.SocketAddress dstAddress,
                                 Buffer buffer,
                                 WriteResult<Buffer,java.net.SocketAddress> currentResult)
                          throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2011 Oracle Corpration. All Rights Reserved.