|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Connection<L>
Common interface, which represents any kind of connection.
Nested Class Summary | |
---|---|
static interface |
Connection.CloseListener
The listener, which is used to be notified, when Connection gets closed. |
static class |
Connection.CloseType
|
Method Summary | ||
---|---|---|
void |
addCloseListener(Connection.CloseListener closeListener)
Add the Connection.CloseListener , which will be notified once Connection
will be closed. |
|
GrizzlyFuture<Connection> |
close()
Close the Connection |
|
void |
close(CompletionHandler<Connection> completionHandler)
Close the Connection |
|
void |
closeSilently()
Close the Connection silently, no notification required on
completion or failure. |
|
void |
configureBlocking(boolean isBlocking)
Sets the Connection mode. |
|
void |
configureStandalone(boolean isStandalone)
|
|
void |
disableIOEvent(IOEvent ioEvent)
|
|
void |
enableIOEvent(IOEvent ioEvent)
|
|
L |
getLocalAddress()
Get the connection local address |
|
int |
getMaxAsyncWriteQueueSize()
Get the max size (in bytes) of asynchronous write queue associated with connection. |
|
MonitoringConfig<ConnectionProbe> |
getMonitoringConfig()
Return the object associated MonitoringConfig . |
|
L |
getPeerAddress()
Get the connection peer address |
|
Processor |
getProcessor()
Gets the default Processor , which will process Connection
I/O events. |
|
ProcessorSelector |
getProcessorSelector()
Gets the default ProcessorSelector , which will be used to get
Processor to process Connection I/O events, in case if
this Connection 's Processor is null. |
|
int |
getReadBufferSize()
Get the default size of Buffer s, which will be allocated for
reading data from Connection . |
|
long |
getReadTimeout(TimeUnit timeUnit)
|
|
Transport |
getTransport()
Get the Transport , to which this Connection belongs to. |
|
int |
getWriteBufferSize()
Get the default size of Buffer s, which will be allocated for
writing data to Connection . |
|
long |
getWriteTimeout(TimeUnit timeUnit)
|
|
boolean |
isBlocking()
|
|
boolean |
isOpen()
Is Connection open and ready. |
|
boolean |
isStandalone()
|
|
void |
notifyConnectionError(Throwable error)
Method gets invoked, when error occur during the Connection lifecycle. |
|
Processor |
obtainProcessor(IOEvent ioEvent)
Gets the Processor , which will process Connection
I/O event. |
|
|
obtainProcessorState(Processor processor,
NullaryFunction<E> factory)
Returns the Processor state associated with this Connection. |
|
boolean |
removeCloseListener(Connection.CloseListener closeListener)
Remove the Connection.CloseListener . |
|
void |
setMaxAsyncWriteQueueSize(int maxAsyncWriteQueueSize)
Set the max size (in bytes) of asynchronous write queue associated with connection. |
|
void |
setProcessor(Processor preferableProcessor)
Sets the default Processor , which will process Connection
I/O events. |
|
void |
setProcessorSelector(ProcessorSelector preferableProcessorSelector)
Sets the default ProcessorSelector , which will be used to get
Processor to process Connection I/O events, in case if
this Connection 's Processor is null. |
|
void |
setReadBufferSize(int readBufferSize)
Set the default size of Buffer s, which will be allocated for
reading data from Connection . |
|
void |
setReadTimeout(long timeout,
TimeUnit timeUnit)
|
|
void |
setWriteBufferSize(int writeBufferSize)
Set the default size of Buffer s, which will be allocated for
writing data to Connection . |
|
void |
setWriteTimeout(long timeout,
TimeUnit timeUnit)
|
|
void |
simulateIOEvent(IOEvent ioEvent)
|
Methods inherited from interface org.glassfish.grizzly.Readable |
---|
read, read |
Methods inherited from interface org.glassfish.grizzly.Writable |
---|
write, write, write, write |
Methods inherited from interface org.glassfish.grizzly.attributes.AttributeStorage |
---|
getAttributes |
Method Detail |
---|
Transport getTransport()
Transport
, to which this Connection
belongs to.
Transport
, to which this Connection
belongs to.boolean isOpen()
Connection
open and ready.
Returns true, if connection is open and ready, or false
otherwise.
void configureBlocking(boolean isBlocking)
Connection
mode.
isBlocking
- the Connection
mode. true,
if Connection
should operate in blocking mode, or
false otherwise.boolean isBlocking()
Connection
mode.
true, if Connection
is operating in blocking mode, or
false otherwise.void configureStandalone(boolean isStandalone)
boolean isStandalone()
Processor obtainProcessor(IOEvent ioEvent)
Processor
, which will process Connection
I/O event.
If Processor
is null, - then Transport
will try
to get Processor
using Connection
's
ProcessorSelector.select(IOEvent, Connection)
. If
ProcessorSelector
, associated withthe Connection
is also
null - will ask Transport
for a Processor
.
Processor
, which will process
Connection
I/O events.Processor getProcessor()
Processor
, which will process Connection
I/O events.
If Processor
is null, - then Transport
will try
to get Processor
using Connection
's
ProcessorSelector.select(IOEvent, Connection)
. If
ProcessorSelector
, associated withthe Connection
is also
null - Transport
will try to get Processor
using own settings.
Processor
, which will process
Connection
I/O events.void setProcessor(Processor preferableProcessor)
Processor
, which will process Connection
I/O events.
If Processor
is null, - then Transport
will try
to get Processor
using Connection
's
ProcessorSelector.select(IOEvent, Connection)
. If
ProcessorSelector
, associated withthe Connection
is also
null - Transport
will try to get Processor
using own settings.
preferableProcessor
- the default Processor
, which will
process Connection
I/O events.ProcessorSelector getProcessorSelector()
ProcessorSelector
, which will be used to get
Processor
to process Connection
I/O events, in case if
this Connection
's Processor
is null.
ProcessorSelector
, which will be used to get
Processor
to process Connection
I/O events, in case if
this Connection
's Processor
is null.void setProcessorSelector(ProcessorSelector preferableProcessorSelector)
ProcessorSelector
, which will be used to get
Processor
to process Connection
I/O events, in case if
this Connection
's Processor
is null.
preferableProcessorSelector
- the default ProcessorSelector
,
which will be used to get Processor
to process Connection
I/O events, in case if this Connection
's Processor
is null.<E> E obtainProcessorState(Processor processor, NullaryFunction<E> factory)
Processor
state associated with this Connection.
processor
- Processor
Processor
state associated with this Connection.L getPeerAddress()
L getLocalAddress()
GrizzlyFuture<Connection> close()
Connection
close
in interface Closeable<Connection>
Future
, which could be checked in case, if close operation
will be run asynchronouslyvoid close(CompletionHandler<Connection> completionHandler)
Connection
close
in interface Closeable<Connection>
completionHandler
- CompletionHandler
to be called, when
the connection is closed.void closeSilently()
Connection
silently, no notification required on
completion or failure.
int getReadBufferSize()
Buffer
s, which will be allocated for
reading data from Connection
.
Buffer
s, which will be allocated for
reading data from Connection
.void setReadBufferSize(int readBufferSize)
Buffer
s, which will be allocated for
reading data from Connection
.
readBufferSize
- the default size of Buffer
s, which will
be allocated for reading data from Connection
.int getWriteBufferSize()
Buffer
s, which will be allocated for
writing data to Connection
.
Buffer
s, which will be allocated for
writing data to Connection
.void setWriteBufferSize(int writeBufferSize)
Buffer
s, which will be allocated for
writing data to Connection
.
writeBufferSize
- the default size of Buffer
s, which will
be allocated for writing data to Connection
.int getMaxAsyncWriteQueueSize()
void setMaxAsyncWriteQueueSize(int maxAsyncWriteQueueSize)
maxAsyncWriteQueueSize
- the max size (in bytes) of asynchronous
write queue associated with connection.long getReadTimeout(TimeUnit timeUnit)
void setReadTimeout(long timeout, TimeUnit timeUnit)
long getWriteTimeout(TimeUnit timeUnit)
void setWriteTimeout(long timeout, TimeUnit timeUnit)
void simulateIOEvent(IOEvent ioEvent) throws IOException
IOException
void enableIOEvent(IOEvent ioEvent) throws IOException
IOException
void disableIOEvent(IOEvent ioEvent) throws IOException
IOException
MonitoringConfig<ConnectionProbe> getMonitoringConfig()
MonitoringAware
MonitoringConfig
.
getMonitoringConfig
in interface MonitoringAware<ConnectionProbe>
MonitoringConfig
.void addCloseListener(Connection.CloseListener closeListener)
Connection.CloseListener
, which will be notified once Connection
will be closed.
closeListener
- Connection.CloseListener
.boolean removeCloseListener(Connection.CloseListener closeListener)
Connection.CloseListener
.
closeListener
- Connection.CloseListener
.void notifyConnectionError(Throwable error)
error
- Throwable
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |