|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.glassfish.grizzly.AbstractTransport
public abstract class AbstractTransport
Abstract Transport.
Implements common transport functionality.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.glassfish.grizzly.Transport |
|---|
Transport.State |
| Field Summary | |
|---|---|
protected AttributeBuilder |
attributeBuilder
Transport AttributeBuilder, which will be used to create Attributes |
protected MonitoringConfigImpl<ConnectionProbe> |
connectionMonitoringConfig
Connection probes |
protected boolean |
isBlocking
Transport mode |
protected boolean |
isStandalone
|
protected java.util.concurrent.ExecutorService |
kernelPool
Kernel thread pool. |
protected ThreadPoolConfig |
kernelPoolConfig
|
protected boolean |
managedWorkerPool
|
protected MemoryManager |
memoryManager
Transport MemoryManager |
protected java.lang.String |
name
Transport name |
protected Processor |
processor
Transport default Processor |
protected ProcessorSelector |
processorSelector
Transport default ProcessorSelector |
protected int |
readBufferSize
Transport default buffer size for read operations |
protected StateHolder<Transport.State> |
state
Transport state controller |
protected IOStrategy |
strategy
Transport strategy |
protected MonitoringConfigImpl<ThreadPoolProbe> |
threadPoolMonitoringConfig
Thread pool probes |
protected AbstractJmxMonitoringConfig<TransportProbe> |
transportMonitoringConfig
Transport probes |
protected ThreadPoolConfig |
workerPoolConfig
|
protected java.util.concurrent.ExecutorService |
workerThreadPool
Worker thread pool |
protected int |
writeBufferSize
Transport default buffer size for write operations |
| Constructor Summary | |
|---|---|
AbstractTransport(java.lang.String name)
|
|
| Method Summary | |
|---|---|
protected abstract void |
closeConnection(Connection connection)
Close the connection, managed by Transport |
void |
configureBlocking(boolean isBlocking)
Sets the Transport mode. |
protected abstract JmxObject |
createJmxManagementObject()
Create the Transport JMX managment object. |
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. |
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. |
boolean |
isBlocking()
Returns the Transport mode. |
boolean |
isPaused()
|
boolean |
isStandalone()
|
boolean |
isStopped()
Returns true, if this Transport is in stopped state, false otherwise. |
protected static void |
notifyProbesConfigChanged(AbstractTransport transport)
Notify registered TransportProbes about the config changed event. |
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. |
abstract void |
pause()
Pauses the transport |
abstract 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. |
protected void |
setKernelPool0(java.util.concurrent.ExecutorService kernelPool)
|
void |
setKernelThreadPool(java.util.concurrent.ExecutorService kernelPool)
Set a thread pool which will run Transport internal tasks. |
void |
setKernelThreadPoolConfig(ThreadPoolConfig kernelPoolConfig)
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. |
protected void |
setWorkerThreadPool0(java.util.concurrent.ExecutorService threadPool)
|
void |
setWorkerThreadPoolConfig(ThreadPoolConfig workerPoolConfig)
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. |
abstract void |
start()
Starts the transport |
abstract void |
stop()
Stops the transport and closes all the connections |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.glassfish.grizzly.Transport |
|---|
configureStandalone, fireIOEvent, getReader, getReader, getWriter, getWriter, notifyTransportError |
| Field Detail |
|---|
protected java.lang.String name
protected volatile boolean isBlocking
protected volatile boolean isStandalone
protected final StateHolder<Transport.State> state
protected Processor processor
protected ProcessorSelector processorSelector
protected IOStrategy strategy
protected MemoryManager memoryManager
protected java.util.concurrent.ExecutorService workerThreadPool
protected java.util.concurrent.ExecutorService kernelPool
protected AttributeBuilder attributeBuilder
protected int readBufferSize
protected int writeBufferSize
protected ThreadPoolConfig workerPoolConfig
protected ThreadPoolConfig kernelPoolConfig
protected boolean managedWorkerPool
protected final AbstractJmxMonitoringConfig<TransportProbe> transportMonitoringConfig
protected final MonitoringConfigImpl<ConnectionProbe> connectionMonitoringConfig
protected final MonitoringConfigImpl<ThreadPoolProbe> threadPoolMonitoringConfig
| Constructor Detail |
|---|
public AbstractTransport(java.lang.String name)
| Method Detail |
|---|
public java.lang.String getName()
Transport name.
getName in interface TransportTransport name.public void setName(java.lang.String name)
Transport name.
setName in interface Transportname - the Transport name.public 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().
isBlocking in interface TransportTransport mode.
true, if Transport is operating in blocking mode, or
false otherwise.public void configureBlocking(boolean isBlocking)
Transport mode.
Specific Transport Connections may override this setting
by Connection.configureBlocking(boolean).
configureBlocking in interface TransportisBlocking - the Transport mode. true,
if Transport should operate in blocking mode, or
false otherwise.public boolean isStandalone()
isStandalone in interface Transportpublic StateHolder<Transport.State> getState()
Transport state controller. Using the state controller,
it is possible to get/set the Transport state in thread-safe manner.
getState in interface TransportStateHolder state controller.public 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().
getReadBufferSize in interface TransportBuffers, which will be allocated for
reading data from Transport's Connections.public 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).
setReadBufferSize in interface TransportreadBufferSize - the default size of Buffers, which will
be allocated for reading data from Transport's
Connections.public 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().
getWriteBufferSize in interface TransportBuffers, which will be allocated for
writing data to Transport's Connections.public 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).
setWriteBufferSize in interface TransportwriteBufferSize - the default size of Buffers, which will
be allocated for writing data to Transport's
Connections.public boolean isStopped()
isStopped in interface Transportpublic boolean isPaused()
isPaused in interface Transport
public 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).
obtainProcessor in interface TransportProcessor, which will process
Connection I/O events, if one doesn't have
own Processor preferences.public 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).
getProcessor in interface TransportProcessor, which will process
Connection I/O events, if one doesn't have
own Processor preferences.public void setProcessor(Processor processor)
Processor, which will process Connection
I/O events in case, if Connection doesn't have own
Processor preferences.
setProcessor in interface Transportprocessor - the default Processor, which will process
Connection I/O events, if one doesn't have own
Processor preferences.public 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.
getProcessorSelector in interface TransportProcessorSelector, 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.public 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.
setProcessorSelector in interface Transportselector - 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.public 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.
getIOStrategy in interface TransportIOStrategy implementation, which will be used by
Transport to process IOEvent.public 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.
setIOStrategy in interface TransportIOStrategy - the IOStrategy implementation, which will be used
by Transport to process IOEvent.public MemoryManager getMemoryManager()
Transport associated MemoryManager, which will
be used by the Transport, its Connections and by during
processing I/O events, occurred on Connections.
getMemoryManager in interface TransportTransport associated MemoryManager,
which will be used by the Transport, its Connections
and by during processing I/O events, occurred on Connections.public 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.
setMemoryManager in interface TransportmemoryManager - the Transport associated
MemoryManager, which will be used by the Transport,
its Connections and by during processing I/O events, occurred
on Connections.public java.util.concurrent.ExecutorService getWorkerThreadPool()
IOStrategy) to let kernel threads continue
their job.
getWorkerThreadPool in interface TransportExecutorService transport worker thread pool.public java.util.concurrent.ExecutorService getKernelThreadPool()
getKernelThreadPool in interface TransportExecutorService responsible for running Transport internal
tasks. For example SelectorRunner
threads for NIO.public void setKernelThreadPool(java.util.concurrent.ExecutorService kernelPool)
SelectorRunner threads for NIO.
setKernelThreadPool in interface TransportkernelPool - ExecutorService for SelectorRunnerspublic void setKernelThreadPoolConfig(ThreadPoolConfig kernelPoolConfig)
ThreadPoolConfig to be used by the Transport internal
thread pool.
setKernelThreadPoolConfig in interface TransportkernelPoolConfig - kernel thread
pool configuration.public void setWorkerThreadPoolConfig(ThreadPoolConfig workerPoolConfig)
ThreadPoolConfig to be used by the worker thread pool.
setWorkerThreadPoolConfig in interface TransportworkerPoolConfig - worker thread pool configuration.public ThreadPoolConfig getKernelThreadPoolConfig()
getKernelThreadPoolConfig in interface TransportThreadPoolConfig that will be used to construct the
ExecutorService which will run the
Transport's internal tasks.
For example
SelectorRunners for NIO.public ThreadPoolConfig getWorkerThreadPoolConfig()
getWorkerThreadPoolConfig in interface TransportThreadPoolConfig that will be used to construct the
ExecutorService for IOStrategies
that require worker threads. Depending on the IOStrategy being
used, this may return null.public void setWorkerThreadPool(java.util.concurrent.ExecutorService threadPool)
IOStrategy) to let kernel threads continue
their job.
setWorkerThreadPool in interface TransportthreadPool - ExecutorService transport worker thread pool.protected void setWorkerThreadPool0(java.util.concurrent.ExecutorService threadPool)
protected void setKernelPool0(java.util.concurrent.ExecutorService kernelPool)
public AttributeBuilder getAttributeBuilder()
Transport associated AttributeBuilder, which will
be used by Transport and its Connections to store custom
Attributes.
getAttributeBuilder in interface TransportTransport associated AttributeBuilder, which will
be used by Transport and its Connections to store custom
Attributes.public void setAttributeBuilder(AttributeBuilder attributeBuilder)
Transport associated AttributeBuilder, which will
be used by Transport and its Connections to store custom
Attributes.
setAttributeBuilder in interface TransportattributeBuilder - Transport associated
AttributeBuilder, which will be used by Transport and
its Connections to store custom Attributes.
protected abstract void closeConnection(Connection connection)
throws java.io.IOException
connection -
java.io.IOExceptionpublic MonitoringConfig<ConnectionProbe> getConnectionMonitoringConfig()
Connections.
getConnectionMonitoringConfig in interface Transportpublic JmxMonitoringConfig<TransportProbe> getMonitoringConfig()
MonitoringConfig.
getMonitoringConfig in interface JmxMonitoringAware<TransportProbe>getMonitoringConfig in interface MonitoringAware<TransportProbe>getMonitoringConfig in interface TransportJmxMonitoringConfig.public MonitoringConfig<ThreadPoolProbe> getThreadPoolMonitoringConfig()
getThreadPoolMonitoringConfig in interface Transportprotected static void notifyProbesConfigChanged(AbstractTransport transport)
TransportProbes about the config changed event.
transport - the Transport event occurred on.
public abstract void start()
throws java.io.IOException
start in interface Transportjava.io.IOException
public abstract void stop()
throws java.io.IOException
stop in interface Transportjava.io.IOException
public abstract void pause()
throws java.io.IOException
pause in interface Transportjava.io.IOException
public abstract void resume()
throws java.io.IOException
resume in interface Transportjava.io.IOExceptionprotected abstract JmxObject createJmxManagementObject()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||