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 lock method 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 "lock method" Watch "lock method" New topic
Author

lock method

pramod karnani
Ranch Hand

Joined: May 22, 2007
Posts: 88

when I am calling lock(recNo) on locked record my code is blocking for some time and after some time it throws
java.lang.OutOfMemoryError: Java heap space .Like it goes in infinite loop in lock method .

Is it okay when we call lock method on already locked record it should block the code.


let me know
mohamed sulibi
Ranch Hand

Joined: Sep 04, 2005
Posts: 169
hi;

Is it okay when we call lock method on already locked record it should block the code.


I think the answer is yes for this question, the current thread will be blocked when you call the wait or aWait on some object or lock .

but for
when I am calling lock(recNo) on locked record my code is blocking for some time and after some time it throws
java.lang.OutOfMemoryError: Java heap space .Like it goes in infinite loop in lock method .


actually i don't know why you received it.

Best Regards.
Mohamed Darim
SCJP, SCJD in progress ... (from 1/8/2007 - till now ....)
Alecsandru Cocarla
Ranch Hand

Joined: Feb 29, 2008
Posts: 158
You'll probably have to post some code in order to see why it's going out of memory. Otherwise we can't tell what is wrong with your code. It should not behave like this.


SCJP 1.4 100%
SCJD 99.5%
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: lock method
 
Similar Threads
NX: URLyBird Database Record Number Question
record lock&unlock
B&S Data => Lock-waiting giveup CPU
Record locking on recNo
Will this locking mechanism be allowed?