Class AsyncNodeNioServer
java.lang.Object
java.lang.Thread
org.jppf.nio.NioServer
org.jppf.nio.StatelessNioServer<AsyncNodeContext>
org.jppf.server.nio.nodeserver.async.AsyncNodeNioServer
- All Implemented Interfaces:
Runnable,NodeConnectionCompletionListener
public final class AsyncNodeNioServer
extends org.jppf.nio.StatelessNioServer<AsyncNodeContext>
implements NodeConnectionCompletionListener
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
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) activateNode(String uuid, boolean activate) Remove the specified connection wrapper from the list of connections handled by this manager.voidcloseConnection(AsyncNodeContext context) Close the specified channel.voidconnectionFailed(BaseNodeContext context) Called when the node failed to respond to a heartbeat message.createNioContext(Object... params) Get all the node connections handled by this server.org.jppf.load.balancer.spi.JPPFBundlerFactoryGet the factory object used to create bundler instances.org.jppf.load.balancer.persistence.LoadBalancerPersistenceManagergetConnection(String uuid) Get the connection wrapper for the specified uuid.org.jppf.scheduling.JPPFScheduleHandlerGet the handler for the expiration of dispatched bundles.Get the task bundle sent to a newly connected node, so that it can check whether it is up to date, without having to wait for an actual request to be sent.Get the task that dispatches queued jobs to available nodes.org.jppf.load.balancer.JPPFContextGet the corresponding node's context information.Get the object that handles reservation of nodes to jobs.Get the object that holds the node bundles waiting for a node to reconnect and send the rsults.Get the peer handler.protected voidprotected voidprotected voidvoidnodeConnected(BaseNodeContext context) Called when a channel is connected.voidMethods 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
-
Constructor Details
-
AsyncNodeNioServer
- 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<AsyncNodeContext>
-
handleSelectionException
- Specified by:
handleSelectionExceptionin classorg.jppf.nio.StatelessNioServer<AsyncNodeContext>
-
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.
-
removeAllConnections
public void removeAllConnections()- Overrides:
removeAllConnectionsin classorg.jppf.nio.NioServer
-
getMessageHandler
- Returns:
- the message handler for this server.
-
initNioHandlers
protected void initNioHandlers()- Overrides:
initNioHandlersin classorg.jppf.nio.StatelessNioServer<AsyncNodeContext>
-
getDriver
- Returns:
- a reference to the driver.
-
getJPPFContext
public org.jppf.load.balancer.JPPFContext getJPPFContext()Get the corresponding node's context information.- Returns:
- a
JPPFContextinstance.
-
getOfflineNodeHandler
Get the object that holds the node bundles waiting for a node to reconnect and send the rsults.- Returns:
- a
OfflineNodeHandlerinstance.
-
getDispatchExpirationHandler
public org.jppf.scheduling.JPPFScheduleHandler getDispatchExpirationHandler()Get the handler for the expiration of dispatched bundles.- Returns:
- a
JPPFScheduleHandlerinstance.
-
getPeerHandler
Get the peer handler.- Returns:
- a
AsyncPeerAttributesHandlerinstance.
-
getNodeReservationHandler
Get the object that handles reservation of nodes to jobs.- Returns:
- a
AsyncNodeReservationHandlerinstance.
-
getJobScheduler
Get the task that dispatches queued jobs to available nodes.- Returns:
- a
AsyncJobSchedulerobject.
-
getBundlerHandler
public org.jppf.load.balancer.persistence.LoadBalancerPersistenceManager getBundlerHandler()- Returns:
- the handler for the persistence fo the state of the load-balancers.
-
getBundlerFactory
public org.jppf.load.balancer.spi.JPPFBundlerFactory getBundlerFactory()Get the factory object used to create bundler instances.- Returns:
- an instance of
JPPFBundlerFactory.
-
getAllChannels
Get all the node connections handled by this server.- Returns:
- a list of
BaseNodeContextinstances.
-
getAllChannelsAsSet
- Returns:
- a set of
BaseNodeContextinstances.
-
connectionFailed
Called when the node failed to respond to a heartbeat message.- Parameters:
context- the channel to close.
-
getConnection
Get the connection wrapper for the specified uuid.- Parameters:
uuid- the id of the connection to get.- Returns:
- the context of the connect that was found, or
nullif the channel was not found.
-
nodeConnected
Description copied from interface:NodeConnectionCompletionListenerCalled when a channel is connected.- Specified by:
nodeConnectedin interfaceNodeConnectionCompletionListener- Parameters:
context- the connected channel.
-
getHandshakeBundle
Get the task bundle sent to a newly connected node, so that it can check whether it is up to date, without having to wait for an actual request to be sent.- Returns:
- a
ServerJobinstance, with no task in it.
-
activateNode
Remove the specified connection wrapper from the list of connections handled by this manager.- Parameters:
uuid- the id of the node to activate or deactivate.activate-trueto activate the node,falseto deactivate it.- Returns:
- the context of th channel that was removed, or
nullif the channel was not found.
-