|
||||||||||
| 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
|
| Nested classes/interfaces inherited from interface org.glassfish.grizzly.util.ExceptionHandler |
|---|
ExceptionHandler.Severity |
| Method Summary | |
|---|---|
void |
addExceptionHandler(ExceptionHandler handler)
Add ExceptionHandler to handle errors, occurred during the
Transport execution. |
void |
configureBlocking(boolean isBlocking)
Sets the Transport mode. |
void |
fireIOEvent(IOEvent ioEvent,
Connection connection)
Fires specific IOEvent on the Connection |
void |
fireIOEvent(IOEvent ioEvent,
Connection connection,
Object strategyContext)
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. |
ExecutorService |
getInternalThreadPool()
Get a thread pool, which will process transport internal tasks like NIO Selector polling etc. |
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. |
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. |
StateHolder<Transport.State> |
getState()
Return the Transport state controller. |
Strategy |
getStrategy()
Get the Strategy implementation, which will be used by
Transport to process IOEvent. |
ExecutorService |
getWorkerThreadPool()
Get a worker thread pool, which could be chosen to process occurred I/O operations. |
int |
getWriteBufferSize()
Get the default size of Buffers, which will be allocated for
writing data to Transport's Connections. |
boolean |
isBlocking()
Returns the Transport mode. |
boolean |
isStopped()
Returns true, if this Transport is in stopped state, false otherwise. |
void |
notifyException(ExceptionHandler.Severity severity,
Throwable throwable)
Notify about error, occurred during Transport execution. |
void |
pause()
Pauses the transport |
void |
removeExceptionHandler(ExceptionHandler handler)
Remove ExceptionHandler from the list of Transport
ExceptionHandlers. |
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 |
setInternalThreadPool(ExecutorService internalThreadPool)
Set a thread pool, which will process transport internal tasks like NIO Selector polling etc. |
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(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 |
setStrategy(Strategy strategy)
Set the Strategy implementation, which will be used by
Transport to process IOEvent. |
void |
setWorkerThreadPool(ExecutorService workerThreadPool)
Set a worker thread pool, which could be chosen to process occurred I/O operations. |
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 |
|---|
String getName()
Transport name.
Transport name.void setName(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.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.
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 - 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.
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.Strategy getStrategy()
Strategy implementation, which will be used by
Transport to process IOEvent.
Strategy is responsible for choosing the way, how I/O event
will be processed: using current Thread, worker Thread;
or make any other decisions.
Strategy implementation, which will be used by
Transport to process IOEvent.void setStrategy(Strategy strategy)
Strategy implementation, which will be used by
Transport to process IOEvent.
Strategy is responsible for choosing the way, how I/O event
will be processed: using current Thread, worker Thread;
or make any other decisions.
strategy - the Strategy 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 particullar Connection, this setting could be overriden 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 particullar Connection, this setting could be overriden 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 particullar Connection, this setting could be overriden 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 particullar Connection, this setting could be overriden by
Connection.setWriteBufferSize(int).
writeBufferSize - the default size of Buffers, which will
be allocated for writing data to Transport's
Connections.ExecutorService getWorkerThreadPool()
Processors could be executed by this
thread pool.
ExecutorService worker thread pool.void setWorkerThreadPool(ExecutorService workerThreadPool)
Processor could be executed by this
thread pool.
workerThreadPool - ExecutorService worker thread pool.ExecutorService getInternalThreadPool()
Selector polling etc.
ExecutorService internal thread pool.void setInternalThreadPool(ExecutorService internalThreadPool)
Selector polling etc.
internalThreadPool - ExecutorService internal thread pool.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 addExceptionHandler(ExceptionHandler handler)
ExceptionHandler to handle errors, occurred during the
Transport execution.
handler - ExceptionHandler to be added.void removeExceptionHandler(ExceptionHandler handler)
ExceptionHandler from the list of Transport
ExceptionHandlers.
handler - ExceptionHandler to be removed.
void notifyException(ExceptionHandler.Severity severity,
Throwable throwable)
Transport execution.
notifyException in interface ExceptionHandlerseverity - the error severity.throwable - the error description.
void start()
throws IOException
IOException
void stop()
throws IOException
IOException
void pause()
throws IOException
IOException
void resume()
throws IOException
IOException
void fireIOEvent(IOEvent ioEvent,
Connection connection)
throws IOException
IOEvent on the Connection
ioEvent - I/O eventconnection - Connection, on which we fire the event.
IOException
void fireIOEvent(IOEvent ioEvent,
Connection connection,
Object strategyContext)
throws IOException
IOEvent on the Connection
ioEvent - I/O eventconnection - Connection, on which we fire the event.strategyContext - Strategy state
IOExceptionboolean isStopped()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||