jremote jbase5.2.1

com.jbase.jremote.io.inflow
Class RequestListenerService

java.lang.Object
  extended by java.lang.Thread
      extended by com.jbase.jremote.io.inflow.RequestListenerService
All Implemented Interfaces:
RequestListenerServiceMBean, Runnable, javax.resource.spi.work.Work

public class RequestListenerService
extends Thread
implements RequestListenerServiceMBean, javax.resource.spi.work.Work


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
protected RequestListenerService()
          Provided to allow tests to mock out methods of this class
  RequestListenerService(RequestProcessingAbstractFactory requestProcessingFactory, javax.resource.spi.XATerminator xaTerminator, String host, int port)
          Construct service that will not create new threads for client connections.
  RequestListenerService(RequestProcessingAbstractFactory requestProcessingFactory, javax.resource.spi.XATerminator xaTerminator, javax.resource.spi.work.WorkManager workManager, String host, int port, boolean threadPerConnection)
          Supply a work manager and optionally create a new thread to handle each client connection.
 
Method Summary
 void decrementActiveConnections()
           
protected  boolean doAccept(SelectionKey key)
           
protected  void doClose(SelectionKey key)
           
protected  boolean doRead(SelectionKey key)
           
protected  boolean doWrite(SelectionKey key)
           
 int getActivationsPerMinute()
          Returns the number of activation processed per minute from the time statistics were activated.
 int getActivationsProcessedInLastMinute(StatisticsCounter statisticType)
           
 int getActiveConnections()
          Return the number clients that are currently connected.
 int getActiveTransactions()
          Return the number of transactions that are currently being processed.
 int getDefaultReceiveBufferSize()
           
 int getDefaultSendBufferSize()
           
protected  double getElapsedMinutes(long startedTime)
           
 javax.resource.spi.work.ExecutionContext getExecutionContext(String sessionId)
           
protected  long getNowTime()
           
protected  RequestHandler getRequestHandler()
           
 long getTotalActivations()
          Return the total number of activation requests processed.
 javax.resource.spi.work.WorkManager getWorkManager()
           
 javax.resource.spi.XATerminator getXATerminator()
           
 void incrementActivationCount(StatisticsCounter statisticType)
          A RequestHandler is able to call back to this RequestListenerService to track what it considers an activation.
 void incrementActiveConnections()
           
 boolean isListening()
           
 boolean isRunning()
           
 void release()
           
 javax.resource.spi.work.ExecutionContext removeExecutionContext(String sessionId)
           
 void run()
           
 void send(SocketChannel channel, byte[] response)
           
 void setDefaultReceiveBufferSize(int bytes)
          Modify the TCP buffer settings to maximize the performance for the client network.
 void setDefaultSendBufferSize(int bytes)
           
 void setExecutionContext(String sessionId, javax.resource.spi.work.ExecutionContext ec)
           
 void setRunning(Boolean running)
           
protected  void startIOListener()
           
protected  void startListener()
           
protected  void startNIOListener()
           
 void startStatistics()
          Start recording statistics and reset any existing statistical data.
 void stopStatistics()
          Stop recording statistics and reset any existing statistical data.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RequestListenerService

protected RequestListenerService()
Provided to allow tests to mock out methods of this class


RequestListenerService

public RequestListenerService(RequestProcessingAbstractFactory requestProcessingFactory,
                              javax.resource.spi.XATerminator xaTerminator,
                              String host,
                              int port)

Construct service that will not create new threads for client connections.

Parameters:
requestProcessingFactory -
xaTerminator -
host -
port -

RequestListenerService

public RequestListenerService(RequestProcessingAbstractFactory requestProcessingFactory,
                              javax.resource.spi.XATerminator xaTerminator,
                              javax.resource.spi.work.WorkManager workManager,
                              String host,
                              int port,
                              boolean threadPerConnection)

Supply a work manager and optionally create a new thread to handle each client connection.

Parameters:
requestProcessingFactory -
xaTerminator -
workManager -
host -
port -
threadPerConnection -
Method Detail

isRunning

public boolean isRunning()

isListening

public boolean isListening()

setRunning

public void setRunning(Boolean running)

getRequestHandler

protected RequestHandler getRequestHandler()

getXATerminator

public javax.resource.spi.XATerminator getXATerminator()

getWorkManager

public javax.resource.spi.work.WorkManager getWorkManager()

getExecutionContext

public javax.resource.spi.work.ExecutionContext getExecutionContext(String sessionId)

removeExecutionContext

public javax.resource.spi.work.ExecutionContext removeExecutionContext(String sessionId)

setExecutionContext

public void setExecutionContext(String sessionId,
                                javax.resource.spi.work.ExecutionContext ec)

startListener

protected void startListener()

startIOListener

protected void startIOListener()
                        throws IOException
Throws:
IOException

startNIOListener

protected void startNIOListener()
                         throws IOException
Throws:
IOException

release

public void release()
Specified by:
release in interface javax.resource.spi.work.Work

run

public void run()
Specified by:
run in interface Runnable
Overrides:
run in class Thread

doAccept

protected boolean doAccept(SelectionKey key)

doRead

protected boolean doRead(SelectionKey key)

doWrite

protected boolean doWrite(SelectionKey key)

doClose

protected void doClose(SelectionKey key)

send

public void send(SocketChannel channel,
                 byte[] response)

incrementActiveConnections

public void incrementActiveConnections()

decrementActiveConnections

public void decrementActiveConnections()

getActiveConnections

public int getActiveConnections()
Description copied from interface: RequestListenerServiceMBean

Return the number clients that are currently connected.

Specified by:
getActiveConnections in interface RequestListenerServiceMBean
Returns:
int

setDefaultReceiveBufferSize

public void setDefaultReceiveBufferSize(int bytes)
Description copied from interface: RequestListenerServiceMBean

Modify the TCP buffer settings to maximize the performance for the client network.

Specified by:
setDefaultReceiveBufferSize in interface RequestListenerServiceMBean

getDefaultReceiveBufferSize

public int getDefaultReceiveBufferSize()
Specified by:
getDefaultReceiveBufferSize in interface RequestListenerServiceMBean

setDefaultSendBufferSize

public void setDefaultSendBufferSize(int bytes)
Specified by:
setDefaultSendBufferSize in interface RequestListenerServiceMBean

getDefaultSendBufferSize

public int getDefaultSendBufferSize()
Specified by:
getDefaultSendBufferSize in interface RequestListenerServiceMBean

getActiveTransactions

public int getActiveTransactions()
Description copied from interface: RequestListenerServiceMBean

Return the number of transactions that are currently being processed.

Specified by:
getActiveTransactions in interface RequestListenerServiceMBean
Returns:
int

getTotalActivations

public long getTotalActivations()
Description copied from interface: RequestListenerServiceMBean

Return the total number of activation requests processed.

Specified by:
getTotalActivations in interface RequestListenerServiceMBean
Returns:
long

getActivationsPerMinute

public int getActivationsPerMinute()
Description copied from interface: RequestListenerServiceMBean

Returns the number of activation processed per minute from the time statistics were activated.

Specified by:
getActivationsPerMinute in interface RequestListenerServiceMBean
Returns:
int

getElapsedMinutes

protected double getElapsedMinutes(long startedTime)

getNowTime

protected long getNowTime()

getActivationsProcessedInLastMinute

public int getActivationsProcessedInLastMinute(StatisticsCounter statisticType)

incrementActivationCount

public void incrementActivationCount(StatisticsCounter statisticType)

A RequestHandler is able to call back to this RequestListenerService to track what it considers an activation. In general the RequestListenerService knows nothing more than the fact that input is ready for processing. This may be one or more activations, therefore we delegate the responsibility to the RequestHandler.

Parameters:
statistic -

startStatistics

public void startStatistics()
Description copied from interface: RequestListenerServiceMBean

Start recording statistics and reset any existing statistical data.

Specified by:
startStatistics in interface RequestListenerServiceMBean

stopStatistics

public void stopStatistics()
Description copied from interface: RequestListenerServiceMBean

Stop recording statistics and reset any existing statistical data.

Specified by:
stopStatistics in interface RequestListenerServiceMBean

jremote jbase5.2.1

Copyright © 2016 TEMENOS. All Rights Reserved.