| org.xsocket.connection.spi.IIoHandler
All known Subclasses: org.xsocket.connection.spi.ExampleIoHandler, org.xsocket.connection.spi.ChainableIoHandler,
IIoHandler | public interface IIoHandler (Code) | | The IIoHandler is responsible to perform the low level io operation of a
IReadWriteableConnection . Each connection holds a dedicated io handler. There
is always a 1:1 life cycle relationship between the connection instance and the io handler
instance.
Because a connection object is stateful, the io handler is (implicit) stateful, too.
The io handler has to handle the read and write operations independently. There is no
implicit call behaviour like request-response.
The io handler is responsible to notify io events by calling the assigned
IIoHandlerCallback reference.
The implementation needn`t to be threadsafe
author: grro@xsocket.org |
close | public void close(boolean immediate) throws IOException(Code) | | non-blocking close of the handler.
The implementation has to be threadsafe
Parameters: immediate - if true, close the connection immediate. If false remainingout buffers (collected by the writOutgoing methods) hasto written before closing throws: IOException - If some other I/O error occurs |
getConnectionTimeoutMillis | public long getConnectionTimeoutMillis()(Code) | | returns the connection timeout.
the connection timeout |
getId | public String getId()(Code) | | return a unique conection id
unique conection is |
getIdleTimeoutMillis | public long getIdleTimeoutMillis()(Code) | | returns the idle timeout.
the idle timeout |
getLocalAddress | public InetAddress getLocalAddress()(Code) | | returns the local address of the underlying connection.
the local address of the underlying connection |
getLocalPort | public int getLocalPort()(Code) | | returns the local port of the underlying connection.
the local port of the underlying connection |
getOption | public Object getOption(String name) throws IOException(Code) | | returns the value of a option
Parameters: name - the name of the option the value of the option throws: IOException - In an I/O error occurs |
getOptions | public Map<String, Class> getOptions()(Code) | | Returns an unmodifiable map of the options supported by this endpont.
The key in the returned map is the name of a option, and its value
is the type of the option value. The returned map will never contain null keys or values.
An unmodifiable map of the options supported by this channel |
getPendingWriteDataSize | public int getPendingWriteDataSize()(Code) | | returns the size of the data which have already been written, but not
yet transferred to the underlying socket.
the size of the pending data to write |
getRemainingMillisToConnectionTimeout | public long getRemainingMillisToConnectionTimeout()(Code) | | returns the remaining time before a connection timeout occurs
the remaining time |
getRemainingMillisToIdleTimeout | public long getRemainingMillisToIdleTimeout()(Code) | | returns the remaining time before a idle timeout occurs
the remaining time |
getRemoteAddress | public InetAddress getRemoteAddress()(Code) | | returns the address of the remote host of the underlying connection.
the address of the remote host of the underlying connection |
getRemotePort | public int getRemotePort()(Code) | | returns the port of the remote host of the underlying connection.
the port of the remote host of the underlying connection |
hasDataToSend | public boolean hasDataToSend()(Code) | | returns if there are data to send
true, if there are data to send |
init | public void init(IIoHandlerCallback callbackHandler) throws IOException(Code) | | "starts" the handler. Callback methods will not be called before
this method has been performed.
Parameters: callbackHandler - the callback handler |
isOpen | public boolean isOpen()(Code) | | check, if the handler (underlying connection) is open.
true, if the handler is open |
reset | public boolean reset()(Code) | | reset internal caches and buffers of the io handler
true, is handler has been reset |
resumeRead | public void resumeRead() throws IOException(Code) | | resume reading data from the underlying subsystem
throws: IOException - If some other I/O error occurs |
setConnectionTimeoutMillis | public void setConnectionTimeoutMillis(long timeout)(Code) | | sets the connection timout.
Parameters: timeout - the connection timeout |
setIdleTimeoutMillis | public void setIdleTimeoutMillis(long timeout)(Code) | | sets the idle timeout.
Parameters: timeout - the idle timeout |
setOption | public void setOption(String name, Object value) throws IOException(Code) | | set a option
Parameters: name - the option name Parameters: value - the option value throws: IOException - In an I/O error occurs |
suspendRead | public void suspendRead() throws IOException(Code) | | suspend reading data from the underlying subsystem
throws: IOException - If some other I/O error occurs |
write | public void write(ByteBuffer[] buffers) throws ClosedChannelException, IOException(Code) | | non-blocking write. Because the IIoHandler is free to write the given buffers
within a backgound activity, the caller can`t reuse the buffers, until the
IIoHandlerCallback.onWritten(IOException) call back method has been called.
Parameters: buffers - the data to add into the out buffer throws: ClosedChannelException - if the underlying connection is already closed throws: IOException - If some other I/O error occurs |
|
|