Skip to content
Browse files

clean up formatting

  • Loading branch information...
1 parent 4fb3417 commit 5899a9412ebc06314ea3c1d6525e537cf65f43ab @jdf committed Feb 17, 2010
Showing with 7 additions and 8 deletions.
  1. +7 −8 src/jdf/EquivalenceLock.java
View
15 src/jdf/EquivalenceLock.java
@@ -24,7 +24,8 @@
* Synchronize "on an equivalence class"; i.e., if you wish to lock not a
* specific string, but anything that equals that string, you may
*
- * <pre>equivalenceLock.lock("frank");
+ * <pre>EquivalenceLock<String> equivalenceLock = new EquivalenceLock<String>();
+equivalenceLock.lock("frank");
try {
// whatever
} finally {
@@ -42,26 +43,24 @@
public void lock(final T ticket) throws InterruptedException
{
+ final String threadName = DEBUG ? Thread.currentThread().getName() : null;
if (DEBUG)
- LOG.finest(Thread.currentThread().getName() + " acquiring lock on tickets");
+ LOG.finest(threadName + " acquiring lock on tickets");
synchronized (slots)
{
if (DEBUG)
- LOG
- .finest(Thread.currentThread().getName()
- + " acquired lock on tickets");
+ LOG.finest(threadName + " acquired lock on tickets");
while (slots.contains(ticket))
{
if (DEBUG)
- LOG.finest(Thread.currentThread().getName() + " waiting to toss "
- + ticket);
+ LOG.finest(threadName + " waiting to toss " + ticket);
slots.wait();
}
if (DEBUG)
- LOG.finest(Thread.currentThread().getName() + " accepting " + ticket);
+ LOG.finest(threadName + " accepting " + ticket);
slots.add(ticket);
}
}

0 comments on commit 5899a94

Please sign in to comment.
Something went wrong with that request. Please try again.