Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.jini.core.constraint
Class ConnectionRelativeTime

    java.lang.Object
      net.jini.core.constraint.ConnectionRelativeTime

All Implemented Interfaces:
  InvocationConstraint, RelativeTimeConstraint, Serializable

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
See Also:
  Serialized Form

Constructor Summary
`ConnectionRelativeTime(long time)` Creates a constraint with the specified duration.

Method Summary
`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.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### 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 Detail

### getTime

    public long getTime()

  Returns the maximum connection duration in milliseconds.

  Returns:
    the maximum connection duration in milliseconds

### makeAbsolute

    public 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. If the addition results in overflow, a time value of `Long.MAX_VALUE` is used.

  Specified by:
    `makeAbsolute` in interface `RelativeTimeConstraint`
  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

    public boolean equals(Object obj)

  Two instances of this class are equal if both have the same duration.

### toString

    public String toString()

  Returns a string representation of this object.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004 Sun Microsystems, Inc. All rights reserved