Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unreferenced is never called

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have implemented a ConnectionFactory with a getData Method, which returns a new ConnectionObject. These ConnectionObject implements the unreferenced interface.
In the main method of the ConnectionFactory i create a registry and bind the ConnectionFactory there.
When the client exits abnormally the unreferenced method from the ConnectionObject is never called.
Can you please help me to figure out why this not work.

Thanks for your help
 
BJ Grau
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unreferenced.unreferenced() is called immediately when a client finishes with a remote object cleanly, but if a client exits abnormally (crashes) you will have to wait a certain amount of time, depending on these settings:
java.rmi.dgc.leaseValue (default is 10 minutes)
sun.rmi.dgc.checkInterval (default is 5 minutes)
leaseValue is how long your client is granted a reference to the remote object on the server.
checkInteval is how often the server checks for expired leases.
Check it out here:
http://java.sun.com/j2se/1.3/docs/guide/rmi/javarmiproperties.html
and here:
http://java.sun.com/j2se/1.3/docs/guide/rmi/sunrmiproperties.html
 
Reid M. Pinchback
Ranch Hand
Posts: 775
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure that this is the problem? I thought I read somewhere recently that unreferenced is only called if there are no remote references to the object, and a registry binding counts as one reference.
 
ravindra janapreddy
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Alex
Could you please elaborate on the ConnectionFactory which you have used in your application?
Thanks
Ravindra
 
BJ Grau
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Reid M. Pinchback:
Are you sure that this is the problem? I thought I read somewhere recently that unreferenced is only called if there are no remote references to the object, and a registry binding counts as one reference.

You are right about the registry counting as a client, but in this case I'm assuming that only his ConnectionFactory is bound to the registry.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The default for Unreferenced is 15 minutes. And it is in reference to a Remote Object, and not an object in the Registry. The registry object will exist as long as the registry is running.
Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic