Package org.jppf.server.node
Class AbstractCommonNode
java.lang.Object
org.jppf.utils.concurrent.ThreadSynchronization
org.jppf.node.AbstractNode
org.jppf.server.node.AbstractCommonNode
- All Implemented Interfaces:
Runnable,org.jppf.node.Node,NodeInternal
- Direct Known Subclasses:
JPPFNode
This class is used as a container for common methods that cannot be implemented in
AbstractNode.- Author:
- Laurent Cohen
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AbstractClassLoaderManager<?>Manages the class loaders and how they are used.protected org.jppf.JPPFReconnectionNotificationFields inherited from class org.jppf.node.AbstractNode
configuration, helper, hookFactory, jmxEnabled, jmxServer, lifeCycleEventHandler, nodeConnection, nodeIO, serializer, systemInformation, uuidFields inherited from class org.jppf.utils.concurrent.ThreadSynchronization
stopped -
Constructor Summary
ConstructorsConstructorDescriptionAbstractCommonNode(String uuid, org.jppf.utils.TypedProperties configuration, org.jppf.utils.hooks.HookFactory hookFactory) Initialize this node. -
Method Summary
Modifier and TypeMethodDescriptionbooleanCancel the current pending action, if anty.Get the main classloader for the node.Get the service that manages the class loaders and how they are used.getContainer(List<String> uuidPath) Get a reference to the JPPF container associated with an application uuid.org.jppf.execute.async.AsyncExecutionManagerGet the task execution manager for this node.org.jppf.management.JMXServerGet the JMX connector server associated with the node.org.jppf.management.JPPFNodeAdminMBeanGet the administration and monitoring MBean for this node.org.jppf.management.NodePendingActionGet the current pending action, if any.org.jppf.JPPFReconnectionNotificationbooleanbooleanDetermine whether the node is currently processing tasks.booleanbooleanDetermine whether a restart or shutdown was requested.booleanDetermine whether a node shurdown or restart was requested..booleanbooleanDetermine whether the node is suspended, i.e. it is still alive but has stopped taking on new jobs.voidRequest a reset of the class loaders resource caches.resetTaskClassLoader(Object... params) This implementation does nothing.voidSet the main classloader for the node.voidsetExecuting(boolean executing) Specifiy whether the node is currently processing tasks.voidsetNodeAdmin(org.jppf.management.JPPFNodeAdminMBean nodeAdmin) Set the administration and monitoring MBean for this node.booleansetPendingAction(org.jppf.management.NodePendingAction action) Set the current pending action.voidsetReconnectionNotification(org.jppf.JPPFReconnectionNotification reconnectionNotification) voidsetStartedFromMain(boolean startedFromMain) voidsetSuspended(boolean suspended) Set the node's suspended state, i.e. whether it should sto taking on new jobs.protected voidsetupBundleParameters(org.jppf.node.protocol.TaskBundle bundle) Add management parameters to the specified bundle, before sending it back to a server.voidshutdown(boolean restart) Shutdown and eventually restart the node.voidStop the jmx server.voidstopNode()Stop this node and release the resources it is using.Methods inherited from class org.jppf.node.AbstractNode
getConfiguration, getExecutedTaskCount, getHelper, getHookFactory, getJPPFClassLoader, getLifeCycleEventHandler, getManagementInfo, getMasterNodeUuid, getNodeConnection, getNodeIO, getShuttingDown, getSystemInformation, getUuid, isJmxEnabled, isMasterNode, isSlaveNode, setExecutedTaskCount, setJPPFClassLoader, updateSystemInformationMethods inherited from class org.jppf.utils.concurrent.ThreadSynchronization
goToSleep, goToSleep, goToSleep, isStopped, setStopped, wakeUpMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jppf.node.Node
isAndroid, isDotnetCapable, isLocalMethods inherited from interface org.jppf.node.NodeInternal
closeDataChannel, getNodeConfigNotifier, initDataChannel
-
Field Details
-
classLoaderManager
Manages the class loaders and how they are used. -
reconnectionNotification
protected org.jppf.JPPFReconnectionNotification reconnectionNotification
-
-
Constructor Details
-
AbstractCommonNode
public AbstractCommonNode(String uuid, org.jppf.utils.TypedProperties configuration, org.jppf.utils.hooks.HookFactory hookFactory) Initialize this node.- Parameters:
uuid- this node's uuid.configuration- the configuration of this node.hookFactory- used to create and invoke hook instances.
-
-
Method Details
-
setupBundleParameters
protected void setupBundleParameters(org.jppf.node.protocol.TaskBundle bundle) Add management parameters to the specified bundle, before sending it back to a server.- Parameters:
bundle- the bundle to add parameters to.
-
getClassLoader
Get the main classloader for the node. This method performs a lazy initialization of the classloader.- Returns:
- a
ClassLoaderused for loading the classes of the framework.
-
isOffline
public boolean isOffline() -
setClassLoader
Set the main classloader for the node.- Parameters:
cl- the class loader to set.
-
getContainer
Get a reference to the JPPF container associated with an application uuid.- Parameters:
uuidPath- the uuid path containing the key to the container.- Returns:
- a
JPPFContainerinstance. - Throws:
Exception- if an error occurs while getting the container.
-
requestResourceCacheReset
public void requestResourceCacheReset()Request a reset of the class loaders resource caches. This method merely sets a floag, the actual reset will be performed at the next opportunity, when it is safe to do so. -
isShutdownRequested
public boolean isShutdownRequested()Determine whether a node shurdown or restart was requested..- Returns:
trueif a shudown or restart was requested,falseotherwise.
-
isRestart
public boolean isRestart()Determine whether a restart or shutdown was requested.- Returns:
trueif a restart was requested, false if ashutdownwas requested.
-
isExecuting
public boolean isExecuting()Determine whether the node is currently processing tasks.- Returns:
trueif the node is processing tasks,falseotherwise.
-
setExecuting
public void setExecuting(boolean executing) Specifiy whether the node is currently processing tasks.- Parameters:
executing-trueto specify that the node is processing tasks,falseotherwise.
-
isSuspended
public boolean isSuspended()Determine whether the node is suspended, i.e. it is still alive but has stopped taking on new jobs.- Returns:
trueif the node is suspended,falseotherwise.
-
setSuspended
public void setSuspended(boolean suspended) Set the node's suspended state, i.e. whether it should sto taking on new jobs.- Parameters:
suspended-trueto suspend the node,falseotherwise.
-
getClassLoaderManager
Get the service that manages the class loaders and how they are used.- Returns:
- an
AbstractClassLoaderManagerinstance.
-
getExecutionManager
public org.jppf.execute.async.AsyncExecutionManager getExecutionManager()Description copied from interface:NodeInternalGet the task execution manager for this node.- Returns:
- a
ExecutionManagerinstance.
-
resetTaskClassLoader
Description copied from class:AbstractNodeThis implementation does nothing.- Specified by:
resetTaskClassLoaderin interfaceorg.jppf.node.Node- Overrides:
resetTaskClassLoaderin classAbstractNode- Parameters:
params- not used.- Returns:
null.
-
isStartedFromMain
public boolean isStartedFromMain()- Returns:
- whether this node was sdtarted from
NodeRunner.main()(standalone) or not (embedded).
-
setStartedFromMain
public void setStartedFromMain(boolean startedFromMain) - Parameters:
startedFromMain- whether this node was sdtarted fromNodeRunner.main()(standalone) or not (embedded).
-
getJmxServer
Description copied from class:AbstractNodeGet the JMX connector server associated with the node.The default implementation throws a
JPPFUnsupportedOperationException. It is up to concrete implementations to override it.This implementation throws a
JPPFUnsupportedOperationException. It is up to subclasses to implement it.- Specified by:
getJmxServerin interfaceNodeInternal- Overrides:
getJmxServerin classAbstractNode- Returns:
- a JMXServer instance.
- Throws:
Exception- if any error occurs.
-
stopJmxServer
Stop the jmx server.- Throws:
Exception- if any error occurs.
-
stopNode
public void stopNode()Description copied from interface:NodeInternalStop this node and release the resources it is using. -
shutdown
public void shutdown(boolean restart) Shutdown and eventually restart the node.- Parameters:
restart- determines whether this node should be restarted by the node launcher.
-
getNodeAdmin
public org.jppf.management.JPPFNodeAdminMBean getNodeAdmin()Get the administration and monitoring MBean for this node.- Returns:
- a
JPPFNodeAdminMBeaninstance.
-
setNodeAdmin
public void setNodeAdmin(org.jppf.management.JPPFNodeAdminMBean nodeAdmin) Set the administration and monitoring MBean for this node.- Parameters:
nodeAdmin- aJPPFNodeAdminMBeanm instance.
-
getSerializationExecutor
- Returns:
- the executor for serialization and deserialization of the tasks.
-
getReconnectionNotification
public org.jppf.JPPFReconnectionNotification getReconnectionNotification()- Returns:
- the reconnection notification.
-
setReconnectionNotification
public void setReconnectionNotification(org.jppf.JPPFReconnectionNotification reconnectionNotification) - Parameters:
reconnectionNotification- the reconnection notification.
-
getPendingAction
public org.jppf.management.NodePendingAction getPendingAction()Get the current pending action, if any.- Returns:
- the current pending action, or
nullif there isn't one.
-
setPendingAction
public boolean setPendingAction(org.jppf.management.NodePendingAction action) Set the current pending action.- Parameters:
action- the pending aciton to set.- Returns:
trueif the new pending action was set successfully,falseotherwise (if a pending action was already set).
-
cancelPendingAction
public boolean cancelPendingAction()Cancel the current pending action, if anty.- Returns:
trueif the pending action was successfully cncelled,falseotherwise.
-
hasPendingAction
public boolean hasPendingAction()- Returns:
- whether a deferred action was requested.
-