Repository: logging-log4j2
Updated Branches:
  refs/heads/AutoCloseableLock 319366277 -> 31c502365


Wrap the one remaining method in Lock for completness' sake.

Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/31c50236
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/31c50236
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/31c50236

Branch: refs/heads/AutoCloseableLock
Commit: 31c5023655c08fafb34492fabfa9156633487bcf
Parents: 3193662
Author: Gary Gregory <[email protected]>
Authored: Fri Jun 24 02:29:35 2016 -0700
Committer: Gary Gregory <[email protected]>
Committed: Fri Jun 24 02:29:35 2016 -0700

----------------------------------------------------------------------
 .../logging/log4j/util/AutoCloseableLock.java      | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/31c50236/log4j-api/src/main/java/org/apache/logging/log4j/util/AutoCloseableLock.java
----------------------------------------------------------------------
diff --git 
a/log4j-api/src/main/java/org/apache/logging/log4j/util/AutoCloseableLock.java 
b/log4j-api/src/main/java/org/apache/logging/log4j/util/AutoCloseableLock.java
index f3ba596..deb20ca 100644
--- 
a/log4j-api/src/main/java/org/apache/logging/log4j/util/AutoCloseableLock.java
+++ 
b/log4j-api/src/main/java/org/apache/logging/log4j/util/AutoCloseableLock.java
@@ -18,6 +18,7 @@ package org.apache.logging.log4j.util;
 
 import java.io.Serializable;
 import java.util.Objects;
+import java.util.concurrent.TimeUnit;
 import java.util.concurrent.locks.Condition;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
@@ -87,10 +88,24 @@ public final class AutoCloseableLock implements 
AutoCloseable, Serializable {
     }
 
     /**
+     * Delegates to {@link Lock#tryLock()}, do NOT use in a try block.
+     * 
+     * @param time
+     *            See {@link Lock#tryLock()}.
+     * @param unit
+     *            See {@link Lock#tryLock()}.
+     * @return See {@link Lock#tryLock()}.
+     * @throws InterruptedException
+     */
+    public boolean tryLock(long time, TimeUnit unit) throws 
InterruptedException {
+        return this.lock.tryLock(time, unit);
+    }
+
+    /**
      * Delegates to {@link Lock#lockInterruptibly()}, use in a try block.
      * 
      * @return this
-     * @throws InterruptedException 
+     * @throws InterruptedException
      */
     public AutoCloseableLock lockInterruptibly() throws InterruptedException {
         this.lock.lockInterruptibly();

Reply via email to