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 is Unreferenced a bad idea ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "is Unreferenced a bad idea ?" Watch "is Unreferenced a bad idea ?" New topic
Author

is Unreferenced a bad idea ?

Matheus Mendes
Ranch Hand

Joined: May 15, 2007
Posts: 66
I was reading some old posts, and found some topics as " Unreferenced should not be used ", but are topics from 2001....
So I ask you guys, what do you think ?

I'm using and trying to guess how decrease the time-out. I'm using the following lock process

Read()
Lock()
User thinking
Update()
Unlock()

I'm using it to guarantee that while my user is thinking, nobody else change his Record, is it too bad ??


The Death of one is a tragedy, but the Death of a million is just a statistic. Joseph Stalin

SCJP 6.0, SCJD
Liviu Carausu
Ranch Hand

Joined: Oct 07, 2004
Posts: 158
Hi,
In my understanding, Unreferenced is useful for cleaning the orphaned locks. If one client locks
a record and then crashes without unlocking it, the server has a chance to detect using the Unreferenced
interface if the client passed away and to unlock the record.
So, if you are implementing a thin client, you will probably do not need to use the Unreferenced interface
because locking/unlocking is a an atomic operation at the server. If you have a thick client, it is ok to use
the Unreferenced interface.
By the way, these settings can help you to interact with the distributed garbage collector:
java.rmi.dgc.leaseValue, sun.rmi.dgc.checkInterval
Greetings,
Liviu

Oracle Certified Master Java SE6 Developer(SCJD),
OCE JEE 6 JSP and Servlets Developer.
Matheus Mendes
Ranch Hand

Joined: May 15, 2007
Posts: 66
Liviu,

Thank you for the answer. My concept of thin client was badly understood, I'm making calls to the lock and unlock through my client, trying to avoid the following situation, Client A is editing(booking) a Record and the Client B updates it.
My GUI requests the information to book through a JDialog, so my idea was to lock the Record while the client didn't wrote the information.

But I understand how applicable is a thin client, I think I'll change my implementation to solve my problem.

Thanks!

[]s
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: is Unreferenced a bad idea ?