This is an automated email from the ASF dual-hosted git repository.

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

commit 5d07cdb66a368ffa8f306be08dcf2d12972c4906
Author: Keith Turner <ktur...@apache.org>
AuthorDate: Wed Feb 14 22:29:39 2018 -0500

    made modernizer happy
---
 .../accumulo/core/client/impl/ClientContext.java      | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git 
a/core/src/main/java/org/apache/accumulo/core/client/impl/ClientContext.java 
b/core/src/main/java/org/apache/accumulo/core/client/impl/ClientContext.java
index 1fec4a3..49c5750 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/ClientContext.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ClientContext.java
@@ -24,6 +24,7 @@ import java.util.Iterator;
 import java.util.Map;
 import java.util.concurrent.TimeUnit;
 import java.util.function.Predicate;
+import java.util.function.Supplier;
 
 import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
@@ -42,7 +43,6 @@ import org.apache.accumulo.core.security.thrift.TCredentials;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.base.Supplier;
 import com.google.common.base.Suppliers;
 
 /**
@@ -68,6 +68,11 @@ public class ClientContext {
   private Supplier<SslConnectionParams> sslSupplier;
   private TCredentials rpcCreds;
 
+  private static <T> Supplier<T> memoizeWithExpiration(Supplier<T> s) {
+    //This insanity exists to make modernizer plugin happy.  We are living in 
the future now.
+    return () -> Suppliers.memoizeWithExpiration(() -> s.get(), 100, 
TimeUnit.MILLISECONDS).get();
+  }
+
   /**
    * Instantiate a client context
    */
@@ -90,10 +95,6 @@ public class ClientContext {
     rpcConf = requireNonNull(serverConf, "serverConf is null");
     clientConf = null;
 
-    timeoutSupplier = () -> 
getConfiguration().getTimeInMillis(Property.GENERAL_RPC_TIMEOUT);
-
-    sslSupplier = () -> SslConnectionParams.forClient(getConfiguration());
-
     saslSupplier = new Supplier<SaslConnectionParams>() {
       @Override
       public SaslConnectionParams get() {
@@ -111,10 +112,10 @@ public class ClientContext {
         return new SaslConnectionParams(conf, getCredentials().getToken());
       }
     };
-    
-    timeoutSupplier = Suppliers.memoizeWithExpiration(timeoutSupplier, 100, 
TimeUnit.MILLISECONDS);
-    sslSupplier = Suppliers.memoizeWithExpiration(sslSupplier, 100, 
TimeUnit.MILLISECONDS);
-    saslSupplier = Suppliers.memoizeWithExpiration(saslSupplier, 100, 
TimeUnit.MILLISECONDS);
+
+    timeoutSupplier = memoizeWithExpiration(() -> 
getConfiguration().getTimeInMillis(Property.GENERAL_RPC_TIMEOUT));
+    sslSupplier = memoizeWithExpiration(() -> 
SslConnectionParams.forClient(getConfiguration()));
+    saslSupplier = memoizeWithExpiration(saslSupplier);
 
   }
 

-- 
To stop receiving notification emails like this one, please contact
ktur...@apache.org.

Reply via email to