Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Arthorne2009-03-09 20:21:22 +0000
committerJohn Arthorne2009-03-09 20:21:22 +0000
commit516b090efce052fe94ae66a4795fabf8f44a2491 (patch)
tree281eeab896a2d2cdaffd4aeef8691e143c43cd5b /bundles
parent6b6b04de49215fa9cca8e776366a6d6f7b67e2ab (diff)
downloadrt.equinox.p2-516b090efce052fe94ae66a4795fabf8f44a2491.tar.gz
rt.equinox.p2-516b090efce052fe94ae66a4795fabf8f44a2491.tar.xz
rt.equinox.p2-516b090efce052fe94ae66a4795fabf8f44a2491.zip
Added javadoc
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileLock.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileLock.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileLock.java
index 18de78c76..87ecd7dcb 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileLock.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileLock.java
@@ -49,6 +49,10 @@ public class ProfileLock {
}
}
+ /**
+ * Asserts that this thread currently holds the profile lock.
+ * @throws IllegalStateException If this thread does not currently hold the profile lock
+ */
public void checkLocked() {
synchronized (lock) {
if (lockHolder == null)
@@ -60,6 +64,17 @@ public class ProfileLock {
}
}
+ /**
+ * Attempts to obtain an exclusive write lock on a profile. The profile lock must be
+ * owned by any process and thread that wants to modify a profile. If the lock
+ * is currently held by another thread in this process, this method will block until
+ * the lock becomes available. If the lock is currently held by another process,
+ * this method returns <code>false</code>. Re-entrant attempts to acquire the
+ * same profile lock multiple times in the same thread is not allowed.
+ *
+ * @return <code>true</code> if the lock was successfully obtained by this thread,
+ * and <code>false</code> if another process is currently holding the lock.
+ */
public boolean lock() {
synchronized (lock) {
Thread current = Thread.currentThread();
@@ -94,6 +109,10 @@ public class ProfileLock {
}
}
+ /**
+ * Releases the exclusive write lock on a profile. This method must only be called
+ * by a thread that currently owns the lock.
+ */
public void unlock() {
synchronized (lock) {
if (lockHolder == null)
@@ -111,6 +130,12 @@ public class ProfileLock {
}
}
+ /**
+ * Returns whether a thread in this process currently holds the profile lock.
+ *
+ * @return <code>true</code> if a thread in this process owns the profile lock,
+ * and <code>false</code> otherwise
+ */
public boolean processHoldsLock() {
synchronized (lock) {
return lockHolder != null;

Back to the top