public final class ConnectionRelativeTime extends Object implements RelativeTimeConstraint, Serializable
Socket
-based communication, the intention is that this
constraint controls the timeout parameter of the
connect
method.
The duration is translated into an absolute end time at the point of a remote call by adding the caller's current time.
Constructor and Description |
---|
ConnectionRelativeTime(long time)
Creates a constraint with the specified duration.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Two instances of this class are equal if both have the same duration.
|
long |
getTime()
Returns the maximum connection duration in milliseconds.
|
int |
hashCode()
Returns a hash code value for this object.
|
InvocationConstraint |
makeAbsolute(long baseTime)
Returns a
ConnectionAbsoluteTime instance with time obtained
by adding the specified base time argument to the duration value
from this instance. |
String |
toString()
Returns a string representation of this object.
|
public ConnectionRelativeTime(long time)
time
- the maximum connection duration in millisecondsIllegalArgumentException
- if the argument is less than zeropublic long getTime()
public InvocationConstraint makeAbsolute(long baseTime)
ConnectionAbsoluteTime
instance with time obtained
by adding the specified base time argument to the duration value
from this instance. If the addition results in overflow, a time value
of Long.MAX_VALUE
is used.makeAbsolute
in interface RelativeTimeConstraint
baseTime
- an absolute time, specified in milliseconds from
midnight, January 1, 1970 UTCpublic int hashCode()
public boolean equals(Object obj)
Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.