Class ClusteredExecutorInfo
- java.lang.Object
-
- com.tangosol.io.AbstractEvolvable
-
- com.oracle.coherence.concurrent.executor.ClusteredExecutorInfo
-
- All Implemented Interfaces:
com.oracle.coherence.concurrent.executor.internal.ClusterMemberAware,com.oracle.coherence.concurrent.executor.internal.Leased,com.oracle.coherence.concurrent.executor.internal.LiveObject,TaskExecutorService.ExecutorInfo,Evolvable,ExternalizableLite,EvolvablePortableObject,PortableObject,Serializable
public class ClusteredExecutorInfo extends AbstractEvolvable implements TaskExecutorService.ExecutorInfo, com.oracle.coherence.concurrent.executor.internal.LiveObject, com.oracle.coherence.concurrent.executor.internal.Leased, com.oracle.coherence.concurrent.executor.internal.ClusterMemberAware, EvolvablePortableObject
A Coherence-based implementation of aTaskExecutorService.ExecutorInfo.- Since:
- 21.12
- Author:
- bo
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.oracle.coherence.concurrent.executor.TaskExecutorService.ExecutorInfo
TaskExecutorService.ExecutorInfo.State
-
-
Field Summary
Fields Modifier and Type Field Description static longLEASE_DURATION_MSThe duration of a lease forExecutors.protected longm_cCompletedThe completed tasks count.protected longm_cFreeMemoryThe free memory as reported byRuntime.freeMemory().protected longm_cInProgressThe tasks that are in progress count.protected longm_cMaxMemoryThe maximum memory as reported byRuntime.maxMemory().protected longm_cRejectedThe rejected tasks count.protected longm_cTotalMemoryThe total memory as reported byRuntime.totalMemory().protected longm_ldtJoinedThe cluster time when theTaskExecutorService.ExecutorInfojoined the service.protected longm_ldtUpdateThe cluster time when theTaskExecutorService.ExecutorInfowas last updated.protected OptionsByType<TaskExecutorService.Registration.Option>m_optionsByTypeTheTaskExecutorService.Registration.Options for theExecutor.protected Stringm_sIdentityThe identity of theTaskExecutorService.Registration.protected TaskExecutorService.ExecutorInfo.Statem_stateTheTaskExecutorService.ExecutorInfo.Stateof theExecutor.protected static intVERSIONPortableObject version.
-
Constructor Summary
Constructors Constructor Description ClusteredExecutorInfo()Constructs aClusteredExecutorInfo(for serialization support).ClusteredExecutorInfo(String sIdentity, long ldtUpdate, long cMaxMemory, long totalMemory, long freeMemory, OptionsByType<TaskExecutorService.Registration.Option> optionsByType)Constructs aClusteredExecutorInfowith the specified parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetDescription()Return the description of theClusteredExecutorInfo.StringgetExecutorName()Return the logical name of thisClusteredExecutorInfo.longgetFreeMemory()The last reported free memory byRuntime.freeMemory()available to theExecutorService.StringgetId()Obtains the unique identity for theExecutorService.intgetImplVersion()Determine the serialization version supported by the implementing class.longgetJoinTime()Returns the time since the epoch when the associated executor joined the service.longgetLastUpdateTime()Obtains the time since the epoch when theTaskExecutorService.ExecutorInfowas last updated.longgetLeaseExpiryTime()Obtains the time the lease will expiry (in milliseconds since the epoc).longgetMaxMemory()The last reported maximum memory byRuntime.maxMemory()available to theExecutorService.<T extends TaskExecutorService.Registration.Option>
TgetOption(Class<T> clzOfOption, T defaultIfNotFound)Obtains theTaskExecutorService.Registration.Optionof the specified class when theExecutorServicewas registered, or the default value if not found.TaskExecutorService.ExecutorInfo.StategetState()Obtains the currentTaskExecutorService.ExecutorInfo.Stateof theExecutor.longgetTasksCompletedCount()Return the number of completed tasks.longgetTasksInProgressCount()Return the number of tasks currently in progress.longgetTasksRejectedCount()Return the number rejected tasks.longgetTotalMemory()The last reported total memory byRuntime.totalMemory()available to theExecutorService.UIDgetUid()ComposableContinuationonDeleted(CacheService service, InvocableMap.Entry entry, com.oracle.coherence.concurrent.executor.internal.Cause cause)TheLiveObjectwas deleted.ComposableContinuationonInserted(CacheService service, InvocableMap.Entry entry, com.oracle.coherence.concurrent.executor.internal.Cause cause)TheLiveObjectwas inserted.booleanonLeaseExpiry()A callback invoked as part of anInvocableMap.EntryProcessorto perform custom lease expiry operations when a lease has expired.booleanonMemberJoined()A callback invoked as part of anInvocableMap.EntryProcessorto perform custom operations when theMemberhas joined the cluster.booleanonMemberLeaving()A callback invoked as part of anInvocableMap.EntryProcessorto perform custom operations when theMemberis leaving the cluster.booleanonMemberLeft()A callback invoked as part of anInvocableMap.EntryProcessorto perform custom operations when theMemberis leaving the cluster.ComposableContinuationonUpdated(CacheService service, InvocableMap.Entry entry, com.oracle.coherence.concurrent.executor.internal.Cause cause)TheLiveObjectwas updated.voidreadExternal(PofReader in)Restore the contents of a user type instance by reading its state using the specified PofReader object.voidreadExternal(DataInput in)Restore the contents of this object by loading the object's state from the passed DataInput object.voidrenew()Renews the lease for some period of time.voidsetFreeMemory(long cFreeMemory)Sets the free memory as reported byRuntime.freeMemory().voidsetMaxMemory(long cMaxMemory)Sets the maximum memory as reported byRuntime.maxMemory().voidsetState(TaskExecutorService.ExecutorInfo.State state)Sets the currentTaskExecutorService.ExecutorInfo.Stateof theExecutor.voidsetTasksCompletedCount(long cTasksCompleted)Sets the number of completed tasks.voidsetTasksFailedCount(long cTasksFailed)Sets the number of task failures.voidsetTasksInProgressCount(long cTasksInProgress)Sets the number of tasks currently in progress.voidsetTotalMemory(long cTotalMemory)Sets the total memory as reported byRuntime.totalMemory().StringtoString()voidtouch()Touches the last update time for theTaskExecutorService.ExecutorInfo.voidwriteExternal(PofWriter out)Save the contents of a POF user type instance by writing its state using the specified PofWriter object.voidwriteExternal(DataOutput out)Save the contents of this object by storing the object's state into the passed DataOutput object.-
Methods inherited from class com.tangosol.io.AbstractEvolvable
getDataVersion, getFutureData, setDataVersion, setFutureData
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.tangosol.io.Evolvable
getDataVersion, getFutureData, setDataVersion, setFutureData
-
-
-
-
Field Detail
-
LEASE_DURATION_MS
public static long LEASE_DURATION_MS
The duration of a lease forExecutors.When
TaskExecutorService.ExecutorInfofor anExecutorhas not been updated for the lease duration time, theExecutoris considered to be offline and should automatically be de-registered.
-
VERSION
protected static int VERSION
PortableObject version.
-
m_state
protected TaskExecutorService.ExecutorInfo.State m_state
TheTaskExecutorService.ExecutorInfo.Stateof theExecutor.
-
m_sIdentity
protected String m_sIdentity
The identity of theTaskExecutorService.Registration.
-
m_optionsByType
protected OptionsByType<TaskExecutorService.Registration.Option> m_optionsByType
TheTaskExecutorService.Registration.Options for theExecutor.
-
m_ldtUpdate
protected long m_ldtUpdate
The cluster time when theTaskExecutorService.ExecutorInfowas last updated.
-
m_ldtJoined
protected long m_ldtJoined
The cluster time when theTaskExecutorService.ExecutorInfojoined the service.
-
m_cMaxMemory
protected long m_cMaxMemory
The maximum memory as reported byRuntime.maxMemory().
-
m_cTotalMemory
protected long m_cTotalMemory
The total memory as reported byRuntime.totalMemory().
-
m_cFreeMemory
protected long m_cFreeMemory
The free memory as reported byRuntime.freeMemory().
-
m_cCompleted
protected long m_cCompleted
The completed tasks count.
-
m_cRejected
protected long m_cRejected
The rejected tasks count.
-
m_cInProgress
protected long m_cInProgress
The tasks that are in progress count.
-
-
Constructor Detail
-
ClusteredExecutorInfo
public ClusteredExecutorInfo()
Constructs aClusteredExecutorInfo(for serialization support).
-
ClusteredExecutorInfo
public ClusteredExecutorInfo(String sIdentity, long ldtUpdate, long cMaxMemory, long totalMemory, long freeMemory, OptionsByType<TaskExecutorService.Registration.Option> optionsByType)
Constructs aClusteredExecutorInfowith the specified parameters.- Parameters:
sIdentity- the identityldtUpdate- the time since the epoc when theTaskExecutorService.ExecutorInfowas last updatedcMaxMemory- the maximum memory as reported byRuntime.maxMemory()totalMemory- the total memory as reported byRuntime.totalMemory()freeMemory- the free memory as reported byRuntime.freeMemory()optionsByType- theTaskExecutorService.Registration.Options for theExecutor
-
-
Method Detail
-
touch
public void touch()
Touches the last update time for theTaskExecutorService.ExecutorInfo.
-
getId
public String getId()
Description copied from interface:TaskExecutorService.ExecutorInfoObtains the unique identity for theExecutorService.- Specified by:
getIdin interfaceTaskExecutorService.ExecutorInfo- Returns:
- the unique identity
-
getState
public TaskExecutorService.ExecutorInfo.State getState()
Obtains the currentTaskExecutorService.ExecutorInfo.Stateof theExecutor.- Specified by:
getStatein interfaceTaskExecutorService.ExecutorInfo- Returns:
- the current
TaskExecutorService.ExecutorInfo.State
-
getLastUpdateTime
public long getLastUpdateTime()
Description copied from interface:TaskExecutorService.ExecutorInfoObtains the time since the epoch when theTaskExecutorService.ExecutorInfowas last updated.- Specified by:
getLastUpdateTimein interfaceTaskExecutorService.ExecutorInfo- Returns:
- the time since the epoch for the last update
-
getJoinTime
public long getJoinTime()
Description copied from interface:TaskExecutorService.ExecutorInfoReturns the time since the epoch when the associated executor joined the service.- Specified by:
getJoinTimein interfaceTaskExecutorService.ExecutorInfo- Returns:
- the time since the epoch when the associated executor joined the service
-
getMaxMemory
public long getMaxMemory()
Description copied from interface:TaskExecutorService.ExecutorInfoThe last reported maximum memory byRuntime.maxMemory()available to theExecutorService.- Specified by:
getMaxMemoryin interfaceTaskExecutorService.ExecutorInfo- Returns:
- the maximum memory (in bytes)
-
getTotalMemory
public long getTotalMemory()
Description copied from interface:TaskExecutorService.ExecutorInfoThe last reported total memory byRuntime.totalMemory()available to theExecutorService.- Specified by:
getTotalMemoryin interfaceTaskExecutorService.ExecutorInfo- Returns:
- the total memory (in bytes)
-
getFreeMemory
public long getFreeMemory()
Description copied from interface:TaskExecutorService.ExecutorInfoThe last reported free memory byRuntime.freeMemory()available to theExecutorService.- Specified by:
getFreeMemoryin interfaceTaskExecutorService.ExecutorInfo- Returns:
- the free memory (in bytes)
-
getOption
public <T extends TaskExecutorService.Registration.Option> T getOption(Class<T> clzOfOption, T defaultIfNotFound)
Description copied from interface:TaskExecutorService.ExecutorInfoObtains theTaskExecutorService.Registration.Optionof the specified class when theExecutorServicewas registered, or the default value if not found.- Specified by:
getOptionin interfaceTaskExecutorService.ExecutorInfo- Type Parameters:
T- the type of theTaskExecutorService.Registration.Option- Parameters:
clzOfOption- the class ofTaskExecutorService.Registration.OptiondefaultIfNotFound- the value to return if not found- Returns:
- a
TaskExecutorService.Registration.Option
-
getImplVersion
public int getImplVersion()
Description copied from class:AbstractEvolvableDetermine the serialization version supported by the implementing class.- Specified by:
getImplVersionin interfaceEvolvable- Specified by:
getImplVersionin classAbstractEvolvable- Returns:
- the serialization version supported by this object
-
setState
public void setState(TaskExecutorService.ExecutorInfo.State state)
Sets the currentTaskExecutorService.ExecutorInfo.Stateof theExecutor.- Parameters:
state- the desiredTaskExecutorService.ExecutorInfo.State
-
getTasksCompletedCount
public long getTasksCompletedCount()
Return the number of completed tasks.- Returns:
- the number of completed tasks
-
getTasksRejectedCount
public long getTasksRejectedCount()
Return the number rejected tasks.- Returns:
- the number rejected tasks
-
getTasksInProgressCount
public long getTasksInProgressCount()
Return the number of tasks currently in progress.- Returns:
- the number of tasks currently in progress
-
setMaxMemory
public void setMaxMemory(long cMaxMemory)
Sets the maximum memory as reported byRuntime.maxMemory().- Parameters:
cMaxMemory- the maximum memory
-
setTotalMemory
public void setTotalMemory(long cTotalMemory)
Sets the total memory as reported byRuntime.totalMemory().- Parameters:
cTotalMemory- the total memory
-
setFreeMemory
public void setFreeMemory(long cFreeMemory)
Sets the free memory as reported byRuntime.freeMemory().- Parameters:
cFreeMemory- the free memory
-
setTasksCompletedCount
public void setTasksCompletedCount(long cTasksCompleted)
Sets the number of completed tasks.- Parameters:
cTasksCompleted- the number of completed tasks
-
setTasksFailedCount
public void setTasksFailedCount(long cTasksFailed)
Sets the number of task failures.- Parameters:
cTasksFailed- the number of failed tasks
-
setTasksInProgressCount
public void setTasksInProgressCount(long cTasksInProgress)
Sets the number of tasks currently in progress.- Parameters:
cTasksInProgress- the number of tasks in progress
-
getExecutorName
public String getExecutorName()
Return the logical name of thisClusteredExecutorInfo.- Returns:
- the logical name of this
ClusteredExecutorInfo
-
getDescription
public String getDescription()
Return the description of theClusteredExecutorInfo.- Returns:
- the description of the
ClusteredExecutorInfo - Since:
- 22.06
-
getLeaseExpiryTime
public long getLeaseExpiryTime()
Description copied from interface:com.oracle.coherence.concurrent.executor.internal.LeasedObtains the time the lease will expiry (in milliseconds since the epoc).- Specified by:
getLeaseExpiryTimein interfacecom.oracle.coherence.concurrent.executor.internal.Leased- Returns:
- the time in milliseconds since the epoc
-
renew
public void renew()
Description copied from interface:com.oracle.coherence.concurrent.executor.internal.LeasedRenews the lease for some period of time.- Specified by:
renewin interfacecom.oracle.coherence.concurrent.executor.internal.Leased
-
onLeaseExpiry
public boolean onLeaseExpiry()
Description copied from interface:com.oracle.coherence.concurrent.executor.internal.LeasedA callback invoked as part of anInvocableMap.EntryProcessorto perform custom lease expiry operations when a lease has expired.- Specified by:
onLeaseExpiryin interfacecom.oracle.coherence.concurrent.executor.internal.Leased- Returns:
trueif theLeasedstate was mutated and should be saved,falseotherwise
-
onInserted
public ComposableContinuation onInserted(CacheService service, InvocableMap.Entry entry, com.oracle.coherence.concurrent.executor.internal.Cause cause)
Description copied from interface:com.oracle.coherence.concurrent.executor.internal.LiveObjectTheLiveObjectwas inserted.- Specified by:
onInsertedin interfacecom.oracle.coherence.concurrent.executor.internal.LiveObject- Parameters:
service- theCacheServicefor theLiveObjectentry- the entry being insertedcause- theCauseof theEvent- Returns:
- an optional
ComposableContinuationto be performed asynchronously for theLiveObject(may benull)
-
onUpdated
public ComposableContinuation onUpdated(CacheService service, InvocableMap.Entry entry, com.oracle.coherence.concurrent.executor.internal.Cause cause)
Description copied from interface:com.oracle.coherence.concurrent.executor.internal.LiveObjectTheLiveObjectwas updated.This callback is invoked against the updated value, not the original value. The original value is available via the provided
Event.- Specified by:
onUpdatedin interfacecom.oracle.coherence.concurrent.executor.internal.LiveObject- Parameters:
service- theCacheServicefor theLiveObjectentry- the entry being updatedcause- theCauseof theEvent- Returns:
- an optional
ComposableContinuationto be performed asynchronously for theLiveObject(may benull)
-
onDeleted
public ComposableContinuation onDeleted(CacheService service, InvocableMap.Entry entry, com.oracle.coherence.concurrent.executor.internal.Cause cause)
Description copied from interface:com.oracle.coherence.concurrent.executor.internal.LiveObjectTheLiveObjectwas deleted.- Specified by:
onDeletedin interfacecom.oracle.coherence.concurrent.executor.internal.LiveObject- Parameters:
service- theCacheServicefor theLiveObjectentry- the entry being deletedcause- theCauseof theEvent- Returns:
- an optional
ComposableContinuationto be performed asynchronously for theLiveObject(may benull)
-
getUid
public UID getUid()
Description copied from interface:com.oracle.coherence.concurrent.executor.internal.ClusterMemberAwareTheUIDof theMemberfor which this object wishes to receive membership events. May returnnullwhich means do not receive membership events.- Specified by:
getUidin interfacecom.oracle.coherence.concurrent.executor.internal.ClusterMemberAware- Returns:
- a
UID
-
onMemberJoined
public boolean onMemberJoined()
Description copied from interface:com.oracle.coherence.concurrent.executor.internal.ClusterMemberAwareA callback invoked as part of anInvocableMap.EntryProcessorto perform custom operations when theMemberhas joined the cluster.- Specified by:
onMemberJoinedin interfacecom.oracle.coherence.concurrent.executor.internal.ClusterMemberAware- Returns:
trueif theClusterMemberAwarestate was mutated and should be saved,falseotherwise- See Also:
MemberListener.memberJoined(MemberEvent)
-
onMemberLeaving
public boolean onMemberLeaving()
Description copied from interface:com.oracle.coherence.concurrent.executor.internal.ClusterMemberAwareA callback invoked as part of anInvocableMap.EntryProcessorto perform custom operations when theMemberis leaving the cluster.- Specified by:
onMemberLeavingin interfacecom.oracle.coherence.concurrent.executor.internal.ClusterMemberAware- Returns:
trueif theClusterMemberAwarestate was mutated and should be saved,falseotherwise
-
onMemberLeft
public boolean onMemberLeft()
Description copied from interface:com.oracle.coherence.concurrent.executor.internal.ClusterMemberAwareA callback invoked as part of anInvocableMap.EntryProcessorto perform custom operations when theMemberis leaving the cluster.- Specified by:
onMemberLeftin interfacecom.oracle.coherence.concurrent.executor.internal.ClusterMemberAware- Returns:
trueif theClusterMemberAwarestate was mutated and should be saved,falseotherwise
-
readExternal
public void readExternal(DataInput in) throws IOException
Description copied from interface:ExternalizableLiteRestore the contents of this object by loading the object's state from the passed DataInput object.- Specified by:
readExternalin interfaceExternalizableLite- Parameters:
in- the DataInput stream to read data from in order to restore the state of this object- Throws:
IOException- if an I/O exception occursNotActiveException- if the object is not in its initial state, and therefore cannot be deserialized into
-
writeExternal
public void writeExternal(DataOutput out) throws IOException
Description copied from interface:ExternalizableLiteSave the contents of this object by storing the object's state into the passed DataOutput object.- Specified by:
writeExternalin interfaceExternalizableLite- Parameters:
out- the DataOutput stream to write the state of this object to- Throws:
IOException- if an I/O exception occurs
-
readExternal
public void readExternal(PofReader in) throws IOException
Description copied from interface:PortableObjectRestore the contents of a user type instance by reading its state using the specified PofReader object.- Specified by:
readExternalin interfacePortableObject- Parameters:
in- the PofReader from which to read the object's state- Throws:
IOException- if an I/O error occurs
-
writeExternal
public void writeExternal(PofWriter out) throws IOException
Description copied from interface:PortableObjectSave the contents of a POF user type instance by writing its state using the specified PofWriter object.- Specified by:
writeExternalin interfacePortableObject- Parameters:
out- the PofWriter to which to write the object's state- Throws:
IOException- if an I/O error occurs
-
-