|
|||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
LockStrategy.java | - | - | - | - |
|
1 | /* | |
2 | * JBoss, the OpenSource J2EE webOS | |
3 | * | |
4 | * Distributable under LGPL license. | |
5 | * See terms of license at gnu.org. | |
6 | */ | |
7 | package org.jboss.cache.lock; | |
8 | ||
9 | import java.util.concurrent.locks.Lock; | |
10 | ||
11 | /** | |
12 | * Interface to specify lock strategy, e.g., for different isolation levels. | |
13 | * | |
14 | * @author Ben Wang | |
15 | */ | |
16 | public interface LockStrategy | |
17 | { | |
18 | /** | |
19 | * Return a read lock object. | |
20 | */ | |
21 | Lock readLock(); | |
22 | ||
23 | ||
24 | /** | |
25 | * Return a write lock object. | |
26 | */ | |
27 | Lock writeLock(); | |
28 | ||
29 | /** | |
30 | * Attempt to upgrade the current read lock to write lock with | |
31 | * <code>msecs</code> timeout. | |
32 | * | |
33 | * @param msecs Timeout in milliseconds. | |
34 | * @return Lock object. Will return null if timeout or failed. | |
35 | */ | |
36 | Lock upgradeLockAttempt(long msecs) throws UpgradeException; | |
37 | } |
|