Endpoint
. In addition to the Endpoint
and the Uuid
, BasicObjectEndpoint
instances also contain a flag indicating whether or not the instance participates in distributed garbage collection (DGC).
The {@link #newCall newCall} method can be used to send arequest to the remote object that this object references.
BasicObjectEndpoint
class acts as the DGC client for all of its instances that participate in DGC (which are called live remote references). That is, it tracks the existence and reachability of live remote references and makes dirty calls and clean calls to the associated server-side DGC implementations, as described below. The server-side behavior of dirty and clean calls is specified by {@link BasicJeriExporter}. When the DGC client makes a dirty or clean call to a given Endpoint
, the behavior is effectively that of using a BasicObjectEndpoint
containing that Endpoint
and the object identifier d32cd1bc-273c-11b2-8841-080020c9e4a1
(and that doesn't itself participate in DGC), wrapped in a {@link net.jini.jeri.BasicInvocationHandler} with no client or serverconstraints, wrapped in an instance of a dynamic proxy class that implements an interface with the following remote methods:
long dirty(Uuid clientID, long sequenceNum, Uuid[] ids) throws {@link RemoteException}; void clean(Uuid clientID, long sequenceNum, Uuid[] ids, boolean strong) throws RemoteException;
clientID
is the DGC client's universally unique identifier, which is generated using {@link UuidFactory#generate UuidFactory.generate}. sequenceNum
identifies the sequence number of the dirty or clean call with respect to all other dirty and clean calls made by the same DGC client (regardless of the Endpoint
that the calls are made to). All dirty and clean calls made by a DGC client must have a unique sequence number that monotonically increases with the temporal order of the states (of reachable live remote references) that the calls assert. A dirty call asserts that live remote references with the called Endpoint
and each of the object identifiers in ids
exist for the identified DGC client. A clean call asserts that there are no (longer) live remote references with the called Endpoint
and each of the object identifiers in ids
for the identified DGC client. The tracked live remote references are categorized by their Endpoint
and further categorized by their object identifier (with the Endpoint
and object identifier pair identifying a remote object). When a new live remote reference is created, either by construction or deserialization, it is remembered among the live remote references with the same Endpoint
and object identifier, and its reachability is tracked with a phantom reference. If there is not already a live remote reference with the same Endpoint
and object identifier, the DGC client makes a dirty call to the server-side DGC implementation at that Endpoint
, with that object identifier in the ids
argument. Dirty calls for multiple newly created live remote references with the same Endpoint
may be batched as one dirty call (such as for multiple live remote references deserialized from the same stream).
Each successful dirty call establishes or renews a lease for the DGC client with the server-side DGC implementation at the Endpoint
that the dirty call was made to. The duration of the lease granted by the server is conveyed as the return value of the dirty call, in milliseconds starting from some time during the processing of the dirty call. While there are live remote references with a given Endpoint
, the DGC client attempts to maintain a valid lease with that Endpoint
by renewing its lease with successive dirty calls. The DGC client should take into consideration network and processing latencies of the previous dirty call and the next required dirty call in choosing when to renew a lease. If the DGC client has reason to assume that its lease with a given Endpoint
might have expired, then in subsequent dirty calls to that Endpoint
, it should include the object identifiers of all currently reachable live remote references with that Endpoint
. If a dirty call returns a negative lease duration or throws a {@link NoSuchObjectException}, the DGC client should refrain from making further dirty calls to the same Endpoint
until a new live remote reference with that Endpoint
is created.
If a dirty call fails with a communication exception other than a NoSuchObjectException
, the DGC client implementation should make a reasonable effort to retry the dirty call (in a network-friendly manner). Also, after such a failed dirty call for a given Endpoint
and object identifier, any clean call that is made for that same Endpoint
and object identifier within a reasonable amount of time should pass true
for the strong
argument, in case the failed dirty call does eventually get delivered to the server after such a clean call has been processed.
When the last remaining live remote reference with a given Endpoint
and object identifier is detected to be phantom reachable, the DGC client makes a clean call to the server-side DGC implementation at that Endpoint
, with that object identifier in the ids
argument. Clean calls for several object identifiers at the same Endpoint
may be batched as one clean call (such as when multiple live remote references with the same Endpoint
and different object identifiers are detected to be phantom reachable at the same time).
If a clean call fails with a communication exception other than a NoSuchObjectException
, the DGC client implementation should make a reasonable effort to retry the clean call, in a network-friendly manner, especially while the DGC client's lease for the Endpoint
remains valid (or while dirty calls for the same Endpoint
succeed).
@author Sun Microsystems, Inc.
@since 2.0
@com.sun.jini.impl
This implementation uses the {@link Logger} namednet.jini.jeri.BasicObjectEndpoint
to log information at the following levels:
Level | Description |
---|---|
{@link Levels#HANDLED HANDLED} | failure of DGC dirtyor clean call |
{@link Level#FINEST FINEST} | detailed implementationactivity |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|