summaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/common/util/locks
diff options
context:
space:
mode:
authorHarvey Harrison <[email protected]>2013-10-17 21:06:56 -0700
committerHarvey Harrison <[email protected]>2013-10-17 21:06:56 -0700
commit791a2749886f02ec7b8db25bf8862e8269b96da5 (patch)
treec9be31d0bbbe8033b4a6a0cfad91a22b6575ced1 /src/java/com/jogamp/common/util/locks
parent5b77e15500b7b19d35976603dd71e8b997b2d8ea (diff)
gluegen: remove trailing whitespace
Signed-off-by: Harvey Harrison <[email protected]>
Diffstat (limited to 'src/java/com/jogamp/common/util/locks')
-rw-r--r--src/java/com/jogamp/common/util/locks/Lock.java6
-rw-r--r--src/java/com/jogamp/common/util/locks/LockFactory.java14
-rw-r--r--src/java/com/jogamp/common/util/locks/RecursiveLock.java2
-rw-r--r--src/java/com/jogamp/common/util/locks/RecursiveThreadGroupLock.java66
-rw-r--r--src/java/com/jogamp/common/util/locks/SingletonInstance.java20
-rw-r--r--src/java/com/jogamp/common/util/locks/ThreadLock.java14
6 files changed, 61 insertions, 61 deletions
diff --git a/src/java/com/jogamp/common/util/locks/Lock.java b/src/java/com/jogamp/common/util/locks/Lock.java
index df645ed..5130876 100644
--- a/src/java/com/jogamp/common/util/locks/Lock.java
+++ b/src/java/com/jogamp/common/util/locks/Lock.java
@@ -43,8 +43,8 @@ public interface Lock {
/** The default {@link #TIMEOUT} value, of {@value} ms */
public static final long DEFAULT_TIMEOUT = 5000; // 5s default timeout
-
- /**
+
+ /**
* The <code>TIMEOUT</code> for {@link #lock()} in ms,
* defaults to {@link #DEFAULT_TIMEOUT}.
* <p>
@@ -78,7 +78,7 @@ public interface Lock {
* @throws RuntimeException in case the lock is not acquired by this thread.
*/
void unlock() throws RuntimeException;
-
+
/** Query if locked */
boolean isLocked();
}
diff --git a/src/java/com/jogamp/common/util/locks/LockFactory.java b/src/java/com/jogamp/common/util/locks/LockFactory.java
index bb2d5f4..e1ec2d7 100644
--- a/src/java/com/jogamp/common/util/locks/LockFactory.java
+++ b/src/java/com/jogamp/common/util/locks/LockFactory.java
@@ -35,25 +35,25 @@ import jogamp.common.util.locks.RecursiveThreadGroupLockImpl01Unfairish;
public class LockFactory {
public enum ImplType {
- Int01(0), Java5(1), Int02ThreadGroup(2);
-
+ Int01(0), Java5(1), Int02ThreadGroup(2);
+
public final int id;
ImplType(int id){
this.id = id;
}
- }
-
+ }
+
/** default is ImplType.Int01, unfair'ish (fastest w/ least deviation) */
public static RecursiveLock createRecursiveLock() {
return new RecursiveLockImpl01Unfairish();
}
-
+
/** default is ImplType.Int02ThreadGroup, unfair'ish (fastest w/ least deviation) */
public static RecursiveThreadGroupLock createRecursiveThreadGroupLock() {
return new RecursiveThreadGroupLockImpl01Unfairish();
}
-
+
public static RecursiveLock createRecursiveLock(ImplType t, boolean fair) {
switch(t) {
case Int01:
@@ -65,5 +65,5 @@ public class LockFactory {
}
throw new InternalError("XXX");
}
-
+
}
diff --git a/src/java/com/jogamp/common/util/locks/RecursiveLock.java b/src/java/com/jogamp/common/util/locks/RecursiveLock.java
index 3e0a873..c56a5ef 100644
--- a/src/java/com/jogamp/common/util/locks/RecursiveLock.java
+++ b/src/java/com/jogamp/common/util/locks/RecursiveLock.java
@@ -32,7 +32,7 @@ package com.jogamp.common.util.locks;
* Reentrance capable locking toolkit.
*/
public interface RecursiveLock extends ThreadLock {
- /**
+ /**
* Return the number of locks issued to this lock by the same thread.
* <ul>
* <li>A hold count of 0 identifies this lock as unlocked.</li>
diff --git a/src/java/com/jogamp/common/util/locks/RecursiveThreadGroupLock.java b/src/java/com/jogamp/common/util/locks/RecursiveThreadGroupLock.java
index 626199f..a23c320 100644
--- a/src/java/com/jogamp/common/util/locks/RecursiveThreadGroupLock.java
+++ b/src/java/com/jogamp/common/util/locks/RecursiveThreadGroupLock.java
@@ -34,67 +34,67 @@ package com.jogamp.common.util.locks;
* </p>
*/
public interface RecursiveThreadGroupLock extends RecursiveLock {
- /**
- * Returns true if the current thread is the original lock owner, ie.
+ /**
+ * Returns true if the current thread is the original lock owner, ie.
* successfully claimed this lock the first time, ie. {@link #getHoldCount()} == 1.
*/
boolean isOriginalOwner();
-
- /**
- * Returns true if the passed thread is the original lock owner, ie.
+
+ /**
+ * Returns true if the passed thread is the original lock owner, ie.
* successfully claimed this lock the first time, ie. {@link #getHoldCount()} == 1.
*/
boolean isOriginalOwner(Thread thread);
-
- /**
+
+ /**
* Add a thread to the list of additional lock owners, which enables them to recursively claim this lock.
* <p>
* The caller must hold this lock and be the original lock owner, see {@link #isOriginalOwner()}.
* </p>
* <p>
- * If the original owner releases this lock via {@link #unlock()}
+ * If the original owner releases this lock via {@link #unlock()}
* all additional lock owners are released as well.
* This ensures consistency of spawn off additional lock owner threads and it's release.
- * </p>
+ * </p>
* Use case:
* <pre>
* Thread2 thread2 = new Thread2();
- *
+ *
* Thread1 {
- *
+ *
* // Claim this lock and become the original lock owner.
* lock.lock();
- *
+ *
* try {
- *
+ *
* // Allow Thread2 to claim the lock, ie. make thread2 an additional lock owner
* addOwner(thread2);
- *
+ *
* // Start thread2
* thread2.start();
- *
+ *
* // Wait until thread2 has finished requiring this lock, but keep thread2 running
- * while(!thread2.waitForResult()) sleep();
- *
+ * while(!thread2.waitForResult()) sleep();
+ *
* // Optional: Only if sure that this thread doesn't hold the lock anymore,
- * // otherwise just release the lock via unlock().
+ * // otherwise just release the lock via unlock().
* removeOwner(thread2);
- *
+ *
* } finally {
- *
+ *
* // Release this lock and remove all additional lock owners.
* // Implicit wait until thread2 gets off the lock.
* lock.unlock();
- *
+ *
* }
- *
+ *
* }.start();
* </pre>
- *
- * @param t the thread to be added to the list of additional owning threads
+ *
+ * @param t the thread to be added to the list of additional owning threads
* @throws RuntimeException if the current thread does not hold the lock.
* @throws IllegalArgumentException if the passed thread is the lock owner or already added.
- *
+ *
* @see #removeOwner(Thread)
* @see #unlock()
* @see #lock()
@@ -109,31 +109,31 @@ public interface RecursiveThreadGroupLock extends RecursiveLock {
* <p>
* Only use this method if sure that the thread doesn't hold the lock anymore.
* </p>
- *
- * @param t the thread to be removed from the list of additional owning threads
+ *
+ * @param t the thread to be removed from the list of additional owning threads
* @throws RuntimeException if the current thread does not hold the lock.
* @throws IllegalArgumentException if the passed thread is not added by {@link #addOwner(Thread)}
*/
void removeOwner(Thread t) throws RuntimeException, IllegalArgumentException;
-
+
/**
* <p>
* Wait's until all additional owners released this lock before releasing it.
* </p>
- *
+ *
* {@inheritDoc}
*/
@Override
void unlock() throws RuntimeException;
-
+
/**
* <p>
* Wait's until all additional owners released this lock before releasing it.
* </p>
- *
+ *
* {@inheritDoc}
*/
@Override
- void unlock(Runnable taskAfterUnlockBeforeNotify);
-
+ void unlock(Runnable taskAfterUnlockBeforeNotify);
+
}
diff --git a/src/java/com/jogamp/common/util/locks/SingletonInstance.java b/src/java/com/jogamp/common/util/locks/SingletonInstance.java
index 825098d..f016d4b 100644
--- a/src/java/com/jogamp/common/util/locks/SingletonInstance.java
+++ b/src/java/com/jogamp/common/util/locks/SingletonInstance.java
@@ -44,7 +44,7 @@ public abstract class SingletonInstance implements Lock {
public static SingletonInstance createFileLock(long poll_ms, File lockFile) {
return new SingletonInstanceFileLock(poll_ms, lockFile);
}
-
+
/**
* A user shall use <b>ephemeral ports</b>:
* <ul>
@@ -54,23 +54,23 @@ public abstract class SingletonInstance implements Lock {
* <li>FreeBSD < 4.6 and BSD use ports 1024 through 4999.</li>
* <li>Microsoft Windows operating systems through Server 2003 use the range 1025 to 5000</li>
* <li>Windows Vista, Windows 7, and Server 2008 use the IANA range.</li>
- * </ul>
+ * </ul>
* @param pollPeriod
- * @param portNumber to be used for this single instance server socket.
+ * @param portNumber to be used for this single instance server socket.
*/
public static SingletonInstance createServerSocket(long poll_ms, int portNumber) {
return new SingletonInstanceServerSocket(poll_ms, portNumber);
}
-
+
protected SingletonInstance(long poll_ms) {
this.poll_ms = Math.max(10, poll_ms);
}
-
+
public final long getPollPeriod() { return poll_ms; }
public abstract String getName();
@Override
public final String toString() { return getName(); }
-
+
@Override
public synchronized void lock() throws RuntimeException {
try {
@@ -99,7 +99,7 @@ public abstract class SingletonInstance implements Lock {
if( DEBUG ) {
final long t2 = System.currentTimeMillis();
System.err.println(infoPrefix(t2)+" +++ "+getName()+" - Locked within "+(t2-t0)+" ms, "+(i+1)+" attempts");
- }
+ }
return true;
}
if( DEBUG && 0==i ) {
@@ -118,9 +118,9 @@ public abstract class SingletonInstance implements Lock {
System.err.println(infoPrefix(t2)+" +++ EEE (2) "+getName()+" - couldn't get lock within "+(t2-t0)+" ms, "+i+" attempts");
}
return false;
- }
+ }
protected abstract boolean tryLockImpl();
-
+
@Override
public void unlock() throws RuntimeException {
final long t0 = System.currentTimeMillis();
@@ -145,7 +145,7 @@ public abstract class SingletonInstance implements Lock {
protected String infoPrefix() {
return infoPrefix(System.currentTimeMillis());
}
-
+
private final long poll_ms;
private boolean locked = false;
}
diff --git a/src/java/com/jogamp/common/util/locks/ThreadLock.java b/src/java/com/jogamp/common/util/locks/ThreadLock.java
index 65260bc..26e7475 100644
--- a/src/java/com/jogamp/common/util/locks/ThreadLock.java
+++ b/src/java/com/jogamp/common/util/locks/ThreadLock.java
@@ -33,27 +33,27 @@ package com.jogamp.common.util.locks;
*/
public interface ThreadLock extends Lock {
- /** Query whether the lock is hold by the a thread other than the current thread. */
+ /** Query whether the lock is hold by the a thread other than the current thread. */
boolean isLockedByOtherThread();
- /** Query whether the lock is hold by the given thread. */
+ /** Query whether the lock is hold by the given thread. */
boolean isOwner(Thread thread);
-
+
/**
* @return the Thread owning this lock if locked, otherwise null
*/
Thread getOwner();
/**
- * @throws RuntimeException if current thread does not hold the lock
+ * @throws RuntimeException if current thread does not hold the lock
*/
void validateLocked() throws RuntimeException;
-
+
/**
* Execute the {@link Runnable Runnable taskAfterUnlockBeforeNotify} while holding the exclusive lock.
* <p>
* Then release the lock.
- * </p>
+ * </p>
*/
- void unlock(Runnable taskAfterUnlockBeforeNotify);
+ void unlock(Runnable taskAfterUnlockBeforeNotify);
}