public interface Connection<L> extends Readable<L>, Writeable<L>, Closeable, AttributeStorage, MonitoringAware<ConnectionProbe>
Modifier and Type | Interface and Description |
---|---|
static interface |
Connection.CloseListener
Deprecated.
use
CloseListener |
static class |
Connection.CloseType
Deprecated.
use
CloseType |
Modifier and Type | Method and Description |
---|---|
void |
addCloseListener(CloseListener closeListener)
Add the
Connection.CloseListener , which will be notified once Connection
will be closed. |
void |
addCloseListener(Connection.CloseListener closeListener)
Deprecated.
|
GrizzlyFuture<Closeable> |
close()
Close the
Connection |
void |
close(CompletionHandler<Closeable> 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. |
<E> E |
obtainProcessorState(Processor processor,
NullaryFunction<E> factory)
Returns the
Processor state associated with this Connection. |
boolean |
removeCloseListener(CloseListener closeListener)
Remove the
Connection.CloseListener . |
boolean |
removeCloseListener(Connection.CloseListener closeListener)
Deprecated.
|
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) |
canWrite, canWrite, notifyCanWrite, notifyCanWrite
getAttributes
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.L getPeerAddress()
L getLocalAddress()
GrizzlyFuture<Closeable> close()
Connection
void close(CompletionHandler<Closeable> completionHandler)
Connection
close
in interface Closeable
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
.
The value less or equal to zero will be ignored.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
.
The value less or equal to zero will be ignored.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(CloseListener closeListener)
Connection.CloseListener
, which will be notified once Connection
will be closed.addCloseListener
in interface Closeable
closeListener
- Connection.CloseListener
.boolean removeCloseListener(CloseListener closeListener)
Connection.CloseListener
.removeCloseListener
in interface Closeable
closeListener
- Connection.CloseListener
.@Deprecated void addCloseListener(Connection.CloseListener closeListener)
addCloseListener(org.glassfish.grizzly.CloseListener)
Connection.CloseListener
, which will be notified once Connection
will be closed.closeListener
- Connection.CloseListener
@Deprecated boolean removeCloseListener(Connection.CloseListener closeListener)
removeCloseListener(org.glassfish.grizzly.CloseListener)
Connection.CloseListener
.closeListener
- Connection.CloseListener
.Copyright © 2014 Oracle Corporation. All rights reserved.