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

public abstract class AbstractCommonNode extends AbstractNode
This class is used as a container for common methods that cannot be implemented in AbstractNode.
Author:
Laurent Cohen
  • Field Details

    • classLoaderManager

      protected AbstractClassLoaderManager<?> 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

      public AbstractJPPFClassLoader getClassLoader()
      Get the main classloader for the node. This method performs a lazy initialization of the classloader.
      Returns:
      a ClassLoader used for loading the classes of the framework.
    • isOffline

      public boolean isOffline()
    • setClassLoader

      public void setClassLoader(AbstractJPPFClassLoader cl)
      Set the main classloader for the node.
      Parameters:
      cl - the class loader to set.
    • getContainer

      public JPPFContainer getContainer(List<String> uuidPath) throws Exception
      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 JPPFContainer instance.
      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:
      true if a shudown or restart was requested, false otherwise.
    • isRestart

      public boolean isRestart()
      Determine whether a restart or shutdown was requested.
      Returns:
      true if a restart was requested, false if a shutdown was requested.
    • isExecuting

      public boolean isExecuting()
      Determine whether the node is currently processing tasks.
      Returns:
      true if the node is processing tasks, false otherwise.
    • setExecuting

      public void setExecuting(boolean executing)
      Specifiy whether the node is currently processing tasks.
      Parameters:
      executing - true to specify that the node is processing tasks, false otherwise.
    • isSuspended

      public boolean isSuspended()
      Determine whether the node is suspended, i.e. it is still alive but has stopped taking on new jobs.
      Returns:
      true if the node is suspended, false otherwise.
    • setSuspended

      public void setSuspended(boolean suspended)
      Set the node's suspended state, i.e. whether it should sto taking on new jobs.
      Parameters:
      suspended - true to suspend the node, false otherwise.
    • getClassLoaderManager

      public AbstractClassLoaderManager<?> getClassLoaderManager()
      Get the service that manages the class loaders and how they are used.
      Returns:
      an AbstractClassLoaderManager instance.
    • getExecutionManager

      public org.jppf.execute.async.AsyncExecutionManager getExecutionManager()
      Description copied from interface: NodeInternal
      Get the task execution manager for this node.
      Returns:
      a ExecutionManager instance.
    • resetTaskClassLoader

      public AbstractJPPFClassLoader resetTaskClassLoader(Object... params)
      Description copied from class: AbstractNode
      This implementation does nothing.
      Specified by:
      resetTaskClassLoader in interface org.jppf.node.Node
      Overrides:
      resetTaskClassLoader in class AbstractNode
      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 from NodeRunner.main() (standalone) or not (embedded).
    • getJmxServer

      public org.jppf.management.JMXServer getJmxServer() throws Exception
      Description copied from class: AbstractNode
      Get 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:
      getJmxServer in interface NodeInternal
      Overrides:
      getJmxServer in class AbstractNode
      Returns:
      a JMXServer instance.
      Throws:
      Exception - if any error occurs.
    • stopJmxServer

      public void stopJmxServer() throws Exception
      Stop the jmx server.
      Throws:
      Exception - if any error occurs.
    • stopNode

      public void stopNode()
      Description copied from interface: NodeInternal
      Stop 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 JPPFNodeAdminMBean instance.
    • setNodeAdmin

      public void setNodeAdmin(org.jppf.management.JPPFNodeAdminMBean nodeAdmin)
      Set the administration and monitoring MBean for this node.
      Parameters:
      nodeAdmin - a JPPFNodeAdminMBeanm instance.
    • getSerializationExecutor

      public ExecutorService 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 null if 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:
      true if the new pending action was set successfully, false otherwise (if a pending action was already set).
    • cancelPendingAction

      public boolean cancelPendingAction()
      Cancel the current pending action, if anty.
      Returns:
      true if the pending action was successfully cncelled, false otherwise.
    • hasPendingAction

      public boolean hasPendingAction()
      Returns:
      whether a deferred action was requested.