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 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "unreferenced" Watch "unreferenced" New topic
Author

unreferenced

Gosling Gong
Ranch Hand

Joined: Jun 20, 2002
Posts: 51
Hello, ranchers!
I let my remote data implements unreferenced interface, but I found it behave strangely. I create a test client, which spawns 30 threads to bookFlight() for the same flight, it works.
after I commented the unlock(), off course there is only one thread get the lock, the others will wait. but after a period(less than 1 min), the unreferenced() in the remote data which was holding the lock was called.
I am confused why this will happen, I didn't close the client.
Anyone can show some light? thanx
Gosling Gong
Ranch Hand

Joined: Jun 20, 2002
Posts: 51
No one ever experienced such case?
Eduard Jodas
Ranch Hand

Joined: May 14, 2002
Posts: 80
Just guessing:
if your client discards or removes references to the stub that gives you access to the remote server then, after a while, the Garbage Collector will remove the object from memory. Thus, the remote object is no longer referenced and that's why its unreferenced method is called. No matter if you called close or not.
 
 
subject: unreferenced
 
Similar Threads
NX:URlyBird 1.3.2/ A question for Database cache.
Unreferenced on a Remote object
"Serving" Remote Objects
how can I know client died from server class??
unlock Thread