org.glassfish.grizzly.nio
Class NIOTransport

java.lang.Object
  extended by org.glassfish.grizzly.AbstractTransport
      extended by org.glassfish.grizzly.nio.NIOTransport
All Implemented Interfaces:
JmxMonitoringAware<TransportProbe>, MonitoringAware<TransportProbe>, Transport
Direct Known Subclasses:
TCPNIOTransport, UDPNIOTransport

public abstract class NIOTransport
extends AbstractTransport

Author:
oleksiys

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.glassfish.grizzly.Transport
Transport.State
 
Field Summary
protected  NIOChannelDistributor nioChannelDistributor
           
protected static Random RANDOM
           
protected  SelectionKeyHandler selectionKeyHandler
           
protected  SelectorHandler selectorHandler
           
protected  SelectorProvider selectorProvider
           
protected  SelectorRunner[] selectorRunners
           
protected  int selectorRunnersCount
           
 
Fields inherited from class org.glassfish.grizzly.AbstractTransport
attributeBuilder, connectionMonitoringConfig, isBlocking, isStandalone, kernelPool, kernelPoolConfig, managedWorkerPool, memoryManager, name, processor, processorSelector, readBufferSize, state, strategy, threadPoolMonitoringConfig, transportMonitoringConfig, workerPoolConfig, workerThreadPool, writeBufferSize
 
Fields inherited from interface org.glassfish.grizzly.Transport
DEFAULT_READ_BUFFER_SIZE
 
Constructor Summary
NIOTransport(String name)
           
 
Method Summary
protected abstract  void closeConnection(Connection connection)
          Close the connection, managed by Transport
 NIOChannelDistributor getNIOChannelDistributor()
           
 SelectionKeyHandler getSelectionKeyHandler()
           
 SelectorHandler getSelectorHandler()
           
 SelectorProvider getSelectorProvider()
          Get the SelectorProvider to be used by this transport.
protected  SelectorRunner[] getSelectorRunners()
           
 int getSelectorRunnersCount()
           
protected static void notifyProbesError(NIOTransport transport, Throwable error)
          Notify registered TransportProbes about the error.
protected static void notifyProbesPause(NIOTransport transport)
          Notify registered TransportProbes about the pause event.
protected static void notifyProbesResume(NIOTransport transport)
          Notify registered TransportProbes about the resume event.
protected static void notifyProbesStart(NIOTransport transport)
          Notify registered TransportProbes about the start event.
protected static void notifyProbesStop(NIOTransport transport)
          Notify registered TransportProbes about the stop event.
 void notifyTransportError(Throwable error)
          Method gets invoked, when error occur during the Transport lifecycle.
 void setNIOChannelDistributor(NIOChannelDistributor nioChannelDistributor)
           
 void setSelectionKeyHandler(SelectionKeyHandler selectionKeyHandler)
           
 void setSelectorHandler(SelectorHandler selectorHandler)
           
 void setSelectorProvider(SelectorProvider selectorProvider)
          Set the SelectorProvider to be used by this transport.
 void setSelectorRunnersCount(int selectorRunnersCount)
           
 void start()
          Starts the transport
protected  void startSelectorRunners()
           
protected  void stopSelectorRunners()
           
 
Methods inherited from class org.glassfish.grizzly.AbstractTransport
configureBlocking, createJmxManagementObject, getAttributeBuilder, getConnectionMonitoringConfig, getIOStrategy, getKernelThreadPool, getKernelThreadPoolConfig, getMemoryManager, getMonitoringConfig, getName, getProcessor, getProcessorSelector, getReadBufferSize, getState, getThreadPoolMonitoringConfig, getWorkerThreadPool, getWorkerThreadPoolConfig, getWriteBufferSize, isBlocking, isPaused, isStandalone, isStopped, notifyProbesConfigChanged, obtainProcessor, pause, resume, setAttributeBuilder, setIOStrategy, setKernelPool0, setKernelThreadPool, setKernelThreadPoolConfig, setMemoryManager, setName, setProcessor, setProcessorSelector, setReadBufferSize, setWorkerThreadPool, setWorkerThreadPool0, setWorkerThreadPoolConfig, setWriteBufferSize, stop
 
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
 

Field Detail

RANDOM

protected static final Random RANDOM

selectorHandler

protected SelectorHandler selectorHandler

selectionKeyHandler

protected SelectionKeyHandler selectionKeyHandler

selectorRunnersCount

protected int selectorRunnersCount

selectorRunners

protected SelectorRunner[] selectorRunners

nioChannelDistributor

protected NIOChannelDistributor nioChannelDistributor

selectorProvider

protected SelectorProvider selectorProvider
Constructor Detail

NIOTransport

public NIOTransport(String name)
Method Detail

getSelectionKeyHandler

public SelectionKeyHandler getSelectionKeyHandler()

setSelectionKeyHandler

public void setSelectionKeyHandler(SelectionKeyHandler selectionKeyHandler)

getSelectorHandler

public SelectorHandler getSelectorHandler()

setSelectorHandler

public void setSelectorHandler(SelectorHandler selectorHandler)

getSelectorRunnersCount

public int getSelectorRunnersCount()

setSelectorRunnersCount

public void setSelectorRunnersCount(int selectorRunnersCount)

getSelectorProvider

public SelectorProvider getSelectorProvider()
Get the SelectorProvider to be used by this transport.

Returns:
the SelectorProvider to be used by this transport.

setSelectorProvider

public void setSelectorProvider(SelectorProvider selectorProvider)
Set the SelectorProvider to be used by this transport.

Parameters:
selectorProvider - the SelectorProvider.

start

public void start()
           throws IOException
Description copied from class: AbstractTransport
Starts the transport

Specified by:
start in interface Transport
Specified by:
start in class AbstractTransport
Throws:
IOException

startSelectorRunners

protected void startSelectorRunners()
                             throws IOException
Throws:
IOException

stopSelectorRunners

protected void stopSelectorRunners()
                            throws IOException
Throws:
IOException

getNIOChannelDistributor

public NIOChannelDistributor getNIOChannelDistributor()

setNIOChannelDistributor

public void setNIOChannelDistributor(NIOChannelDistributor nioChannelDistributor)

notifyTransportError

public void notifyTransportError(Throwable error)
Method gets invoked, when error occur during the Transport lifecycle.

Parameters:
error - Throwable.

getSelectorRunners

protected SelectorRunner[] getSelectorRunners()

notifyProbesError

protected static void notifyProbesError(NIOTransport transport,
                                        Throwable error)
Notify registered TransportProbes about the error.

Parameters:
transport - the Transport event occurred on.

notifyProbesStart

protected static void notifyProbesStart(NIOTransport transport)
Notify registered TransportProbes about the start event.

Parameters:
transport - the Transport event occurred on.

notifyProbesStop

protected static void notifyProbesStop(NIOTransport transport)
Notify registered TransportProbes about the stop event.

Parameters:
transport - the Transport event occurred on.

notifyProbesPause

protected static void notifyProbesPause(NIOTransport transport)
Notify registered TransportProbes about the pause event.

Parameters:
transport - the Transport event occurred on.

notifyProbesResume

protected static void notifyProbesResume(NIOTransport transport)
Notify registered TransportProbes about the resume event.

Parameters:
transport - the Transport event occurred on.

closeConnection

protected abstract void closeConnection(Connection connection)
                                 throws IOException
Description copied from class: AbstractTransport
Close the connection, managed by Transport

Specified by:
closeConnection in class AbstractTransport
Throws:
IOException


Copyright © 2012 Oracle Corporation. All Rights Reserved.