C
- the Connection
type.public class SynchronousHandler<C extends Connection> extends AbstractFilteredHandler<SynchronousHandler<C>,C,ByteBuffer>
AbstractFilteredHandler
with synchronous behavior.Modifier and Type | Class and Description |
---|---|
protected class |
SynchronousHandler.ManagedInputStream
A subclass of
InputStream that is managed underneath. |
protected class |
SynchronousHandler.ManagedOutputStream
A subclass of
OutputStream that is managed underneath. |
protected static interface |
SynchronousHandler.Resolver
Defines a gadget that supports
SynchronousHandler.ManagedInputStream and
SynchronousHandler.ManagedOutputStream . |
ConnectionHandler.ClosingType
Modifier and Type | Field and Description |
---|---|
protected static int |
FLAG_BOUND
A bit flag indicating that the associated connection has been bound.
|
protected static int |
FLAG_CLOSED
A bit flag indicating that the associated connection has been closed.
|
protected static org.slf4j.Logger |
log
The static
Logger instance. |
dummyFuture
Constructor and Description |
---|
SynchronousHandler(String name)
Alternate constructor.
|
SynchronousHandler(String name,
int bufferSize)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
protected static void |
debug(String format,
Object... args)
Logs a debugging message.
|
InputStream |
getInputStream()
Gets the
InputStream . |
OutputStream |
getOutputStream()
Gets the
OutputStream . |
void |
onBind(Queue<ByteBuffer> inputs)
On binding.
|
void |
onClose()
On completion of closure.
|
void |
onClosing(ConnectionHandler.ClosingType type,
Queue<ByteBuffer> inputs)
On closure.
|
void |
onReceive(Queue<ByteBuffer> inputs)
On receipt of data.
|
protected void |
setInResolverDisabled()
Sets a read
SynchronousHandler.Resolver for when read operation interest is disabled. |
protected void |
setInResolverEnabled()
Sets a read
SynchronousHandler.Resolver for when read operation interest is enabled. |
protected void |
setInResolverEos()
Sets a read
SynchronousHandler.Resolver for when an end-of-stream has been reached. |
protected void |
setInResolverError(IOException e)
Sets an error read
SynchronousHandler.Resolver . |
protected void |
setOutResolverDefault()
Sets the default write
SynchronousHandler.Resolver . |
protected void |
setOutResolverError(IOException e)
Sets an error write
SynchronousHandler.Resolver . |
protected void |
waitInterruptibly()
Waits interruptibly on this connection's monitor.
|
close, getConnection, onBind, onClosing, onOob, onOob, onReceive, send, setConnection, setFilterFactory, toString
protected static final int FLAG_BOUND
protected static final int FLAG_CLOSED
protected static final org.slf4j.Logger log
Logger
instance.public SynchronousHandler(String name, int bufferSize)
public SynchronousHandler(String name)
protected void setInResolverEnabled()
SynchronousHandler.Resolver
for when read operation interest is enabled.protected void setInResolverDisabled()
SynchronousHandler.Resolver
for when read operation interest is disabled.protected void setInResolverEos()
SynchronousHandler.Resolver
for when an end-of-stream has been reached.protected void setInResolverError(IOException e)
SynchronousHandler.Resolver
.protected void setOutResolverDefault()
SynchronousHandler.Resolver
.protected void setOutResolverError(IOException e)
SynchronousHandler.Resolver
.public InputStream getInputStream()
InputStream
.public OutputStream getOutputStream()
OutputStream
.public void onBind(Queue<ByteBuffer> inputs)
FilteredHandler
inputs
- the input Queue
.public void onReceive(Queue<ByteBuffer> inputs)
FilteredHandler
inputs
- the input Queue
.public void onClosing(ConnectionHandler.ClosingType type, Queue<ByteBuffer> inputs)
FilteredHandler
type
- the ConnectionHandler.ClosingType
.inputs
- the input Queue
.ConnectionHandler.ClosingType
public void onClose()
ConnectionHandler
protected void waitInterruptibly() throws IOException
IOException
- when the current operation is interrupted; wraps an InterruptedException
.