|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Lock
Primitive lock interface. Implements an exclusive locking mechanism.
This interface is designed to provide a means for programs to maintain a lock across multiple method calls (which cannot be done using normal synchronized methods). It may also be used to implement locks that can be shared between multiple programs.
Classes that implement this interface should implement recursive
(or nesting) locks, such that calling acquire()
more
than once results in an internal lock count to be incremented, so that exactly
the same number of calls to release()
are needed in order to
completely release the lock. This parallels the way synchronized
objects operate in Java.
Field Summary | |
---|---|
static java.lang.String |
REV
Revision information. |
Method Summary | |
---|---|
boolean |
acquire(int timeOut)
Acquire an exclusive lock on this lock object. |
boolean |
isLocked()
Determines if this lock has been acquired. |
int |
lockCount()
Determines the number of nested locks acquired for this lock. |
boolean |
release()
Release the exclusive lock acquired on this lock object. |
Field Detail |
---|
static final java.lang.String REV
Method Detail |
---|
boolean acquire(int timeOut) throws java.io.IOException
timeOut
- The maximum number of milliseconds to wait while attempting to acquire a
lock before giving up. A value of zero specifies an unlimited wait time.
Note that the resolution of the system clock may be coarser than one
millisecond, so this parameter is only an approximation of the actual
time-out interval used.
java.io.IOException
- Thrown if an I/O error occurs.boolean release() throws java.io.IOException
java.io.IOException
- Thrown if an I/O error occurs.boolean isLocked()
int lockCount()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |