Class BaseNodeContext

java.lang.Object
org.jppf.nio.AbstractNioContext
org.jppf.server.nio.nodeserver.BaseNodeContext
All Implemented Interfaces:
AutoCloseable, org.jppf.execute.ExecutorChannel<ServerTaskBundleNode>, org.jppf.nio.CloseableContext, org.jppf.nio.NioChannelHandler, org.jppf.nio.NioContext
Direct Known Subclasses:
AsyncNodeContext

public abstract class BaseNodeContext extends org.jppf.nio.AbstractNioContext implements org.jppf.execute.ExecutorChannel<ServerTaskBundleNode>
Author:
Laurent Cohen
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final JPPFDriver
    Reference to the JPPF driver.
    protected final AsyncNodeNioServer
    The server that handles this context.

    Fields inherited from class org.jppf.nio.AbstractNioContext

    closed, connectionUuid, enabled, inSnapshot, local, onCloseAction, outSnapshot, peer, readByteCount, readMessage, socketChannel, ssl, sslHandler, uuid, writeByteCount, writeMessage
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addExecutionStatusListener(org.jppf.execute.ExecutorChannelStatusListener listener)
     
    boolean
    cancelJob(String jobId, boolean requeue)
    Cancel the job with the specified id.
    org.jppf.load.balancer.Bundler<?>
    checkBundler(org.jppf.load.balancer.spi.JPPFBundlerFactory factory, org.jppf.load.balancer.JPPFContext jppfContext)
    Check whether the bundler held by this context is up to date by comparison with the specified bundler.
    If it is not, then it is replaced with a copy of the specified bundler, with a timestamp taken at creation time.
    void
    fireExecutionStatusChanged(org.jppf.execute.ExecutorStatus oldValue, org.jppf.execute.ExecutorStatus newValue)
    Notify all listeners that the execution status of this channel has changed.
    org.jppf.load.balancer.Bundler<?>
     
     
     
    org.jppf.execute.ExecutorStatus
     
     
    org.jppf.management.JMXNodeConnectionWrapper
     
    org.jppf.management.JPPFManagementInfo
     
    org.jppf.utils.Pair<String,String>
     
    org.jppf.management.JMXDriverConnectionWrapper
     
    int
     
     
    org.jppf.management.JPPFSystemInformation
     
    void
    Initialize the jmx connection using the specified jmx id.
    boolean
     
    boolean
     
    void
    removeExecutionStatusListener(org.jppf.execute.ExecutorChannelStatusListener listener)
     
    void
    setActive(boolean active)
     
    void
    setBundler(org.jppf.load.balancer.Bundler<?> bundler)
     
    void
    setBundlerAlgorithm(String bundlerAlgorithm)
     
    void
    setExecutionStatus(org.jppf.execute.ExecutorStatus newStatus)
    Set the execution status for the node.
    void
    setJmxConnection(org.jppf.management.JMXNodeConnectionWrapper jmxConnection)
    Set the connection to the node's JMX server.
    void
    setManagementInfo(org.jppf.management.JPPFManagementInfo managementInfo)
    Set the management information for the node.
    void
    setNodeIdentifier(org.jppf.utils.Pair<String,String> nodeIdentifier)
     
    void
    setNodeInfo(org.jppf.management.JPPFSystemInformation systemInfo, boolean update)
    Set the node system information.
    void
    setOffline(boolean offline)
    Specify whether the node works in offline mode.
    void
    setPeerJmxConnection(org.jppf.management.JMXDriverConnectionWrapper peerJmxConnection)
    Set the connection to the peer driver's JMX server.
    void
    setReservationScore(int reservationScore)
     
    void
     

    Methods inherited from class org.jppf.nio.AbstractNioContext

    getConnectionUuid, getInterestOps, getReadMessage, getSelectionKey, getSocketChannel, getSSLHandler, getUuid, getWriteMessage, isClosed, isEnabled, isLocal, isPeer, isSecure, isSsl, nextMessageToSend, onClose, setClosed, setConnectionUuid, setEnabled, setInterestOps, setLocal, setOnCloseAction, setPeer, setReadMessage, setSelectionKey, setSsl, setSSLHandler, setUuid, setWriteMessage, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface java.lang.AutoCloseable

    close

    Methods inherited from interface org.jppf.execute.ExecutorChannel

    getConnectionUuid, getCurrentNbJobs, getMaxJobs, getMonitor, getUuid, isAsynchronous, isLocal, submit

    Methods inherited from interface org.jppf.nio.NioContext

    handleException, readMessage, writeMessage
  • Field Details

    • driver

      protected final JPPFDriver driver
      Reference to the JPPF driver.
    • server

      protected final AsyncNodeNioServer server
      The server that handles this context.
  • Constructor Details

    • BaseNodeContext

      public BaseNodeContext(AsyncNodeNioServer server)
      Parameters:
      server - .
  • Method Details

    • getBundler

      public org.jppf.load.balancer.Bundler<?> getBundler()
      Specified by:
      getBundler in interface org.jppf.execute.ExecutorChannel<ServerTaskBundleNode>
    • setBundler

      public void setBundler(org.jppf.load.balancer.Bundler<?> bundler)
      Parameters:
      bundler - the bundler used to schedule tasks for the corresponding node.
    • checkBundler

      public org.jppf.load.balancer.Bundler<?> checkBundler(org.jppf.load.balancer.spi.JPPFBundlerFactory factory, org.jppf.load.balancer.JPPFContext jppfContext)
      Check whether the bundler held by this context is up to date by comparison with the specified bundler.
      If it is not, then it is replaced with a copy of the specified bundler, with a timestamp taken at creation time.
      Specified by:
      checkBundler in interface org.jppf.execute.ExecutorChannel<ServerTaskBundleNode>
      Parameters:
      factory - the load-balancer factory.
      jppfContext - execution context.
      Returns:
      the (possibly new) bundle for this executor channel.
    • getSystemInformation

      public org.jppf.management.JPPFSystemInformation getSystemInformation()
      Specified by:
      getSystemInformation in interface org.jppf.execute.ExecutorChannel<ServerTaskBundleNode>
    • setNodeInfo

      public void setNodeInfo(org.jppf.management.JPPFSystemInformation systemInfo, boolean update)
      Set the node system information.
      Parameters:
      systemInfo - a JPPFSystemInformation instance.
      update - a flag indicates whether update system information in management information.
    • getManagementInfo

      public org.jppf.management.JPPFManagementInfo getManagementInfo()
      Specified by:
      getManagementInfo in interface org.jppf.execute.ExecutorChannel<ServerTaskBundleNode>
    • setManagementInfo

      public void setManagementInfo(org.jppf.management.JPPFManagementInfo managementInfo)
      Set the management information for the node.
      Parameters:
      managementInfo - a JPPFManagementInfo instance.
    • getJmxConnection

      public org.jppf.management.JMXNodeConnectionWrapper getJmxConnection()
      Returns:
      the connection to the node's JMX server.
    • setJmxConnection

      public void setJmxConnection(org.jppf.management.JMXNodeConnectionWrapper jmxConnection)
      Set the connection to the node's JMX server.
      Parameters:
      jmxConnection - a JMXNodeConnectionWrapper instance.
    • getPeerJmxConnection

      public org.jppf.management.JMXDriverConnectionWrapper getPeerJmxConnection()
      Returns:
      the connection to the perr driver's JMX server.
    • setPeerJmxConnection

      public void setPeerJmxConnection(org.jppf.management.JMXDriverConnectionWrapper peerJmxConnection)
      Set the connection to the peer driver's JMX server.
      Parameters:
      peerJmxConnection - a JMXDriverConnectionWrapper instance.
    • initializeJmxConnection

      public void initializeJmxConnection()
      Initialize the jmx connection using the specified jmx id.
    • getExecutionStatus

      public org.jppf.execute.ExecutorStatus getExecutionStatus()
      Specified by:
      getExecutionStatus in interface org.jppf.execute.ExecutorChannel<ServerTaskBundleNode>
    • setExecutionStatus

      public void setExecutionStatus(org.jppf.execute.ExecutorStatus newStatus)
      Set the execution status for the node.
      Parameters:
      newStatus - the execution status to set.
    • getReservationTansition

      public NodeReservationHandler.Transition getReservationTansition()
      Returns:
      whether to remove any job reservation for this node.
    • setReservationTansition

      public void setReservationTansition(NodeReservationHandler.Transition reservationTansition)
      Parameters:
      reservationTansition - whether to remove any job reservation for this node.
    • getReservationScore

      public int getReservationScore()
      Returns:
      the latest computed score for a given desired configuration.
    • setReservationScore

      public void setReservationScore(int reservationScore)
      Parameters:
      reservationScore - the latest computed score for a given desired configuration.
    • getNodeIdentifier

      public org.jppf.utils.Pair<String,String> getNodeIdentifier()
      Returns:
      the unique node identfier reusable over node restarts.
    • setNodeIdentifier

      public void setNodeIdentifier(org.jppf.utils.Pair<String,String> nodeIdentifier)
      Parameters:
      nodeIdentifier - the unique node identfier reusable over node restarts.
    • getBundlerAlgorithm

      public String getBundlerAlgorithm()
      Returns:
      the algorithm name for the bundler.
    • setBundlerAlgorithm

      public void setBundlerAlgorithm(String bundlerAlgorithm)
      Parameters:
      bundlerAlgorithm - the algorithm name for the bundler.
    • isActive

      public boolean isActive()
      Specified by:
      isActive in interface org.jppf.execute.ExecutorChannel<ServerTaskBundleNode>
      Returns:
      whether the node is active.
    • setActive

      public void setActive(boolean active)
      Parameters:
      active - whether the node is active.
    • addExecutionStatusListener

      public void addExecutionStatusListener(org.jppf.execute.ExecutorChannelStatusListener listener)
      Specified by:
      addExecutionStatusListener in interface org.jppf.execute.ExecutorChannel<ServerTaskBundleNode>
    • removeExecutionStatusListener

      public void removeExecutionStatusListener(org.jppf.execute.ExecutorChannelStatusListener listener)
      Specified by:
      removeExecutionStatusListener in interface org.jppf.execute.ExecutorChannel<ServerTaskBundleNode>
    • fireExecutionStatusChanged

      public void fireExecutionStatusChanged(org.jppf.execute.ExecutorStatus oldValue, org.jppf.execute.ExecutorStatus newValue)
      Notify all listeners that the execution status of this channel has changed.
      Parameters:
      oldValue - the channel execution status before the change.
      newValue - the channel execution status after the change.
    • isOffline

      public boolean isOffline()
      Returns:
      whether the node works in offline mode.
    • setOffline

      public void setOffline(boolean offline)
      Specify whether the node works in offline mode.
      Parameters:
      offline - true if the node is in offline mode, false otherwise.
    • getDriver

      public JPPFDriver getDriver()
      Returns:
      a reference to the JPPF driver.
    • getIdle

      public AtomicBoolean getIdle()
      Returns:
      whether the node is idle or not.
    • cancelJob

      public boolean cancelJob(String jobId, boolean requeue) throws Exception
      Cancel the job with the specified id.
      Parameters:
      jobId - the id of the job to cancel.
      requeue - true if the job should be requeued on the server side, false otherwise.
      Returns:
      a true when cancel was successful false otherwise.
      Throws:
      Exception - if any error occurs.