Class ChannelWrapper

java.lang.Object
org.jppf.client.balancer.ChannelWrapper
All Implemented Interfaces:
AutoCloseable, org.jppf.execute.ExecutorChannel<ClientTaskBundle>
Direct Known Subclasses:
AbstractChannelWrapperRemote, ChannelWrapperLocal

public abstract class ChannelWrapper extends Object implements org.jppf.execute.ExecutorChannel<ClientTaskBundle>
Context associated with a channel serving state and tasks submission.
Author:
Laurent Cohen, Martin JANDA
  • Field Details

  • Constructor Details

    • ChannelWrapper

      protected ChannelWrapper()
      Default constructor.
  • Method Details

    • getStatus

      public abstract JPPFClientConnectionStatus getStatus()
      Get the status of this connection.
      Returns:
      a JPPFClientConnectionStatus enumerated value.
    • getExecutionStatus

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

      public abstract void addClientConnectionStatusListener(ClientConnectionStatusListener listener)
      Add a connection status listener to this connection's list of listeners.
      Parameters:
      listener - the listener to add to the list.
    • removeClientConnectionStatusListener

      public abstract void removeClientConnectionStatusListener(ClientConnectionStatusListener listener)
      Remove a connection status listener from this connection's list of listeners.
      Parameters:
      listener - the listener to remove from the list.
    • getBundler

      public org.jppf.load.balancer.Bundler<?> getBundler()
      Get the bundler used to schedule tasks for the corresponding node.
      Specified by:
      getBundler in interface org.jppf.execute.ExecutorChannel<ClientTaskBundle>
      Returns:
      a Bundler instance.
    • 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<ClientTaskBundle>
      Parameters:
      factory - the load balancer factory.
      jppfContext - execution context.
      Returns:
      true if the bundler is up to date, false if it wasn't and has been updated.
    • getSystemInformation

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

      public void setSystemInformation(org.jppf.management.JPPFSystemInformation systemInfo)
      Set the system information.
      Parameters:
      systemInfo - a JPPFSystemInformation instance.
    • getManagementInfo

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

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

      public void close()
      Specified by:
      close in interface AutoCloseable
    • getMonitor

      public Object getMonitor()
      Specified by:
      getMonitor in interface org.jppf.execute.ExecutorChannel<ClientTaskBundle>
    • addExecutionStatusListener

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

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

      protected 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.
    • isActive

      public boolean isActive()
      Specified by:
      isActive in interface org.jppf.execute.ExecutorChannel<ClientTaskBundle>
    • getPriority

      public int getPriority()
      The priority assigned to this channel.
      Returns:
      the priority as an int value.
    • cancel

      public abstract boolean cancel(ClientTaskBundle bundle)
      Cancel the currently executing job, if any.
      Parameters:
      bundle - the bundle to cancel.
      Returns:
      true if the job is effectively cancelled, false otherwise.
    • isResetting

      public boolean isResetting()
      Determine whether the client is resetting.
      Returns:
      true if the client is resetting, false otherwise.
    • setResetting

      public void setResetting(boolean resetting)
      Specify whether the client is resetting.
      Parameters:
      resetting - true if the client is resetting, false otherwise.
    • initChannelID

      public void initChannelID()
      Init the channel id for load-balancer persistence.
    • getCurrentNbJobs

      public int getCurrentNbJobs()
      Specified by:
      getCurrentNbJobs in interface org.jppf.execute.ExecutorChannel<ClientTaskBundle>
    • getOldStatus

      public JPPFClientConnectionStatus getOldStatus()
      Returns:
      the previous status, if any.
    • setOldStatus

      public void setOldStatus(JPPFClientConnectionStatus oldStatus)
      Parameters:
      oldStatus - the previous status, if any.