Package org.jppf.server.nio.nodeserver
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
FieldsModifier and TypeFieldDescriptionprotected final JPPFDriverReference to the JPPF driver.protected final AsyncNodeNioServerThe 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 -
Method Summary
Modifier and TypeMethodDescriptionvoidaddExecutionStatusListener(org.jppf.execute.ExecutorChannelStatusListener listener) booleanCancel 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.voidfireExecutionStatusChanged(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.ExecutorStatusgetIdle()org.jppf.management.JMXNodeConnectionWrapperorg.jppf.management.JPPFManagementInfoorg.jppf.management.JMXDriverConnectionWrapperintorg.jppf.management.JPPFSystemInformationvoidInitialize the jmx connection using the specified jmx id.booleanisActive()booleanvoidremoveExecutionStatusListener(org.jppf.execute.ExecutorChannelStatusListener listener) voidsetActive(boolean active) voidsetBundler(org.jppf.load.balancer.Bundler<?> bundler) voidsetBundlerAlgorithm(String bundlerAlgorithm) voidsetExecutionStatus(org.jppf.execute.ExecutorStatus newStatus) Set the execution status for the node.voidsetJmxConnection(org.jppf.management.JMXNodeConnectionWrapper jmxConnection) Set the connection to the node's JMX server.voidsetManagementInfo(org.jppf.management.JPPFManagementInfo managementInfo) Set the management information for the node.voidsetNodeIdentifier(org.jppf.utils.Pair<String, String> nodeIdentifier) voidsetNodeInfo(org.jppf.management.JPPFSystemInformation systemInfo, boolean update) Set the node system information.voidsetOffline(boolean offline) Specify whether the node works in offline mode.voidsetPeerJmxConnection(org.jppf.management.JMXDriverConnectionWrapper peerJmxConnection) Set the connection to the peer driver's JMX server.voidsetReservationScore(int reservationScore) voidsetReservationTansition(NodeReservationHandler.Transition reservationTansition) 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, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.AutoCloseable
closeMethods inherited from interface org.jppf.execute.ExecutorChannel
getConnectionUuid, getCurrentNbJobs, getMaxJobs, getMonitor, getUuid, isAsynchronous, isLocal, submitMethods inherited from interface org.jppf.nio.NioContext
handleException, readMessage, writeMessage
-
Field Details
-
driver
Reference to the JPPF driver. -
server
The server that handles this context.
-
-
Constructor Details
-
BaseNodeContext
- Parameters:
server- .
-
-
Method Details
-
getBundler
public org.jppf.load.balancer.Bundler<?> getBundler()- Specified by:
getBundlerin interfaceorg.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:
checkBundlerin interfaceorg.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:
getSystemInformationin interfaceorg.jppf.execute.ExecutorChannel<ServerTaskBundleNode>
-
setNodeInfo
public void setNodeInfo(org.jppf.management.JPPFSystemInformation systemInfo, boolean update) Set the node system information.- Parameters:
systemInfo- aJPPFSystemInformationinstance.update- a flag indicates whether update system information in management information.
-
getManagementInfo
public org.jppf.management.JPPFManagementInfo getManagementInfo()- Specified by:
getManagementInfoin interfaceorg.jppf.execute.ExecutorChannel<ServerTaskBundleNode>
-
setManagementInfo
public void setManagementInfo(org.jppf.management.JPPFManagementInfo managementInfo) Set the management information for the node.- Parameters:
managementInfo- aJPPFManagementInfoinstance.
-
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- aJMXNodeConnectionWrapperinstance.
-
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- aJMXDriverConnectionWrapperinstance.
-
initializeJmxConnection
public void initializeJmxConnection()Initialize the jmx connection using the specified jmx id. -
getExecutionStatus
public org.jppf.execute.ExecutorStatus getExecutionStatus()- Specified by:
getExecutionStatusin interfaceorg.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
- Returns:
- whether to remove any job reservation for this node.
-
setReservationTansition
- 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
- Returns:
- the unique node identfier reusable over node restarts.
-
setNodeIdentifier
- Parameters:
nodeIdentifier- the unique node identfier reusable over node restarts.
-
getBundlerAlgorithm
- Returns:
- the algorithm name for the bundler.
-
setBundlerAlgorithm
- Parameters:
bundlerAlgorithm- the algorithm name for the bundler.
-
isActive
public boolean isActive()- Specified by:
isActivein interfaceorg.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:
addExecutionStatusListenerin interfaceorg.jppf.execute.ExecutorChannel<ServerTaskBundleNode>
-
removeExecutionStatusListener
public void removeExecutionStatusListener(org.jppf.execute.ExecutorChannelStatusListener listener) - Specified by:
removeExecutionStatusListenerin interfaceorg.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-trueif the node is in offline mode,falseotherwise.
-
getDriver
- Returns:
- a reference to the JPPF driver.
-
getIdle
- Returns:
- whether the node is idle or not.
-
cancelJob
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
truewhen cancel was successfulfalseotherwise. - Throws:
Exception- if any error occurs.
-