blob: 5ba2386e622f8db3ca1cba853e68c2e411855bbe (
plain) (
blame)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
/**
* Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Simon McDuff - initial API and implementation
* Eike Stepper - maintenance
*/
package org.eclipse.emf.cdo;
import org.eclipse.emf.cdo.view.CDOView;
import org.eclipse.net4j.util.concurrent.IRWLockManager.LockType;
import org.eclipse.net4j.util.concurrent.RWLockManager;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.locks.Lock;
/**
* A read or write lock on an {@link CDOObject object} as returned by {@link CDOObject#cdoReadLock()} or
* {@link CDOObject#cdoWriteLock()}.
*
* @author Simon McDuff
* @since 2.0
* @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface CDOLock extends Lock
{
/**
* TODO Simon: JavaDoc
*/
public static final int WAIT = RWLockManager.WAIT;
/**
* TODO Simon: JavaDoc
*/
public static final int NO_WAIT = RWLockManager.NO_WAIT;
/**
* TODO Simon: JavaDoc
*
* @since 3.0
*/
public LockType getType();
/**
* @since 4.0
*/
public void lock(long time, TimeUnit unit) throws TimeoutException;
/**
* @since 4.0
*/
public void lock(long millis) throws TimeoutException;
/**
* @since 4.0
*/
public boolean tryLock(long millis) throws InterruptedException;
/**
* Returns <code>true</code> if this lock is currently held by the requesting {@link CDOView view}, <code>false</code>
* otherwise.
*/
public boolean isLocked();
/**
* Returns <code>true</code> if this lock is currently held by another {@link CDOView view} (i.e. any view different
* from the requesting one), <code>false</code> otherwise.
*/
public boolean isLockedByOthers();
}
|