LookupLocator
subclass which supports constraint operations through the {@link RemoteMethodControl} interface. The constraints of a
ConstrainableLookupLocator
instance control how it performs unicast discovery, and apply only to its {@link LookupLocator#getRegistrar() getRegistrar()} and {@link LookupLocator#getRegistrar(int) getRegistrar(int)} methods. The constraints may also be used by otherutilities, such as {@link LookupLocatorDiscovery}, to determine how unicast discovery should be performed on behalf of a given
ConstrainableLookupLocator
instance. Untrusted
ConstrainableLookupLocator
instances can be verified using the {@link ConstrainableLookupLocatorTrustVerifier} trust verifier.
@author Sun Microsystems, Inc.
@since 2.0
@com.sun.jini.impl This class supports use of the following constraint types to control unicast discovery behavior:
- {@link com.sun.jini.discovery.DiscoveryProtocolVersion}: this constraint can be used to control which version of the unicast discovery protocol is used.
- {@link com.sun.jini.discovery.UnicastSocketTimeout}: this constraint can be used to control the read timeout set on sockets over which unicast discovery is performed.
- {@link net.jini.core.constraint.ConnectionRelativeTime}: this constraint can be used to control the relative connection timeout set on sockets over which unicast discovery is performed.
- {@link net.jini.core.constraint.ConnectionAbsoluteTime}: this constraint can be used to control the absolute connection timeout set on sockets over which unicast discovery is performed.
In addition, the {@link com.sun.jini.discovery.MulticastMaxPacketSize} and{@link com.sun.jini.discovery.MulticastTimeToLive} constraint types aretrivially supported, but do not have any effect on unicast discovery operations. Constraints other than those mentioned above are passed on to the underlying implementations of versions 1 and 2 of the discovery protocols.
An example of using constraints with ConstrainableLookupLocator
is:
new ConstrainableLookupLocator("target_host", 4160, new {@link net.jini.constraint.BasicMethodConstraints}( new {@link InvocationConstraints}( DiscoveryProtocolVersion.TWO, new UnicastSocketTimeout(120000))));
The resulting
ConstrainableLookupLocator
instance would (when used) perform unicast discovery to the host
target_host
on port 4160 using discovery protocol version 2, with a socket read timeout of 120000 milliseconds unless one was explicitly specified using the {@link #getRegistrar(int)} method.