Madan Jampani

Fixed javadoc comments for Lock.

...@@ -24,7 +24,7 @@ public interface Lock { ...@@ -24,7 +24,7 @@ public interface Lock {
24 * @param leaseDurationMillis the number of milliseconds to hold the 24 * @param leaseDurationMillis the number of milliseconds to hold the
25 * lock after granting it, before automatically releasing it if it hasn't 25 * lock after granting it, before automatically releasing it if it hasn't
26 * already been released by invoking unlock(). Must be in the range 26 * already been released by invoking unlock(). Must be in the range
27 - * (0, MAX_LEASE_MILLIS] 27 + * (0, LockManager.MAX_LEASE_MILLIS]
28 */ 28 */
29 void lock(long leaseDurationMillis); 29 void lock(long leaseDurationMillis);
30 30
...@@ -33,7 +33,7 @@ public interface Lock { ...@@ -33,7 +33,7 @@ public interface Lock {
33 * @param leaseDurationMillis the number of milliseconds the must be 33 * @param leaseDurationMillis the number of milliseconds the must be
34 * locked after it is granted, before automatically releasing it if it hasn't 34 * locked after it is granted, before automatically releasing it if it hasn't
35 * already been released by an invocation of unlock(). Must be in the range 35 * already been released by an invocation of unlock(). Must be in the range
36 - * (0, MAX_LEASE_MILLIS] 36 + * (0, LockManager.MAX_LEASE_MILLIS]
37 * @return true if the lock was acquired and false otherwise 37 * @return true if the lock was acquired and false otherwise
38 */ 38 */
39 boolean tryLock(long leaseDurationMillis); 39 boolean tryLock(long leaseDurationMillis);
...@@ -45,7 +45,7 @@ public interface Lock { ...@@ -45,7 +45,7 @@ public interface Lock {
45 * @param leaseDurationMillis the number of milliseconds to hold the 45 * @param leaseDurationMillis the number of milliseconds to hold the
46 * lock after granting it, before automatically releasing it if it hasn't 46 * lock after granting it, before automatically releasing it if it hasn't
47 * already been released by invoking unlock(Object). Must be in the range 47 * already been released by invoking unlock(Object). Must be in the range
48 - * (0, MAX_LEASE_MILLIS] 48 + * (0, LockManager.MAX_LEASE_MILLIS]
49 * @return true if the lock was acquired and false if the waiting time 49 * @return true if the lock was acquired and false if the waiting time
50 * elapsed before the lock was acquired 50 * elapsed before the lock was acquired
51 */ 51 */
...@@ -63,16 +63,14 @@ public interface Lock { ...@@ -63,16 +63,14 @@ public interface Lock {
63 void unlock(); 63 void unlock();
64 64
65 /** 65 /**
66 - * Extends the lease for this lock. 66 + * Extends the expiration time for a lock that is currently owned
67 - * @param extensionDurationMillis is the amount of additional 67 + * by a specified duration. The new expiration time is computed
68 - * time to add to the end of the current expiration time. For example, 68 + * by adding the specified duration to the current time. If this point
69 - * if the lock is currently set to expire at time T, a successful call to 69 + * in time is earlier than the existing expiration time then this method
70 - * extendLease with an argument of 5000 will cause the lock to 70 + * has no effect.
71 - * now expire at 5 seconds past T. 71 + * @param leaseDurationMillis extension duration.
72 - * @return true if the extension is successful, false otherwise. Note 72 + * @return true if successfully extended expiration, false if attempt to
73 - * that a failure to extend the lease does not result in unlocking. The lock 73 + * extend expiration fails or if the path is currently not locked by this instance.
74 - * will be released either by an explicit call to unlock or when previously
75 - * acquired lease runs out.
76 */ 74 */
77 - boolean extendLease(long extensionDurationMillis); 75 + boolean extendExpiration(long leaseDurationMillis);
78 } 76 }
...\ No newline at end of file ...\ No newline at end of file
......
1 package org.onlab.onos.store.service; 1 package org.onlab.onos.store.service;
2 2
3 +/**
4 + * Service interface for mutual exclusion primitives.
5 + */
3 public interface LockService { 6 public interface LockService {
4 7
5 /** 8 /**
6 - * Create a new lock instance. 9 + * Creates a new lock instance.
7 * A successful return from this method does not mean the resource guarded by the path is locked. 10 * A successful return from this method does not mean the resource guarded by the path is locked.
8 - * The caller is expect to call Lock.lock() to acquire the lock. 11 + * The caller is expected to call Lock.lock() to acquire the lock.
9 * @param path unique lock name. 12 * @param path unique lock name.
10 - * @return 13 + * @return a Lock instance that can be used to acquire the lock.
11 */ 14 */
12 Lock create(String path); 15 Lock create(String path);
13 16
......