Package org.jppf.jmxremote.nio
Class JMXNioServer
java.lang.Object
java.lang.Thread
org.jppf.nio.NioServer
org.jppf.nio.StatelessNioServer<JMXContext>
org.jppf.jmxremote.nio.JMXNioServer
- All Implemented Interfaces:
Serializable,Runnable,JMXNioServerMBean
public final class JMXNioServer
extends org.jppf.nio.StatelessNioServer<JMXContext>
implements JMXNioServerMBean
The NIO server that handles client-side and server-side JMX connections.
- Author:
- Laurent Cohen
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.jppf.nio.StatelessNioServer
org.jppf.nio.StatelessNioServer.ContextAction<C extends org.jppf.nio.AbstractNioContext>, org.jppf.nio.StatelessNioServer.ContextFilter<C extends org.jppf.nio.AbstractNioContext>, org.jppf.nio.StatelessNioServer.KeysetHandler<C extends org.jppf.nio.AbstractNioContext>Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
Fields inherited from class org.jppf.nio.StatelessNioServer
acceptHandler, messageReader, messageWriter, readHandler, writeHandlerFields inherited from class org.jppf.nio.NioServer
attachment, configuration, identifier, requestShutdown, selecting, selector, selectTimeout, sslContext, sslHelper, stopped, sync, wakeUpActionFields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITYFields inherited from interface org.jppf.jmxremote.nio.JMXNioServerMBean
MBEAN_NAME -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(ServerSocketChannel serverSocketChannel, SocketChannel channel, org.jppf.nio.SSLHandler sslHandler, boolean ssl, boolean peer, Object... params) voidAdd a listener to the connection status events.voidcloseConnection(ChannelsPair pair, Exception exception, boolean clientRequestedClose) Close a connection.createChannelsPair(Map<String, ?> env, String connectionID, int port, SocketChannel channel, boolean ssl, boolean client) Create a pair of channels that can be used concurrently for the specified socket channel.createNioContext(Object... params) getMessageHandlers(Collection<String> connectionIDs) Get a list of message handlers for the specified connection ids.intGet the maximum number of pending notifications in the queue of a JMX connection.org.jppf.utils.stats.JPPFStatisticsgetStats()protected voidhandleRead(SelectionKey key) protected voidprotected voidhandleWrite(SelectionKey key) protected voidprotected voidvoidvoidremoveAllConnections(int port) Remove and close all connections for the server with the specified port.voidRemove a listener from the connection status events.stats()Provide some statistics about this sserver, for debug purposes.Methods inherited from class org.jppf.nio.StatelessNioServer
doOperation, getAllContexts, go, init, isKeyValid, performContextAction, registerChannel, run, toString, toString, updateInterestOps, updateInterestOpsNoWakeupMethods inherited from class org.jppf.nio.NioServer
addServer, configurePeerSSL, configureSSLEngine, createSSLContext, doAccept, end, externalStopCondition, getConfiguration, getIdentifier, getSelector, isStopped, removeServer, setConfiguration, shutdown, wakeUpSelectorIfNeededMethods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, yield
-
Method Details
-
handleRead
- Overrides:
handleReadin classorg.jppf.nio.StatelessNioServer<JMXContext>- Throws:
Exception
-
handleWrite
- Overrides:
handleWritein classorg.jppf.nio.StatelessNioServer<JMXContext>- Throws:
Exception
-
handleSelectionException
- Specified by:
handleSelectionExceptionin classorg.jppf.nio.StatelessNioServer<JMXContext>
-
accept
public void accept(ServerSocketChannel serverSocketChannel, SocketChannel channel, org.jppf.nio.SSLHandler sslHandler, boolean ssl, boolean peer, Object... params) - Specified by:
acceptin classorg.jppf.nio.NioServer
-
createChannelsPair
public ChannelsPair createChannelsPair(Map<String, ?> env, String connectionID, int port, SocketChannel channel, boolean ssl, boolean client) throws ExceptionCreate a pair of channels that can be used concurrently for the specified socket channel.- Parameters:
env- environment parameters to use for connector properties.connectionID- the server-sde connection ID.port- the server port that accepted the connection.channel- the associated socket channel.ssl- whether the connection is secure.client- whether the created channels are client-side (true) or server-side (false).- Returns:
- a
ChannelsPairinstance. - Throws:
Exception- if any error occurs.
-
createNioContext
- Specified by:
createNioContextin classorg.jppf.nio.NioServer
-
closeConnection
Close a connection.- Parameters:
pair- .exception- optional exception that caused the connection close.clientRequestedClose- .- Throws:
Exception- if any error occurs.
-
removeAllConnections
public void removeAllConnections()- Overrides:
removeAllConnectionsin classorg.jppf.nio.NioServer
-
removeAllConnections
public void removeAllConnections(int port) Remove and close all connections for the server with the specified port.- Parameters:
port- the port to which the connection was established.
-
addConnectionStatusListener
Add a listener to the connection status events.- Parameters:
listener- the listener to add.
-
removeConnectionStatusListener
Remove a listener from the connection status events.- Parameters:
listener- the listener to remove.
-
getMessageHandlers
Get a list of message handlers for the specified connection ids.- Parameters:
connectionIDs- the ids of the connections for which to get a message handler.- Returns:
- a map of connection ids to their corresponding
JMXMessageHandler, possibly empty.
-
stats
Description copied from interface:JMXNioServerMBeanProvide some statistics about this sserver, for debug purposes.- Specified by:
statsin interfaceJMXNioServerMBean- Returns:
- a map of statistics entries.
-
getStats
public org.jppf.utils.stats.JPPFStatistics getStats()- Returns:
- the statsistics to update, if any.
-
initReaderAndWriter
protected void initReaderAndWriter()- Specified by:
initReaderAndWriterin classorg.jppf.nio.StatelessNioServer<JMXContext>
-
initNioHandlers
protected void initNioHandlers()- Overrides:
initNioHandlersin classorg.jppf.nio.StatelessNioServer<JMXContext>
-
getPeakPendingMessages
public int getPeakPendingMessages()Description copied from interface:JMXNioServerMBeanGet the maximum number of pending notifications in the queue of a JMX connection.- Specified by:
getPeakPendingMessagesin interfaceJMXNioServerMBean- Returns:
- the peak queue size as an int.
-