This topic has not yet been written. The content below is from the topic description.
The setlock operation must be parametrized with the type of lock required (READ or WRITE), and the number of retries to acquire the lock before giving up. If a lock conflict occurs, one of the following scenarios will take place: If the retry value is equal to LockManager.waitTotalTimeout, then the thread which called setlock will be blocked until the lock is released, or the total timeout specified has elapsed, and in which REFUSED will be returned. If the lock cannot be obtained initially then LockManager will try for the specified number of retries, waiting for the specified timeout value between each failed attempt. The default is 100 attempts, each attempt being separated by a 0.25 seconds delay. The time between retries is specified in micro-seconds. If a lock conflict occurs the current implementation simply times out lock requests, thereby preventing deadlocks, rather than providing a full deadlock detection scheme. If the requested lock is obtained, the setlock operation will return the value GRANTED, otherwise the value REFUSED is returned. It is the responsibility of the programmer to ensure that the remainder of the code for an operation is only executed if a lock request is granted. Below are examples of the use of the setlock operation. Example 2.10. setlock Method Usage res = setlock(new Lock(WRITE), 10); // Will attempt to set a // write lock 11 times (10 // retries) on the object // before giving up. res = setlock(new Lock(READ), 0); // Will attempt to set a read // lock 1 time (no retries) on // the object before giving up. res = setlock(new Lock(WRITE); // Will attempt to set a write // lock 101 times (default of // 100 retries) on the object // before giving up.