|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Transport
Transport interface describes the transport unit used in Grizzly. Transport implementation could operate over TCP, UDP or other custom protocol, using blocking, NIO or NIO.2 Java API.
| Nested Class Summary | |
|---|---|
static class |
Transport.State
|
| Method Summary | |
|---|---|
void |
configureBlocking(boolean isBlocking)
Sets the Transport mode. |
void |
configureStandalone(boolean isStandalone)
|
void |
fireIOEvent(IOEvent ioEvent,
Connection connection,
IOEventProcessingHandler processingHandler)
Fires specific IOEvent on the Connection |
AttributeBuilder |
getAttributeBuilder()
Get Transport associated AttributeBuilder, which will
be used by Transport and its Connections to store custom
Attributes. |
MonitoringConfig<ConnectionProbe> |
getConnectionMonitoringConfig()
Get the monitoring configuration for Transport Connections. |
IOStrategy |
getIOStrategy()
Get the IOStrategy implementation, which will be used by
Transport to process IOEvent. |
java.util.concurrent.ExecutorService |
getKernelThreadPool()
|
ThreadPoolConfig |
getKernelThreadPoolConfig()
|
MemoryManager |
getMemoryManager()
Get the Transport associated MemoryManager, which will
be used by the Transport, its Connections and by during
processing I/O events, occurred on Connections. |
JmxMonitoringConfig<TransportProbe> |
getMonitoringConfig()
Get the Transport monitoring configuration MonitoringConfig. |
java.lang.String |
getName()
Gets the Transport name. |
Processor |
getProcessor()
Gets the default Processor, which will process Connection
I/O events in case, if Connection doesn't have own
Processor preferences. |
ProcessorSelector |
getProcessorSelector()
Gets the default ProcessorSelector, which will be used to get
Processor to process Connection I/O events, in case if
this Transport's Processor is null and
Connection doesn't have neither preferred Processor
nor ProcessorSelector. |
int |
getReadBufferSize()
Get the default size of Buffers, which will be allocated for
reading data from Transport's Connections. |
Reader |
getReader(boolean isBlocking)
Get the Reader implementation, depending on the requested mode. |
Reader |
getReader(Connection connection)
Get the Reader to read data from the Connection. |
StateHolder<Transport.State> |
getState()
Return the Transport state controller. |
MonitoringConfig<ThreadPoolProbe> |
getThreadPoolMonitoringConfig()
Get the monitoring configuration for Transport thread pool. |
java.util.concurrent.ExecutorService |
getWorkerThreadPool()
Get a thread pool, which will run IOEvent processing (depending on Transport IOStrategy) to let kernel threads continue
their job. |
ThreadPoolConfig |
getWorkerThreadPoolConfig()
|
int |
getWriteBufferSize()
Get the default size of Buffers, which will be allocated for
writing data to Transport's Connections. |
Writer |
getWriter(boolean isBlocking)
Get the Writer implementation, depending on the requested mode. |
Writer |
getWriter(Connection connection)
Get the Writer to write data to the Connection. |
boolean |
isBlocking()
Returns the Transport mode. |
boolean |
isPaused()
|
boolean |
isStandalone()
|
boolean |
isStopped()
Returns true, if this Transport is in stopped state, false otherwise. |
void |
notifyTransportError(java.lang.Throwable error)
Method gets invoked, when error occur during the Transport lifecycle. |
Processor |
obtainProcessor(IOEvent ioEvent,
Connection connection)
Gets the default Processor, which will process Transport
Connections I/O events in case, if Connection
doesn't have own Processor preferences. |
void |
pause()
Pauses the transport |
void |
resume()
Resumes the transport after a pause |
void |
setAttributeBuilder(AttributeBuilder attributeBuilder)
Set Transport associated AttributeBuilder, which will
be used by Transport and its Connections to store custom
Attributes. |
void |
setIOStrategy(IOStrategy IOStrategy)
Set the IOStrategy implementation, which will be used by
Transport to process IOEvent. |
void |
setKernelThreadPool(java.util.concurrent.ExecutorService threadPool)
Set a thread pool which will run Transport internal tasks. |
void |
setKernelThreadPoolConfig(ThreadPoolConfig kernelConfig)
Set the ThreadPoolConfig to be used by the Transport internal
thread pool. |
void |
setMemoryManager(MemoryManager memoryManager)
Set the Transport associated MemoryManager, which will
be used by the Transport, its Connections and by during
processing I/O events, occurred on Connections. |
void |
setName(java.lang.String name)
Sets the Transport name. |
void |
setProcessor(Processor processor)
Sets the default Processor, which will process Connection
I/O events in case, if Connection doesn't have own
Processor preferences. |
void |
setProcessorSelector(ProcessorSelector selector)
Sets the default ProcessorSelector, which will be used to get
Processor to process Connection I/O events, in case if
this Transport's Processor is null and
Connection doesn't have neither preferred Processor
nor ProcessorSelector. |
void |
setReadBufferSize(int readBufferSize)
Set the default size of Buffers, which will be allocated for
reading data from Transport's Connections. |
void |
setWorkerThreadPool(java.util.concurrent.ExecutorService threadPool)
Set a thread pool, which will run IOEvent processing (depending on Transport IOStrategy) to let kernel threads continue
their job. |
void |
setWorkerThreadPoolConfig(ThreadPoolConfig workerConfig)
Set the ThreadPoolConfig to be used by the worker thread pool. |
void |
setWriteBufferSize(int writeBufferSize)
Set the default size of Buffers, which will be allocated for
writing data to Transport's Connections. |
void |
start()
Starts the transport |
void |
stop()
Stops the transport and closes all the connections |
| Method Detail |
|---|
java.lang.String getName()
Transport name.
Transport name.void setName(java.lang.String name)
Transport name.
name - the Transport name.StateHolder<Transport.State> getState()
Transport state controller. Using the state controller,
it is possible to get/set the Transport state in thread-safe manner.
StateHolder state controller.boolean isBlocking()
Transport mode.
true, if Transport is operating in blocking mode, or
false otherwise.
Specific Transport Connections may override this setting
by Connection.isBlocking().
Transport mode.
true, if Transport is operating in blocking mode, or
false otherwise.void configureBlocking(boolean isBlocking)
Transport mode.
Specific Transport Connections may override this setting
by Connection.configureBlocking(boolean).
isBlocking - the Transport mode. true,
if Transport should operate in blocking mode, or
false otherwise.void configureStandalone(boolean isStandalone)
boolean isStandalone()
Processor obtainProcessor(IOEvent ioEvent,
Connection connection)
Processor, which will process Transport
Connections I/O events in case, if Connection
doesn't have own Processor preferences.
If Transport associated Processor is null,
and Connection doesn't have any preferred Processor -
then Transport will try to get Processor using
ProcessorSelector.select(IOEvent, Connection).
Processor, which will process
Connection I/O events, if one doesn't have
own Processor preferences.Processor getProcessor()
Processor, which will process Connection
I/O events in case, if Connection doesn't have own
Processor preferences.
If Transport associated Processor is null,
and Connection doesn't have any preferred Processor -
then Transport will try to get Processor using
ProcessorSelector.select(IOEvent, Connection).
Processor, which will process
Connection I/O events, if one doesn't have
own Processor preferences.void setProcessor(Processor processor)
Processor, which will process Connection
I/O events in case, if Connection doesn't have own
Processor preferences.
processor - the default Processor, which will process
Connection I/O events, if one doesn't have own
Processor preferences.ProcessorSelector getProcessorSelector()
ProcessorSelector, which will be used to get
Processor to process Connection I/O events, in case if
this Transport's Processor is null and
Connection doesn't have neither preferred Processor
nor ProcessorSelector.
Transport's ProcessorSelector is the last place, where
Transport will try to get Processor to process
Connection I/O event. If ProcessorSelector is not set -
IllegalStateException will be thrown.
ProcessorSelector, which will be used to get
Processor to process Connection I/O events, in case if
this Transport's Processor is null and
Connection doesn't have neither preferred Processor
nor ProcessorSelector.void setProcessorSelector(ProcessorSelector selector)
ProcessorSelector, which will be used to get
Processor to process Connection I/O events, in case if
this Transport's Processor is null and
Connection doesn't have neither preferred Processor
nor ProcessorSelector.
Transport's ProcessorSelector is the last place, where
Transport will try to get Processor to process
Connection I/O event. If ProcessorSelector is not set -
IllegalStateException will be thrown.
selector - the default ProcessorSelector, which will be used
to get Processor to process Connection I/O events,
in case if this Transport's Processor is null
and Connection doesn't have neither preferred Processor
nor ProcessorSelector.MemoryManager getMemoryManager()
Transport associated MemoryManager, which will
be used by the Transport, its Connections and by during
processing I/O events, occurred on Connections.
Transport associated MemoryManager,
which will be used by the Transport, its Connections
and by during processing I/O events, occurred on Connections.void setMemoryManager(MemoryManager memoryManager)
Transport associated MemoryManager, which will
be used by the Transport, its Connections and by during
processing I/O events, occurred on Connections.
memoryManager - the Transport associated
MemoryManager, which will be used by the Transport,
its Connections and by during processing I/O events, occurred
on Connections.IOStrategy getIOStrategy()
IOStrategy implementation, which will be used by
Transport to process IOEvent.
IOStrategy is responsible for choosing the way, how I/O event
will be processed: using current Thread, worker Thread;
or make any other decisions.
IOStrategy implementation, which will be used by
Transport to process IOEvent.void setIOStrategy(IOStrategy IOStrategy)
IOStrategy implementation, which will be used by
Transport to process IOEvent.
IOStrategy is responsible for choosing the way, how I/O event
will be processed: using current Thread, worker Thread;
or make any other decisions.
IOStrategy - the IOStrategy implementation, which will be used
by Transport to process IOEvent.int getReadBufferSize()
Buffers, which will be allocated for
reading data from Transport's Connections.
For particular Connection, this setting could be overridden by
Connection.getReadBufferSize().
Buffers, which will be allocated for
reading data from Transport's Connections.void setReadBufferSize(int readBufferSize)
Buffers, which will be allocated for
reading data from Transport's Connections.
For particular Connection, this setting could be overridden by
Connection.setReadBufferSize(int).
readBufferSize - the default size of Buffers, which will
be allocated for reading data from Transport's
Connections.int getWriteBufferSize()
Buffers, which will be allocated for
writing data to Transport's Connections.
For particular Connection, this setting could be overridden by
Connection.getWriteBufferSize().
Buffers, which will be allocated for
writing data to Transport's Connections.void setWriteBufferSize(int writeBufferSize)
Buffers, which will be allocated for
writing data to Transport's Connections.
For particular Connection, this setting could be overridden by
Connection.setWriteBufferSize(int).
writeBufferSize - the default size of Buffers, which will
be allocated for writing data to Transport's
Connections.java.util.concurrent.ExecutorService getWorkerThreadPool()
IOStrategy) to let kernel threads continue
their job.
ExecutorService transport worker thread pool.java.util.concurrent.ExecutorService getKernelThreadPool()
ExecutorService responsible for running Transport internal
tasks. For example SelectorRunner
threads for NIO.void setWorkerThreadPool(java.util.concurrent.ExecutorService threadPool)
IOStrategy) to let kernel threads continue
their job.
threadPool - ExecutorService transport worker thread pool.void setKernelThreadPool(java.util.concurrent.ExecutorService threadPool)
SelectorRunner threads for NIO.
threadPool - ExecutorService for SelectorRunnersvoid setKernelThreadPoolConfig(ThreadPoolConfig kernelConfig)
ThreadPoolConfig to be used by the Transport internal
thread pool.
kernelConfig - kernel thread
pool configuration.void setWorkerThreadPoolConfig(ThreadPoolConfig workerConfig)
ThreadPoolConfig to be used by the worker thread pool.
workerConfig - worker thread pool configuration.ThreadPoolConfig getKernelThreadPoolConfig()
ThreadPoolConfig that will be used to construct the
ExecutorService which will run the
Transport's internal tasks.
For example
SelectorRunners for NIO.ThreadPoolConfig getWorkerThreadPoolConfig()
ThreadPoolConfig that will be used to construct the
ExecutorService for IOStrategies
that require worker threads. Depending on the IOStrategy being
used, this may return null.AttributeBuilder getAttributeBuilder()
Transport associated AttributeBuilder, which will
be used by Transport and its Connections to store custom
Attributes.
Transport associated AttributeBuilder, which will
be used by Transport and its Connections to store custom
Attributes.void setAttributeBuilder(AttributeBuilder attributeBuilder)
Transport associated AttributeBuilder, which will
be used by Transport and its Connections to store custom
Attributes.
attributeBuilder - Transport associated
AttributeBuilder, which will be used by Transport and
its Connections to store custom Attributes.
void start()
throws java.io.IOException
java.io.IOException
void stop()
throws java.io.IOException
java.io.IOException
void pause()
throws java.io.IOException
java.io.IOException
void resume()
throws java.io.IOException
java.io.IOException
void fireIOEvent(IOEvent ioEvent,
Connection connection,
IOEventProcessingHandler processingHandler)
IOEvent on the Connection
ioEvent - I/O eventconnection - Connection, on which we fire the event.processingHandler - I/O event processing handler.boolean isStopped()
boolean isPaused()
Reader getReader(Connection connection)
Reader to read data from the Connection.
The Transport may decide to return blocking or non-blocking Reader
depending on the Connection settings.
connection - Connection.
Reader.Reader getReader(boolean isBlocking)
Reader implementation, depending on the requested mode.
isBlocking - blocking mode.
Reader.Writer getWriter(Connection connection)
Writer to write data to the Connection.
The Transport may decide to return blocking or non-blocking Writer
depending on the Connection settings.
connection - Connection.
Writer.Writer getWriter(boolean isBlocking)
Writer implementation, depending on the requested mode.
isBlocking - blocking mode.
Writer.MonitoringConfig<ConnectionProbe> getConnectionMonitoringConfig()
Connections.
MonitoringConfig<ThreadPoolProbe> getThreadPoolMonitoringConfig()
JmxMonitoringConfig<TransportProbe> getMonitoringConfig()
MonitoringConfig.
getMonitoringConfig in interface JmxMonitoringAware<TransportProbe>getMonitoringConfig in interface MonitoringAware<TransportProbe>JmxMonitoringConfig.void notifyTransportError(java.lang.Throwable error)
error - Throwable.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||