Class MonitorInfoAdapter
java.lang.Object
com.pnfsoftware.jeb.util.concurrent.MonitorInfoAdapter
- All Implemented Interfaces:
IMonitorInfoProvider
Standard implementation of the
IMonitorInfoProvider interface.-
Constructor Summary
ConstructorsConstructorDescriptionMonitorInfoAdapter(long timeout, long probingPeriodMs) Create monitor settings. -
Method Summary
Modifier and TypeMethodDescriptionlongGet the current probing period.longGet the current timeout value.voidIf timeout has elapsed, this method is called before the monitor attempts to interrupt the monitored thread.voidsetProbingPeriod(long millis) Set the period at which the monitored thread will be probed.voidsetTimeout(long millis) Set the timeout value that determines the maximum thread's lifetime.
-
Constructor Details
-
MonitorInfoAdapter
public MonitorInfoAdapter(long timeout, long probingPeriodMs) Create monitor settings.- Parameters:
timeout- timeout in milliseconds; a non-positive value means no timeoutprobingPeriodMs- monitor probing period in milliseconds
-
-
Method Details
-
setTimeout
public void setTimeout(long millis) Description copied from interface:IMonitorInfoProviderSet the timeout value that determines the maximum thread's lifetime. That method allows the timeout to be set dynamically, even during execution of said-thread.- Specified by:
setTimeoutin interfaceIMonitorInfoProvider- Parameters:
millis- timeout in milliseconds;<= 0means no timeout
-
getTimeout
public long getTimeout()Description copied from interface:IMonitorInfoProviderGet the current timeout value.- Specified by:
getTimeoutin interfaceIMonitorInfoProvider- Returns:
- timeout in milliseconds, or a non-positive value for no timeout
-
setProbingPeriod
public void setProbingPeriod(long millis) Description copied from interface:IMonitorInfoProviderSet the period at which the monitored thread will be probed. That method allows the probing period to be set dynamically, even during execution of said-thread.- Specified by:
setProbingPeriodin interfaceIMonitorInfoProvider- Parameters:
millis- period in milliseconds;<= 0means a default value will be used
-
getProbingPeriod
public long getProbingPeriod()Description copied from interface:IMonitorInfoProviderGet the current probing period.- Specified by:
getProbingPeriodin interfaceIMonitorInfoProvider- Returns:
- the period in ms
-
onInterrupt
public void onInterrupt()Description copied from interface:IMonitorInfoProviderIf timeout has elapsed, this method is called before the monitor attempts to interrupt the monitored thread.- Specified by:
onInterruptin interfaceIMonitorInfoProvider
-