Package org.opennms.core.utils
Class TimeoutTracker
- java.lang.Object
-
- org.opennms.core.utils.TimeoutTracker
-
public class TimeoutTracker extends java.lang.Object
Helper class used for tracking retires and timeouts for ServiceMonitors.- Author:
- Ben Reed, Mathew Brozowski
-
-
Constructor Summary
Constructors Constructor Description TimeoutTracker(java.util.Map<java.lang.String,?> parameters, int defaultRetry, int defaultTimeout)
Constructor for TimeoutTracker.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
elapsedTime(java.util.concurrent.TimeUnit unit)
elapsedTimedouble
elapsedTimeInMillis()
elapsedTimeInMillislong
elapsedTimeNanos()
elapsedTimeNanosint
getAttempt()
getAttemptint
getConnectionTimeout()
getConnectionTimeoutint
getSoTimeout()
getSoTimeoutlong
getTimeoutInMillis()
getTimeoutInMillislong
getTimeoutInSeconds()
getTimeoutInSecondsvoid
nextAttempt()
nextAttemptvoid
reset()
resetboolean
shouldRetry()
shouldRetryvoid
startAttempt()
startAttemptjava.lang.String
toString()
-
-
-
Method Detail
-
shouldRetry
public boolean shouldRetry()
shouldRetry
- Returns:
- a boolean.
-
getTimeoutInMillis
public long getTimeoutInMillis()
getTimeoutInMillis
- Returns:
- a long.
-
getTimeoutInSeconds
public long getTimeoutInSeconds()
getTimeoutInSeconds
- Returns:
- a long.
-
reset
public void reset()
reset
-
nextAttempt
public void nextAttempt()
nextAttempt
-
getAttempt
public int getAttempt()
getAttempt
- Returns:
- a int.
-
startAttempt
public void startAttempt()
startAttempt
-
elapsedTimeInMillis
public double elapsedTimeInMillis()
elapsedTimeInMillis
- Returns:
- a double.
-
elapsedTimeNanos
public long elapsedTimeNanos()
elapsedTimeNanos
- Returns:
- a long.
-
elapsedTime
public double elapsedTime(java.util.concurrent.TimeUnit unit)
elapsedTime
- Parameters:
unit
- aTimeUnit
object.- Returns:
- a double.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getSoTimeout
public int getSoTimeout()
getSoTimeout
- Returns:
- a int.
-
getConnectionTimeout
public int getConnectionTimeout()
getConnectionTimeout
- Returns:
- a int.
-
-