|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.artima.place.UnicastDiscoveryLink
Represents a unicast discovery-based link to a Jini service on the network. Clients may specify one to many host and port locations at which this link will attempt unicast discovery.
If multiple server addresses are specified when constructing the
UnicastDiscoveryLink
, the UnicastDiscoveryLink
may when activated attempt unicast discovery of multiple lookup services.
If the specified approach is either ORDERED_SEQUENTIAL
or
RANDOM_SEQUENTIAL
, then multiple attempts will occur
sequentially, via LookupLocator
objects. If the specified
approach is ORDERED_SEQUENTIAL
, this object will attempt to
contact lookup services in the order they appear in the passed
ServerAddress
array. If the specified approach is
RANDOM_SEQUENTIAL
, this object will attempt to contact lookup
services in a random order selected each time the link is activated.
When an attempt at unicast discovery fails or times out, the activation
will attempt to contact the next server address on the list. The first
successful discovery that, upon lookup with the specified
ServiceTemplate
, yields a match causes the link activation
to successfully terminate. By randomizing the list of server addresses at
which to attempt unicast discovery, this link can help achieve a kind of
load balancing.
If multiple server addresses are specified with an approach of
CONCURRENTLY
, then when this link is activated it will use a
LookupLocatorDiscovery
object to concurrently attempt to
contact via unicast discovery all the specified server addresses. The
first successful discovery that, upon lookup with the specified
ServiceTemplate
, yields a match causes the link activation
to successfully terminate.
Field Summary | |
static int |
CONCURRENTLY
Constant that when passed to certain constructors indicates that a LookupLocatorDiscovery object will be used to
concurrently attempt to contact all ServerAddress es in
the passed list. |
static int |
ORDERED_SEQUENTIAL
Constant that when passed to certain constructors indicates that LookupLocator s for a list of ServerAddress es
will be tried sequentially in the order they appear in the list. |
static int |
RANDOM_SEQUENTIAL
Constant that when passed to certain constructors indicates that LookupLocator s for a list of ServerAddress es
will be tried sequentially in a random order chosen each time the
link is activated. |
Constructor Summary | |
UnicastDiscoveryLink(ServerAddress[] serverAddresses,
net.jini.core.lookup.ServiceTemplate template,
int approach)
Construct a UnicastDiscoveryLink with an array of
ServerAddress objects and a ServiceTemplate . |
|
UnicastDiscoveryLink(ServerAddress serverAddress,
net.jini.core.lookup.ServiceTemplate template)
Construct a UnicastDiscoveryLink with a
ServerAddress and ServiceTemplate . |
|
UnicastDiscoveryLink(java.lang.String host,
net.jini.core.lookup.ServiceTemplate template)
Construct a UnicastDiscoveryLink with a host
String and ServiceTemplate . |
|
UnicastDiscoveryLink(URLString[] urls,
net.jini.core.lookup.ServiceTemplate template,
int approach)
Construct a UnicastDiscoveryLink with an array of
URLString s and a ServiceTemplate . |
|
UnicastDiscoveryLink(URLString url,
net.jini.core.lookup.ServiceTemplate template)
Construct a UnicastDiscoveryLink with a
URLString and ServiceTemplate . |
Method Summary | |
void |
addProgressListener(ProgressListener listener)
Adds the specified ProgressListener to receive progress
events from this object. |
int |
getApproach()
Returns the approach used by this UnicastDiscoveryLink ,
which will be one of ORDERED_SEQUENTIAL ,
RANDOM_SEQUENTIAL , or CONCURRENTLY . |
ServerAddress[] |
getServerAddresses()
Returns the array of ServerAddress objects which
determine the hosts and ports at which unicast discovery will be
attempted by this link's activate method. |
net.jini.core.lookup.ServiceTemplate |
getServiceTemplate()
Returns the ServiceTemplate with which lookups will be
performed by this UnicastDiscoveryLink . |
void |
removeProgressListener(ProgressListener listener)
Removes the specified ProgressListener so that it no
longer receives progress events from this object. |
net.jini.core.lookup.ServiceItem |
retrieveService()
Activate this link by attempting unicast discovery of lookup services identified in the ServerAddress es array using the
specified approach, ultimately performing lookups at discovered lookup
services with the specified ServiceTemplate . |
void |
stopRetrieval()
Requests a retrieval to stop. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int ORDERED_SEQUENTIAL
LookupLocator
s for a list of ServerAddress
es
will be tried sequentially in the order they appear in the list.public static final int RANDOM_SEQUENTIAL
LookupLocator
s for a list of ServerAddress
es
will be tried sequentially in a random order chosen each time the
link is activated.public static final int CONCURRENTLY
LookupLocatorDiscovery
object will be used to
concurrently attempt to contact all ServerAddress
es in
the passed list.Constructor Detail |
public UnicastDiscoveryLink(URLString url, net.jini.core.lookup.ServiceTemplate template) throws java.io.IOException, java.lang.ClassNotFoundException
UnicastDiscoveryLink
with a
URLString
and ServiceTemplate
. The URL must
be a jini: URL that identifies a Jini lookup service, with the form
jini://host/
or jini://host:port/
.url
- the URL at which this link will perform unicast discovery
when activatedtemplate
- the ServiceTemplate
with which to peform
lookups when this link is activatedNullPointerException
- if either of passed url
or
template
references are null
java.lang.IllegalArgumentException
- if the passed url
is not
a valid jini:
URLjava.io.IOException
- if an I/O error occurs when attempting to serialize
or deserialize the ServiceTemplate
.java.lang.ClassNotFoundException
- if a class can't be found when attempting
deserialize the duplicate ServiceTemplate
.public UnicastDiscoveryLink(URLString[] urls, net.jini.core.lookup.ServiceTemplate template, int approach) throws java.io.IOException, java.lang.ClassNotFoundException
UnicastDiscoveryLink
with an array of
URLString
s and a ServiceTemplate
. Each URL
must be a jini:
URL that identifies a Jini lookup
service, with the form jini://host/
or
jini://host:port/
.urls
- the URLs at which this link will perform unicast discovery
when activatedtemplate
- the ServiceTemplate
with which to peform
lookups when this link is activatedapproach
- the approach (either ORDERED_SEQUENTIAL
,
RANDOM_SEQUENTIAL
, or CONCURRENTLY
) to
use when contacting lookup services when this link is activated.NullPointerException
- if either of passed urls
or
template
references are null
java.lang.IllegalArgumentException
- if the passed urls
is a
zero length array or contains any URLs that aren't valid
jini:
URL, or if the int
passed as
approach
isn't one of
ORDERED_SEQUENTIAL
, RANDOM_SEQUENTIAL
,
or CONCURRENTLY
.java.io.IOException
- if an I/O error occurs when attempting to serialize
or deserialize the ServiceTemplate
.java.lang.ClassNotFoundException
- if a class can't be found when attempting
deserialize the duplicate ServiceTemplate
.public UnicastDiscoveryLink(java.lang.String host, net.jini.core.lookup.ServiceTemplate template) throws java.io.IOException, java.lang.ClassNotFoundException
UnicastDiscoveryLink
with a host
String
and ServiceTemplate
. This object's
activate
method will perform unicast discovery at the
default port (4160) of the passed host, and perform a query on the
resulting lookup service using the passed
ServiceTemplate
.host
- the host at which to perform unicast discovery at the
default port when this link is activated.template
- the ServiceTemplate
with which to peform
lookups when this link is activatedNullPointerException
- if either of passed host
or
template
references are null
java.lang.IllegalArgumentException
- if the passed host
is
not a valid host name, as determined by the
isValidHost
method of class
ServerAddress
java.io.IOException
- if an I/O error occurs when attempting to serialize
or deserialize the ServiceTemplate
.java.lang.ClassNotFoundException
- if a class can't be found when attempting
deserialize the duplicate ServiceTemplate
.public UnicastDiscoveryLink(ServerAddress serverAddress, net.jini.core.lookup.ServiceTemplate template) throws java.io.IOException, java.lang.ClassNotFoundException
UnicastDiscoveryLink
with a
ServerAddress
and ServiceTemplate
. This
object's activate
method will perform unicast discovery
at the host and port specified by the passed
ServerAddress
, and perform a query on the resulting
lookup service using the passed ServiceTemplate
.serverAddress
- the server address (host and port) at which to
perform unicast discovery when this link is activated.template
- the ServiceTemplate
with which to peform
lookups when this link is activatedNullPointerException
- if either of passed
serverAddress
ortemplate
references are
null
java.lang.IllegalArgumentException
- if the passed host
is
not a valid host name, as determined by the
isValidHost
method of class
ServerAddress
java.io.IOException
- if an I/O error occurs when attempting to serialize
or deserialize the ServiceTemplate
.java.lang.ClassNotFoundException
- if a class can't be found when attempting
deserialize the duplicate ServiceTemplate
.public UnicastDiscoveryLink(ServerAddress[] serverAddresses, net.jini.core.lookup.ServiceTemplate template, int approach) throws java.io.IOException, java.lang.ClassNotFoundException
UnicastDiscoveryLink
with an array of
ServerAddress
objects and a ServiceTemplate
.
This object's activate
method will attempt to perform
unicast discovery at each host and port specified in the passed
ServerAddress
array, in order of appearance in the array.
The activate
method will perform a query on the each
resulting lookup service using the passed
ServiceTemplate
. The first match that is found will be
passed to the ActivationClient
. If multiple matches are
found, a random match will be returned. If a lookup service is not
able to be contacted within a timeout determined by this class, the
next ServerAddress
on the list will be tried. Only after
all ServerAddress
es have either yielded no match when the
query was performed, or were not contactable within the timeout, will
the activate
method notify the
ActivationClient
that the activation failed.
serverAddress
- the server addresses (hosts and ports) at which
to perform unicast discovery when this link is activated.template
- the ServiceTemplate
with which to peform
lookups when this link is activatedapproach
- the approach (either ORDERED_SEQUENTIAL
,
RANDOM_SEQUENTIAL
, or CONCURRENTLY
) to
use when contacting lookup services when this link is activated.NullPointerException
- if either of passed
serverAddresses
or template
references
are null
java.lang.IllegalArgumentException
- if the passed
serverAddresses
array is empty, or if the
int
passed as approach
isn't one of
ORDERED_SEQUENTIAL
, RANDOM_SEQUENTIAL
,
or CONCURRENTLY
.java.io.IOException
- if an I/O error occurs when attempting to serialize
or deserialize the ServiceTemplate
.java.lang.ClassNotFoundException
- if a class can't be found when attempting
deserialize the duplicate ServiceTemplate
.Method Detail |
public net.jini.core.lookup.ServiceItem retrieveService() throws java.rmi.RemoteException, StoppedException
ServerAddress
es array using the
specified approach, ultimately performing lookups at discovered lookup
services with the specified ServiceTemplate
. The
activate
method will return promptly, returning a
LinkActivation
object that enables the client to abort
the activation. Invoking activate
again while an
activation is currently in progress just starts a new activation
independent of the already running one.retrieveService
in interface Link
ServiceItem
the retrieved service itemRemoteException
- to indicate a failure in retrieving the serviceStoppedException
- to indicate that the request was stoppedpublic void stopRetrieval()
Link
stopRetrival()
has no effect. The stopRetrieval()
method does
not throw an exception to indicate the activation has already
succeeded, failed, or been aborted, but returns normally in these
cases.stopRetrieval
in interface Link
public ServerAddress[] getServerAddresses()
ServerAddress
objects which
determine the hosts and ports at which unicast discovery will be
attempted by this link's activate
method.ServerAddress
objects that define the hosts
and port at which unicast unicast discovery will be
attempted by this link when it is activated.public net.jini.core.lookup.ServiceTemplate getServiceTemplate() throws java.io.IOException, java.lang.ClassNotFoundException
ServiceTemplate
with which lookups will be
performed by this UnicastDiscoveryLink
.ServiceTemplate
used by this
link when activatedjava.io.IOException
- if an I/O error occurs when attempting to serialize
or deserialize the ServiceTemplate
.java.lang.ClassNotFoundException
- if a class can't be found when attempting
deserialize the duplicate ServiceTemplate
.public int getApproach()
UnicastDiscoveryLink
,
which will be one of ORDERED_SEQUENTIAL
,
RANDOM_SEQUENTIAL
, or CONCURRENTLY
.public void addProgressListener(ProgressListener listener)
ProgressListener
to receive progress
events from this object. If listener
is null
, no
exception is thrown and no action is performed.addProgressListener
in interface ProgressEventGenerator
listener
- the ProgressListener
to addpublic void removeProgressListener(ProgressListener listener)
ProgressListener
so that it no
longer receives progress events from this object. This method performs
no function, nor does it throw an exception, if the listener specified
by the argument was not previously added to this object. If
listener
is null
, no exception is thrown and no
action is performed.removeProgressListener
in interface ProgressEventGenerator
listener
- the ProgressListener
to remove
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |