File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Unreferenced  is never called Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Unreferenced  is never called" Watch "Unreferenced  is never called" New topic
Author

Unreferenced is never called

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
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

Joined: Jul 10, 2001
Posts: 234
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

Joined: Jan 25, 2002
Posts: 775
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.


Reid - SCJP2 (April 2002)
ravindra janapreddy
Ranch Hand

Joined: Jan 30, 2001
Posts: 84
Hi Alex
Could you please elaborate on the ConnectionFactory which you have used in your application?
Thanks
Ravindra


SCEA, SCBCD, SCWCD, SCJD, SCJP
BJ Grau
Ranch Hand

Joined: Jul 10, 2001
Posts: 234
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

Joined: Feb 05, 2001
Posts: 17249
    
    6

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


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unreferenced is never called
 
Similar Threads
Unreferenced
Handling Client Crash
here I am again - one more time with unreferenced problems
Implementin Unreferenced
How could the RMI server get to know client crashed?