File: Lock.java

package info (click to toggle)
libglazedlists-java 1.9.1-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 3,012 kB
  • sloc: java: 22,561; xml: 940; makefile: 5
file content (35 lines) | stat: -rw-r--r-- 1,213 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* Glazed Lists                                                 (c) 2003-2006 */
/* http://publicobject.com/glazedlists/                      publicobject.com,*/
/*                                                     O'Dell Engineering Ltd.*/
package ca.odell.glazedlists.util.concurrent;

/**
 * A lock is a tool for controlling access to a shared resource by multiple threads.
 *
 * <p>This interface is a back-port of the {@link java.util.concurrent.locks.Lock}
 * class that first appeared in J2SE 1.5. Due to a requirement for sophisticated
 * concurrency, this interface has been back-ported for use in J2SE 1.4 (and greater).
 * It shares similar method signatures to be consistent with the J2SE 1.5 API.
 *
 * @see java.util.concurrent.locks.Lock
 * @see <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/locks/Lock.html">Lock</a>
 *
 * @author <a href="mailto:jesse@swank.ca">Jesse Wilson</a>
 */
public interface Lock {

    /**
     * Acquires the lock.
     */
    public void lock();
    
    /**
     * Acquires the lock only if it is free at the time of invocation.
     */
    public boolean tryLock();
    
    /**
     * Releases the lock.
     */
    public void unlock();
}