accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject [accumulo] 02/03: ACCUMULO-4774 Use lambda for ConditionalWriter's ThreadFactory
Date Fri, 22 Dec 2017 05:30:03 GMT
This is an automated email from the ASF dual-hosted git repository.

ctubbsii pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/accumulo.git

commit 15b00dff60782579e5a7febc90cbabb80e3b7b9a
Author: Christopher Tubbs <ctubbsii@apache.org>
AuthorDate: Fri Dec 22 00:17:47 2017 -0500

    ACCUMULO-4774 Use lambda for ConditionalWriter's ThreadFactory
---
 .../core/client/impl/ConditionalWriterImpl.java    | 22 +++++++---------------
 1 file changed, 7 insertions(+), 15 deletions(-)

diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/ConditionalWriterImpl.java
b/core/src/main/java/org/apache/accumulo/core/client/impl/ConditionalWriterImpl.java
index dbefc28..22d8a1b 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/ConditionalWriterImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ConditionalWriterImpl.java
@@ -37,7 +37,6 @@ import java.util.concurrent.DelayQueue;
 import java.util.concurrent.Delayed;
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.ScheduledThreadPoolExecutor;
-import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
 
@@ -97,18 +96,11 @@ import org.slf4j.LoggerFactory;
 
 class ConditionalWriterImpl implements ConditionalWriter {
 
-  private static class CleanupThreadFactory implements ThreadFactory {
-
-    @Override
-    public Thread newThread(Runnable r) {
-      Thread t = new Thread(r, "Conditional Writer Cleanup Thread ");
-      t.setDaemon(true);
-      return t;
-    }
-  }
-
-  private static ThreadPoolExecutor cleanupThreadPool = new ThreadPoolExecutor(1, 1, 3, TimeUnit.SECONDS,
new LinkedBlockingQueue<Runnable>(),
-      new CleanupThreadFactory());
+  private static ThreadPoolExecutor cleanupThreadPool = new ThreadPoolExecutor(1, 1, 3, TimeUnit.SECONDS,
new LinkedBlockingQueue<Runnable>(), r -> {
+    Thread t = new Thread(r, "Conditional Writer Cleanup Thread");
+    t.setDaemon(true);
+    return t;
+  });
 
   static {
     cleanupThreadPool.allowCoreThreadTimeOut(true);
@@ -627,8 +619,8 @@ class ConditionalWriterImpl implements ConditionalWriter {
       queueRetry(ignored, location);
 
     } catch (ThriftSecurityException tse) {
-      AccumuloSecurityException ase = new AccumuloSecurityException(context.getCredentials().getPrincipal(),
tse.getCode(), Tables.getPrintableTableInfoFromId(
-          context.getInstance(), tableId), tse);
+      AccumuloSecurityException ase = new AccumuloSecurityException(context.getCredentials().getPrincipal(),
tse.getCode(),
+          Tables.getPrintableTableInfoFromId(context.getInstance(), tableId), tse);
       queueException(location, cmidToCm, ase);
     } catch (TTransportException e) {
       locator.invalidateCache(context.getInstance(), location.toString());

-- 
To stop receiving notification emails like this one, please contact
"commits@accumulo.apache.org" <commits@accumulo.apache.org>.

Mime
View raw message