org.eclipse.jgit.storage.dht
Class Timeout

java.lang.Object
  extended by org.eclipse.jgit.storage.dht.Timeout

public class Timeout
extends java.lang.Object

Length of time to wait for an operation before giving up.


Constructor Summary
Timeout(long time, java.util.concurrent.TimeUnit unit)
          Construct a new timeout.
 
Method Summary
 boolean equals(java.lang.Object other)
           
 long getTime()
           
static Timeout getTimeout(Config cfg, java.lang.String section, java.lang.String subsection, java.lang.String name, Timeout defaultValue)
          Obtain a timeout from the configuration.
 java.util.concurrent.TimeUnit getUnit()
           
 int hashCode()
           
static Timeout milliseconds(int millis)
          Construct a new timeout, expressed in milliseconds.
static Timeout seconds(double sec)
          Construct a new timeout, expressed in (possibly fractional) seconds.
static Timeout seconds(int sec)
          Construct a new timeout, expressed in seconds.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Timeout

public Timeout(long time,
               java.util.concurrent.TimeUnit unit)
Construct a new timeout.

Parameters:
time - how long to wait.
unit - the unit that time was expressed in.
Method Detail

milliseconds

public static Timeout milliseconds(int millis)
Construct a new timeout, expressed in milliseconds.

Parameters:
millis - number of milliseconds to wait.
Returns:
the timeout.

seconds

public static Timeout seconds(int sec)
Construct a new timeout, expressed in seconds.

Parameters:
sec - number of seconds to wait.
Returns:
the timeout.

seconds

public static Timeout seconds(double sec)
Construct a new timeout, expressed in (possibly fractional) seconds.

Parameters:
sec - number of seconds to wait.
Returns:
the timeout.

getTimeout

public static Timeout getTimeout(Config cfg,
                                 java.lang.String section,
                                 java.lang.String subsection,
                                 java.lang.String name,
                                 Timeout defaultValue)
Obtain a timeout from the configuration.

Parameters:
cfg - configuration to read.
section - section key to read.
subsection - subsection to read, may be null.
name - variable to read.
defaultValue - default to return if no timeout is specified in the configuration.
Returns:
the configured timeout.

getTime

public long getTime()
Returns:
how long to wait, expressed as getUnit()s.

getUnit

public java.util.concurrent.TimeUnit getUnit()
Returns:
the unit of measure for getTime().

hashCode

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

equals

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

toString

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


Copyright © 2011. All Rights Reserved.