Package net.jini.core.constraint
Class ConnectionRelativeTime
java.lang.Object
net.jini.core.constraint.ConnectionRelativeTime
- All Implemented Interfaces:
Serializable,InvocationConstraint,RelativeTimeConstraint
public final class ConnectionRelativeTime
extends Object
implements RelativeTimeConstraint, Serializable
Represents a constraint on the maximum amount of time to wait for a network connection to be
established. The precise meaning of this will vary across communication mechanisms, but in the
typical case of
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.
- Since:
- 2.0
- Author:
- Sun Microsystems, Inc.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConnectionRelativeTime(long time) Creates a constraint with the specified duration. -
Method Summary
Modifier and TypeMethodDescriptionbooleanTwo instances of this class are equal if both have the same duration.longgetTime()Returns the maximum connection duration in milliseconds.inthashCode()Returns a hash code value for this object.makeAbsolute(long baseTime) Returns aConnectionAbsoluteTimeinstance with time obtained by adding the specified base time argument to the duration value from this instance.toString()Returns a string representation of this object.
-
Constructor Details
-
ConnectionRelativeTime
public ConnectionRelativeTime(long time) Creates a constraint with the specified duration.- Parameters:
time- the maximum connection duration in milliseconds- Throws:
IllegalArgumentException- if the argument is less than zero
-
-
Method Details
-
getTime
public long getTime()Returns the maximum connection duration in milliseconds.- Returns:
- the maximum connection duration in milliseconds
-
makeAbsolute
Returns aConnectionAbsoluteTimeinstance 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 ofLong.MAX_VALUEis used.- Specified by:
makeAbsolutein interfaceRelativeTimeConstraint- Parameters:
baseTime- an absolute time, specified in milliseconds from midnight, January 1, 1970 UTC- Returns:
- a constraint that has the relative times converted to absolute times by adding the specified absolute time to each relative time
-
hashCode
public int hashCode()Returns a hash code value for this object. -
equals
Two instances of this class are equal if both have the same duration. -
toString
Returns a string representation of this object.
-