org.ehcache.clustered.client.config
Class TimeoutDuration

java.lang.Object
  extended by org.ehcache.clustered.client.config.TimeoutDuration

public final class TimeoutDuration
extends java.lang.Object

Describes a timeout value for a clustered operation. Instances of this class are subject to the operation of the Java java.util.concurrent.TimeUnit class.


Field Summary
static TimeoutDuration NONE
          Constant indicating no timeout.
 
Method Summary
 long convert(java.util.concurrent.TimeUnit toUnit)
          Converts this TimeDuration to the specified time unit.
 boolean equals(java.lang.Object other)
           
 int hashCode()
           
static TimeoutDuration of(long amount, java.util.concurrent.TimeUnit unit)
          Gets a TimeoutDuration of the indicated duration.
 void timedWait(java.lang.Object obj)
          Performs a timed wait on the object provided.
 long toMillis()
          Converts this TimeoutDuration to milliseconds.
 long toNanos()
          Converts this TimeoutDuration to nanoseconds.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NONE

public static final TimeoutDuration NONE
Constant indicating no timeout.

Method Detail

of

public static TimeoutDuration of(long amount,
                                 java.util.concurrent.TimeUnit unit)
Gets a TimeoutDuration of the indicated duration.

Parameters:
amount - the non-negative timeout duration
unit - the non-null units for amount
Returns:
a TimeoutDuration instance for the specified duration
Throws:
java.lang.NullPointerException - if unit is null
java.lang.IllegalArgumentException - if amount is negative

toNanos

public long toNanos()
Converts this TimeoutDuration to nanoseconds. Values are converted according to the rules for java.util.concurrent.TimeUnit.

Returns:
the number of nanoseconds represented by this TimeDuration

toMillis

public long toMillis()
Converts this TimeoutDuration to milliseconds. Values are converted according to the rules for java.util.concurrent.TimeUnit.

Returns:
the number of milliseconds represented by this TimeDuration

convert

public long convert(java.util.concurrent.TimeUnit toUnit)
Converts this TimeDuration to the specified time unit. Values are converted according to the rules for java.util.concurrent.TimeUnit.

Parameters:
toUnit - the TimeUnit to which this TimeDuration value is converted
Returns:
the duration expressed in toUnit units
See Also:
TimeUnit.convert(long, TimeUnit)

timedWait

public void timedWait(java.lang.Object obj)
               throws java.lang.InterruptedException
Performs a timed wait on the object provided.

Parameters:
obj - the Object on which to wait
Throws:
java.lang.InterruptedException - if the wait is interrupted
See Also:
TimeUnit.timedWait(Object, long)

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object