L - the Connection address typepublic 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.
|
void |
assertOpen()
Checks if this Connection is open and ready to be used.
|
GrizzlyFuture<Closeable> |
close()
Gracefully close the
Connection |
void |
close(CompletionHandler<Closeable> completionHandler)
Deprecated.
use
close() with the following
GrizzlyFuture.addCompletionHandler(org.glassfish.grizzly.CompletionHandler). |
void |
closeSilently()
Gracefully close the
Connection silently, no notification required on completion or failure. |
void |
closeWithReason(IOException reason)
Gracefully closes the Connection and provides the reason description.
|
void |
configureBlocking(boolean isBlocking)
Sets the
Connection mode. |
void |
configureStandalone(boolean isStandalone)
Deprecated.
|
void |
disableIOEvent(IOEvent ioEvent) |
void |
enableIOEvent(IOEvent ioEvent) |
void |
executeInEventThread(IOEvent event,
Runnable runnable)
Executes the
Runnable in the thread, responsible for running the given type of event on this
Connection. |
CloseReason |
getCloseReason()
Returns
CloseReason if this Connection has been closed, or null otherwise. |
L |
getLocalAddress()
Get the connection local address
|
int |
getMaxAsyncWriteQueueSize()
Get the max size (in bytes) of asynchronous write queue associated with connection.
|
MemoryManager<?> |
getMemoryManager() |
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
Buffers, which will be allocated for reading data from Connection. |
long |
getReadTimeout(TimeUnit timeUnit)
Returns the current value for the blocking read timeout converted to the provided
TimeUnit specification. |
Transport |
getTransport()
Get the
Transport, to which this Connection belongs to. |
int |
getWriteBufferSize()
Get the default size of
Buffers, which will be allocated for writing data to Connection. |
long |
getWriteTimeout(TimeUnit timeUnit)
Returns the current value for the blocking write timeout converted to the provided
TimeUnit specification. |
boolean |
isBlocking() |
boolean |
isOpen()
Is
Connection open and ready. |
boolean |
isStandalone()
Deprecated.
|
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
Buffers, which will be allocated for reading data from Connection. |
void |
setReadTimeout(long timeout,
TimeUnit timeUnit)
Specifies the timeout for the blocking reads.
|
void |
setWriteBufferSize(int writeBufferSize)
Set the default size of
Buffers, which will be allocated for writing data to Connection. |
void |
setWriteTimeout(long timeout,
TimeUnit timeUnit)
Specifies the timeout for the blocking writes.
|
void |
simulateIOEvent(IOEvent ioEvent) |
GrizzlyFuture<Closeable> |
terminate()
Close the
Connection |
void |
terminateSilently()
Close the
Connection silently, no notification required on completion or failure. |
void |
terminateWithReason(IOException reason)
Closes the Connection and provides the reason description.
|
canWrite, canWrite, notifyCanWrite, notifyCanWritecloseFuturegetAttributesTransport 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 assertOpen()
throws IOException
IOException giving the reason why this Connection was closed.assertOpen in interface CloseableIOException - giving the reason why this Closeable was closed.CloseReason getCloseReason()
CloseReason if this Connection has been closed, or null otherwise.CloseReason if this Connection has been closed, or null otherwisevoid 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.@Deprecated void configureStandalone(boolean isStandalone)
@Deprecated 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.ioEvent - event to obtain the processor forProcessor, 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.void executeInEventThread(IOEvent event, Runnable runnable)
Runnable in the thread, responsible for running the given type of event on this
Connection. The thread will be chosen based on Transport settings, especially
current I/O strategy.event - event to get the thread pool fromrunnable - Runnable to run in the threadMemoryManager<?> getMemoryManager()
MemoryManager. It's a shortcut for
getTransport().getMemoryManager()L getPeerAddress()
L getLocalAddress()
int getReadBufferSize()
Buffers, which will be allocated for reading data from Connection. The value
less or equal to zero will be ignored.Buffers, which will be allocated for reading data from Connection.void setReadBufferSize(int readBufferSize)
Buffers, which will be allocated for reading data from Connection. The value
less or equal to zero will be ignored.readBufferSize - the default size of Buffers, which will be allocated for reading data from
Connection.int getWriteBufferSize()
Buffers, which will be allocated for writing data to Connection.Buffers, which will be allocated for writing data to Connection.void setWriteBufferSize(int writeBufferSize)
Buffers, which will be allocated for writing data to Connection.writeBufferSize - the default size of Buffers, 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)
TimeUnit specification. If
this value hasn't been explicitly set, it will default to 30 seconds.timeUnit - the TimeUnit to convert the returned result to.void setReadTimeout(long timeout,
TimeUnit timeUnit)
timeout - the new timeout valuetimeUnit - the TimeUnit specification of the provided value.setReadTimeout(long, java.util.concurrent.TimeUnit)long getWriteTimeout(TimeUnit timeUnit)
TimeUnit specification. If
this value hasn't been explicitly set, it will default to 30 seconds.timeUnit - the TimeUnit to convert the returned result to.void setWriteTimeout(long timeout,
TimeUnit timeUnit)
timeout - the new timeout valuetimeUnit - the TimeUnit specification of the provided value.setWriteTimeout(long, java.util.concurrent.TimeUnit)void simulateIOEvent(IOEvent ioEvent) throws IOException
IOExceptionvoid enableIOEvent(IOEvent ioEvent) throws IOException
IOExceptionvoid disableIOEvent(IOEvent ioEvent) throws IOException
IOExceptionMonitoringConfig<ConnectionProbe> getMonitoringConfig()
MonitoringAwareMonitoringConfig.getMonitoringConfig in interface MonitoringAware<ConnectionProbe>MonitoringConfig.void terminateSilently()
Connection silently, no notification required on completion or failure.terminateSilently in interface CloseableGrizzlyFuture<Closeable> terminate()
Connectionvoid terminateWithReason(IOException reason)
terminateSilently(), but additionally provides the reason why the
Connection will be closed.terminateWithReason in interface Closeablereason - reason why terminated. This will be thrown is Closeable.isOpen() is called subsequentlyGrizzlyFuture<Closeable> close()
Connectionclose in interface CloseableFuture, which could be checked in case, if close operation will be run asynchronouslywhich is not asynchronous@Deprecated void close(CompletionHandler<Closeable> completionHandler)
close() with the following
GrizzlyFuture.addCompletionHandler(org.glassfish.grizzly.CompletionHandler).Connectionclose in interface CloseablecompletionHandler - CompletionHandler to be called, when the connection is closed.void closeSilently()
Connection silently, no notification required on completion or failure.closeSilently in interface Closeablevoid closeWithReason(IOException reason)
closeSilently(), but additionally provides the reason why the Connection
will be closed.closeWithReason in interface Closeablereason - reason why closed, this will be thrown by Closeable.isOpen() if called subsequentlyvoid addCloseListener(CloseListener closeListener)
Connection.CloseListener, which will be notified once Connection will be closed.addCloseListener in interface CloseablecloseListener - Connection.CloseListener.boolean removeCloseListener(CloseListener closeListener)
Connection.CloseListener.removeCloseListener in interface CloseablecloseListener - 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 © 2017–2020 Oracle Corporation. All rights reserved.