Package org.jppf.client.balancer
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 Summary
FieldsModifier and TypeFieldDescriptionprotected JPPFClientConnectionStatusThe previous status, if any. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidAdd a connection status listener to this connection's list of listeners.voidaddExecutionStatusListener(org.jppf.execute.ExecutorChannelStatusListener listener) abstract booleancancel(ClientTaskBundle bundle) Cancel the currently executing job, if any.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.voidclose()protected 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<?>Get the bundler used to schedule tasks for the corresponding node.intorg.jppf.execute.ExecutorStatusorg.jppf.management.JPPFManagementInfointThe priority assigned to this channel.abstract JPPFClientConnectionStatusGet the status of this connection.org.jppf.management.JPPFSystemInformationvoidInit the channel id for load-balancer persistence.booleanisActive()booleanDetermine whether the client is resetting.abstract voidRemove a connection status listener from this connection's list of listeners.voidremoveExecutionStatusListener(org.jppf.execute.ExecutorChannelStatusListener listener) voidsetManagementInfo(org.jppf.management.JPPFManagementInfo managementInfo) Set the management information.voidsetOldStatus(JPPFClientConnectionStatus oldStatus) voidsetResetting(boolean resetting) Specify whether the client is resetting.voidsetSystemInformation(org.jppf.management.JPPFSystemInformation systemInfo) Set the system information.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jppf.execute.ExecutorChannel
getConnectionUuid, getMaxJobs, getUuid, isAsynchronous, isLocal, submit
-
Field Details
-
oldStatus
The previous status, if any.
-
-
Constructor Details
-
ChannelWrapper
protected ChannelWrapper()Default constructor.
-
-
Method Details
-
getStatus
Get the status of this connection.- Returns:
- a
JPPFClientConnectionStatusenumerated value.
-
getExecutionStatus
public org.jppf.execute.ExecutorStatus getExecutionStatus()- Specified by:
getExecutionStatusin interfaceorg.jppf.execute.ExecutorChannel<ClientTaskBundle>
-
addClientConnectionStatusListener
Add a connection status listener to this connection's list of listeners.- Parameters:
listener- the listener to add to the list.
-
removeClientConnectionStatusListener
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:
getBundlerin interfaceorg.jppf.execute.ExecutorChannel<ClientTaskBundle>- Returns:
- a
Bundlerinstance.
-
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<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:
getSystemInformationin interfaceorg.jppf.execute.ExecutorChannel<ClientTaskBundle>
-
setSystemInformation
public void setSystemInformation(org.jppf.management.JPPFSystemInformation systemInfo) Set the system information.- Parameters:
systemInfo- aJPPFSystemInformationinstance.
-
getManagementInfo
public org.jppf.management.JPPFManagementInfo getManagementInfo()- Specified by:
getManagementInfoin interfaceorg.jppf.execute.ExecutorChannel<ClientTaskBundle>
-
setManagementInfo
public void setManagementInfo(org.jppf.management.JPPFManagementInfo managementInfo) Set the management information.- Parameters:
managementInfo- aJPPFManagementInfoinstance.
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
getMonitor
- Specified by:
getMonitorin interfaceorg.jppf.execute.ExecutorChannel<ClientTaskBundle>
-
addExecutionStatusListener
public void addExecutionStatusListener(org.jppf.execute.ExecutorChannelStatusListener listener) - Specified by:
addExecutionStatusListenerin interfaceorg.jppf.execute.ExecutorChannel<ClientTaskBundle>
-
removeExecutionStatusListener
public void removeExecutionStatusListener(org.jppf.execute.ExecutorChannelStatusListener listener) - Specified by:
removeExecutionStatusListenerin interfaceorg.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:
isActivein interfaceorg.jppf.execute.ExecutorChannel<ClientTaskBundle>
-
getPriority
public int getPriority()The priority assigned to this channel.- Returns:
- the priority as an int value.
-
cancel
Cancel the currently executing job, if any.- Parameters:
bundle- the bundle to cancel.- Returns:
trueif the job is effectively cancelled,falseotherwise.
-
isResetting
public boolean isResetting()Determine whether the client is resetting.- Returns:
trueif the client is resetting,falseotherwise.
-
setResetting
public void setResetting(boolean resetting) Specify whether the client is resetting.- Parameters:
resetting-trueif the client is resetting,falseotherwise.
-
initChannelID
public void initChannelID()Init the channel id for load-balancer persistence. -
getCurrentNbJobs
public int getCurrentNbJobs()- Specified by:
getCurrentNbJobsin interfaceorg.jppf.execute.ExecutorChannel<ClientTaskBundle>
-
getOldStatus
- Returns:
- the previous status, if any.
-
setOldStatus
- Parameters:
oldStatus- the previous status, if any.
-