Class AsyncNodeClassNioServer
java.lang.Object
java.lang.Thread
org.jppf.nio.NioServer
org.jppf.nio.StatelessNioServer<AsyncNodeClassContext>
org.jppf.server.nio.classloader.node.AsyncNodeClassNioServer
- All Implemented Interfaces:
Runnable
public final class AsyncNodeClassNioServer
extends org.jppf.nio.StatelessNioServer<AsyncNodeClassContext>
The NIO server that handles asynchronous client connections, which can handle multiple jobs concurrently.
- Author:
- Laurent Cohen
-
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
FieldsModifier and TypeFieldDescriptionprotected final Map<String,AsyncNodeClassContext> Mapping of channels to their uuid.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_PRIORITY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(ServerSocketChannel serverSocketChannel, SocketChannel channel, org.jppf.nio.SSLHandler sslHandler, boolean ssl, boolean peer, Object... params) voidaddNodeConnection(String uuid, AsyncNodeClassContext channel) Put the specified uuid / channel pair into the uuid map.voidcloseConnection(AsyncNodeClassContext context) Close the specified channel.voidconnectionFailed(AsyncNodeClassContext channel) Called when the node failed to respond to a heartbeat message.createNioContext(Object... params) getNodeConnection(String uuid) Get a channel from its uuid.org.jppf.classloader.ResourceProviderGet the resource provider for this server.protected voidprotected voidprotected voidvoidClose and remove all connections accepted by this server.org.jppf.classloader.AsyncLocalNodeClassloaderContextremoveNodeConnection(String uuid) Remove the specified uuid entry from the uuid map.Methods inherited from class org.jppf.nio.StatelessNioServer
doOperation, getAllContexts, go, handleRead, handleWrite, 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
-
Field Details
-
nodeConnections
Mapping of channels to their uuid.
-
-
Constructor Details
-
AsyncNodeClassNioServer
- Parameters:
driver- reference to the driver.identifier- the channel identifier for channels handled by this server.useSSL- determines whether an SSLContext should be created for this server.- Throws:
Exception- if any error occurs.
-
-
Method Details
-
initReaderAndWriter
protected void initReaderAndWriter()- Specified by:
initReaderAndWriterin classorg.jppf.nio.StatelessNioServer<AsyncNodeClassContext>
-
handleSelectionException
- Specified by:
handleSelectionExceptionin classorg.jppf.nio.StatelessNioServer<AsyncNodeClassContext>
-
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
-
createNioContext
- Specified by:
createNioContextin classorg.jppf.nio.NioServer
-
closeConnection
Close the specified channel.- Parameters:
context- the channel to close.
-
getNodeConnection
Get a channel from its uuid.- Parameters:
uuid- the uuid key to look up in the the map.- Returns:
- channel the corresponding channel.
-
addNodeConnection
Put the specified uuid / channel pair into the uuid map.- Parameters:
uuid- the uuid key to add to the map.channel- the corresponding channel.
-
removeNodeConnection
Remove the specified uuid entry from the uuid map.- Parameters:
uuid- the uuid key to remove from the map.- Returns:
- channel the corresponding channel.
-
connectionFailed
Called when the node failed to respond to a heartbeat message.- Parameters:
channel- the channel to close.
-
removeAllConnections
public void removeAllConnections()Close and remove all connections accepted by this server.- Overrides:
removeAllConnectionsin classorg.jppf.nio.NioServer- See Also:
-
NioServer.removeAllConnections()
-
getAllNodeConnections
- Returns:
- the list of all current connections.
-
getResourceProvider
public org.jppf.classloader.ResourceProvider getResourceProvider()Get the resource provider for this server.- Returns:
- a ResourceProvider instance.
-
getMessageHandler
- Returns:
- the message handler for this server.
-
initNioHandlers
protected void initNioHandlers()- Overrides:
initNioHandlersin classorg.jppf.nio.StatelessNioServer<AsyncNodeClassContext>
-