• Post Reply Bookmark Topic Watch Topic
  • New Topic

DGC.dirty() and Lease

 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
The javadoc for DGC.dirty() states the following:

The client must also make a dirty call to renew leases on remote references before such leases expire. When the client no longer has any references to a specific remote object, it must schedule a clean call for the object ID associated with the reference.

How does one insure that the lease does not expire on a remote reference before the client is ready to relinquish it? How does one acquire a DGC reference on a remote VM in order to check the lease information? The API docs on java.rmi.dgc are not very helpful on these subjects and despite many futile searches, I am no closer to understanding them.
Thanks in advance for your help
Michael Morris
SCJP2
 
Charlie Hubbard
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Michael Morris:
Hi All,
The javadoc for DGC.dirty() states the following:

The client must also make a dirty call to renew leases on remote references before such leases expire. When the client no longer has any references to a specific remote object, it must schedule a clean call for the object ID associated with the reference.

How does one insure that the lease does not expire on a remote reference before the client is ready to relinquish it? How does one acquire a DGC reference on a remote VM in order to check the lease information? The API docs on java.rmi.dgc are not very helpful on these subjects and despite many futile searches, I am no closer to understanding them.
Thanks in advance for your help
Michael Morris
SCJP2

One does not need to worry lease expiration from a clients perspective. If a client has a reference to a remote object then DGC lease renewal happens automatically. There is no need to renew the lease yourself. To get rid of an object simply drop your reference to the remote object. When the stub object is GC'ed then the renewal of the lease will cease, and the remote object will be GC'ed itself. (That is provided no other clients have a reference to that remote object--remember--RMI Registry counts as one).
charlie
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!