accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmar...@apache.org
Subject [accumulo] branch master updated: Lambdas replaced with method references. (#1602)
Date Wed, 29 Apr 2020 13:51:03 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
     new 15a95fe  Lambdas replaced with method references. (#1602)
15a95fe is described below

commit 15a95feebc74bd10e5ba73d4c2ecfc726435bc55
Author: Mark Owens <jmark99@apache.org>
AuthorDate: Wed Apr 29 09:50:53 2020 -0400

    Lambdas replaced with method references. (#1602)
    
    This ticket updates instances of lambdas which can be replaced with method references.
There was also one instance of an anonymous type being replaced with a method reference.
    
    One instance was not changed due to possible subtle differences in the way in which constructor
method references can behave. See the notes from PR #1602 if interested in details.
---
 .../accumulo/core/client/rfile/RFileSummariesRetriever.java   |  2 +-
 .../org/apache/accumulo/core/clientImpl/bulk/BulkImport.java  |  2 +-
 .../apache/accumulo/core/conf/HadoopCredentialProvider.java   | 11 ++++++-----
 .../main/java/org/apache/accumulo/core/trace/TraceUtil.java   |  6 ++----
 .../org/apache/accumulo/fate/zookeeper/ZooCacheFactory.java   |  2 +-
 .../java/org/apache/accumulo/core/conf/PropertyTypeTest.java  |  3 ++-
 .../accumulo/hadoopImpl/mapreduce/lib/InputConfigurator.java  |  2 +-
 .../accumulo/hadoop/mapred/MultiTableInputFormatTest.java     |  2 +-
 .../accumulo/hadoop/mapreduce/MultiTableInputFormatTest.java  |  2 +-
 .../org/apache/accumulo/server/master/LiveTServerSet.java     |  7 +------
 .../server/master/balancer/HostRegexTableLoadBalancer.java    |  5 +++--
 .../java/org/apache/accumulo/server/util/TableDiskUsage.java  |  2 +-
 .../apache/accumulo/server/fs/PerTableVolumeChooserTest.java  |  4 ++--
 .../apache/accumulo/server/fs/PreferredVolumeChooserTest.java |  6 +++---
 .../src/main/java/org/apache/accumulo/master/Master.java      |  2 +-
 .../accumulo/master/tableOps/bulkVer2/BulkImportMove.java     |  2 +-
 .../apache/accumulo/master/tableOps/bulkVer2/LoadFiles.java   |  4 ++--
 .../accumulo/master/tableOps/bulkVer2/PrepBulkImport.java     |  6 +++---
 .../main/java/org/apache/accumulo/tracer/TraceFormatter.java  |  2 +-
 .../src/main/java/org/apache/accumulo/tracer/TraceServer.java |  4 ++--
 .../main/java/org/apache/accumulo/tserver/TabletServer.java   |  3 +--
 .../apache/accumulo/tserver/TabletServerResourceManager.java  |  6 +++---
 .../java/org/apache/accumulo/tserver/ThriftClientHandler.java |  2 +-
 .../strategies/TooManyDeletesCompactionStrategy.java          |  2 +-
 .../main/java/org/apache/accumulo/tserver/tablet/Tablet.java  |  2 +-
 .../org/apache/accumulo/test/functional/AccumuloClientIT.java | 10 +++++-----
 .../test/gc/replication/CloseWriteAheadLogReferencesIT.java   |  2 +-
 .../org/apache/accumulo/test/replication/ReplicationIT.java   |  8 ++++----
 .../apache/accumulo/test/rpc/SimpleThriftServiceRunner.java   |  2 +-
 29 files changed, 54 insertions(+), 59 deletions(-)

diff --git a/core/src/main/java/org/apache/accumulo/core/client/rfile/RFileSummariesRetriever.java
b/core/src/main/java/org/apache/accumulo/core/client/rfile/RFileSummariesRetriever.java
index 9deb52c..8dbb7a1 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/rfile/RFileSummariesRetriever.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/rfile/RFileSummariesRetriever.java
@@ -87,7 +87,7 @@ class RFileSummariesRetriever implements SummaryInputArguments, SummaryFSOptions
   public Collection<Summary> read() throws IOException {
     SummarizerFactory factory = new SummarizerFactory();
     ConfigurationCopy acuconf = new ConfigurationCopy(DefaultConfiguration.getInstance());
-    config.forEach((k, v) -> acuconf.set(k, v));
+    config.forEach(acuconf::set);
 
     RFileSource[] sources = in.getSources();
     try {
diff --git a/core/src/main/java/org/apache/accumulo/core/clientImpl/bulk/BulkImport.java b/core/src/main/java/org/apache/accumulo/core/clientImpl/bulk/BulkImport.java
index 614b21c..ebc3a3d 100644
--- a/core/src/main/java/org/apache/accumulo/core/clientImpl/bulk/BulkImport.java
+++ b/core/src/main/java/org/apache/accumulo/core/clientImpl/bulk/BulkImport.java
@@ -408,7 +408,7 @@ public class BulkImport implements ImportDestinationArguments, ImportMappingOpti
     // leverages read ahead.
     fileDestinations.values().stream().flatMap(List::stream)
         .filter(dest -> dest.getRangeType() == RangeType.FILE)
-        .flatMap(dest -> Stream.of(dest.getStartRow(), dest.getEndRow())).filter(row ->
row != null)
+        .flatMap(dest -> Stream.of(dest.getStartRow(), dest.getEndRow())).filter(Objects::nonNull)
         .map(Text::new).sorted().distinct().forEach(row -> {
           try {
             extentCache.lookup(row);
diff --git a/core/src/main/java/org/apache/accumulo/core/conf/HadoopCredentialProvider.java
b/core/src/main/java/org/apache/accumulo/core/conf/HadoopCredentialProvider.java
index 3dfd3e1..b0e0092 100644
--- a/core/src/main/java/org/apache/accumulo/core/conf/HadoopCredentialProvider.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/HadoopCredentialProvider.java
@@ -99,11 +99,12 @@ public class HadoopCredentialProvider {
         log.warn("Failed to call getCredentialEntry(alias) for provider {}", provider, e);
         return null;
       }
-    }).filter(Objects::nonNull).map(entry -> entry.getCredential()).findFirst().orElseGet(()
-> {
-      // If we didn't find it, this isn't an error, it just wasn't set in the CredentialProvider
-      log.trace("Could not extract credential for {} from providers", alias);
-      return null;
-    });
+    }).filter(Objects::nonNull).map(CredentialProvider.CredentialEntry::getCredential).findFirst()
+        .orElseGet(() -> {
+          // If we didn't find it, this isn't an error, it just wasn't set in the CredentialProvider
+          log.trace("Could not extract credential for {} from providers", alias);
+          return null;
+        });
   }
 
   /**
diff --git a/core/src/main/java/org/apache/accumulo/core/trace/TraceUtil.java b/core/src/main/java/org/apache/accumulo/core/trace/TraceUtil.java
index a262f04..b1317dd 100644
--- a/core/src/main/java/org/apache/accumulo/core/trace/TraceUtil.java
+++ b/core/src/main/java/org/apache/accumulo/core/trace/TraceUtil.java
@@ -104,7 +104,7 @@ public class TraceUtil {
     Map<String,
         String> htraceConfigProps = spanReceiverProps.entrySet().stream().collect(Collectors.toMap(
             k -> String.valueOf(k).substring(Property.TRACE_SPAN_RECEIVER_PREFIX.getKey().length()),
-            v -> String.valueOf(v), (a, b) -> {
+            String::valueOf, (a, b) -> {
               throw new AssertionError("duplicate can't happen");
             }, HashMap::new));
     htraceConfigProps.put(TRACER_ZK_HOST, zookeepers);
@@ -116,9 +116,7 @@ public class TraceUtil {
     if (service != null) {
       htraceConfigProps.put(TRACE_SERVICE_PROPERTY, service);
     }
-    ShutdownHookManager.get().addShutdownHook(() -> {
-      disable();
-    }, 0);
+    ShutdownHookManager.get().addShutdownHook(TraceUtil::disable, 0);
     synchronized (receivers) {
       if (!receivers.isEmpty()) {
         log.info("Already loaded span receivers, enable tracing does not need to be called
again");
diff --git a/core/src/main/java/org/apache/accumulo/fate/zookeeper/ZooCacheFactory.java b/core/src/main/java/org/apache/accumulo/fate/zookeeper/ZooCacheFactory.java
index 08d4a2f..867df86 100644
--- a/core/src/main/java/org/apache/accumulo/fate/zookeeper/ZooCacheFactory.java
+++ b/core/src/main/java/org/apache/accumulo/fate/zookeeper/ZooCacheFactory.java
@@ -48,7 +48,7 @@ public class ZooCacheFactory {
   private static void disable() {
     synchronized (instances) {
       try {
-        instances.values().forEach(zc -> zc.close());
+        instances.values().forEach(ZooCache::close);
       } finally {
         instances.clear();
         enabled = false;
diff --git a/core/src/test/java/org/apache/accumulo/core/conf/PropertyTypeTest.java b/core/src/test/java/org/apache/accumulo/core/conf/PropertyTypeTest.java
index 9002a6b..d98ecf6 100644
--- a/core/src/test/java/org/apache/accumulo/core/conf/PropertyTypeTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/conf/PropertyTypeTest.java
@@ -22,6 +22,7 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
+import java.lang.reflect.Method;
 import java.util.Arrays;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -72,7 +73,7 @@ public class PropertyTypeTest {
     // a corresponding test
     Stream<String> types = Arrays.stream(PropertyType.values()).map(Enum<PropertyType>::name);
 
-    List<String> typesTested = Arrays.stream(this.getClass().getMethods()).map(m ->
m.getName())
+    List<String> typesTested = Arrays.stream(this.getClass().getMethods()).map(Method::getName)
         .filter(m -> m.startsWith("testType")).map(m -> m.substring(8))
         .collect(Collectors.toList());
 
diff --git a/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapreduce/lib/InputConfigurator.java
b/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapreduce/lib/InputConfigurator.java
index 03ca98f..1e6d3e0 100644
--- a/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapreduce/lib/InputConfigurator.java
+++ b/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapreduce/lib/InputConfigurator.java
@@ -780,7 +780,7 @@ public class InputConfigurator extends ConfiguratorBase {
       InputTableConfig queryConfig = new InputTableConfig();
       List<IteratorSetting> itrs = getIterators(implementingClass, conf);
       if (itrs != null)
-        itrs.forEach(itr -> queryConfig.addIterator(itr));
+        itrs.forEach(queryConfig::addIterator);
       Set<IteratorSetting.Column> columns = getFetchedColumns(implementingClass, conf);
       if (columns != null)
         queryConfig.fetchColumns(columns);
diff --git a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/mapred/MultiTableInputFormatTest.java
b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/mapred/MultiTableInputFormatTest.java
index 2754c90..5c1c400 100644
--- a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/mapred/MultiTableInputFormatTest.java
+++ b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/mapred/MultiTableInputFormatTest.java
@@ -80,7 +80,7 @@ public class MultiTableInputFormatTest {
     InputTableConfig table1 = new InputTableConfig();
     table1.setScanAuths(auths).setRanges(ranges).fetchColumns(cols).setUseLocalIterators(true)
         .setOfflineScan(true);
-    allIters.forEach(itr -> table1.addIterator(itr));
+    allIters.forEach(table1::addIterator);
     InputTableConfig table2 = new InputTableConfig();
     table2.setScanAuths(auths).setRanges(ranges).fetchColumns(cols).addIterator(iter2);
 
diff --git a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/mapreduce/MultiTableInputFormatTest.java
b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/mapreduce/MultiTableInputFormatTest.java
index 6c567e4..e03d254 100644
--- a/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/mapreduce/MultiTableInputFormatTest.java
+++ b/hadoop-mapreduce/src/test/java/org/apache/accumulo/hadoop/mapreduce/MultiTableInputFormatTest.java
@@ -80,7 +80,7 @@ public class MultiTableInputFormatTest {
     InputTableConfig table1 = new InputTableConfig();
     table1.setScanAuths(auths).setRanges(ranges).fetchColumns(cols).setUseLocalIterators(true)
         .setOfflineScan(true);
-    allIters.forEach(itr -> table1.addIterator(itr));
+    allIters.forEach(table1::addIterator);
     InputTableConfig table2 = new InputTableConfig();
     table2.setScanAuths(auths).setRanges(ranges).fetchColumns(cols).addIterator(iter2);
 
diff --git a/server/base/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java
b/server/base/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java
index 59a4475..5ee643f 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java
@@ -250,12 +250,7 @@ public class LiveTServerSet implements Watcher {
 
   public synchronized void startListeningForTabletServerChanges() {
     scanServers();
-    SimpleTimer.getInstance(context.getConfiguration()).schedule(new Runnable() {
-      @Override
-      public void run() {
-        scanServers();
-      }
-    }, 0, 5000);
+    SimpleTimer.getInstance(context.getConfiguration()).schedule(this::scanServers, 0, 5000);
   }
 
   public synchronized void scanServers() {
diff --git a/server/base/src/main/java/org/apache/accumulo/server/master/balancer/HostRegexTableLoadBalancer.java
b/server/base/src/main/java/org/apache/accumulo/server/master/balancer/HostRegexTableLoadBalancer.java
index 4f2188d..14edfa8 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/master/balancer/HostRegexTableLoadBalancer.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/master/balancer/HostRegexTableLoadBalancer.java
@@ -335,7 +335,8 @@ public class HostRegexTableLoadBalancer extends TableLoadBalancer {
         CacheBuilder.newBuilder().expireAfterAccess(1, TimeUnit.HOURS).build(new CacheLoader<>()
{
           @Override
           public Deriver<Map<String,String>> load(TableId key) throws Exception
{
-            return context.getTableConfiguration(key).newDeriver(conf -> getRegexes(conf));
+            return context.getTableConfiguration(key)
+                .newDeriver(HostRegexTableLoadBalancer::getRegexes);
           }
         });
 
@@ -391,7 +392,7 @@ public class HostRegexTableLoadBalancer extends TableLoadBalancer {
 
     Map<String,String> tableIdMap = t.tableIdMap();
     Map<TableId,String> tableIdToTableName = createdTableNameMap(tableIdMap);
-    tableIdToTableName.keySet().forEach(tid -> checkTableConfig(tid));
+    tableIdToTableName.keySet().forEach(this::checkTableConfig);
 
     long now = System.currentTimeMillis();
 
diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/TableDiskUsage.java
b/server/base/src/main/java/org/apache/accumulo/server/util/TableDiskUsage.java
index 271e6c9..dc21789 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/util/TableDiskUsage.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/TableDiskUsage.java
@@ -152,7 +152,7 @@ public class TableDiskUsage {
 
   public static void printDiskUsage(Collection<String> tableNames, VolumeManager fs,
       AccumuloClient client, boolean humanReadable) throws TableNotFoundException, IOException
{
-    printDiskUsage(tableNames, fs, client, line -> System.out.println(line), humanReadable);
+    printDiskUsage(tableNames, fs, client, System.out::println, humanReadable);
   }
 
   public static Map<TreeSet<String>,Long> getDiskUsage(Set<TableId> tableIds,
VolumeManager fs,
diff --git a/server/base/src/test/java/org/apache/accumulo/server/fs/PerTableVolumeChooserTest.java
b/server/base/src/test/java/org/apache/accumulo/server/fs/PerTableVolumeChooserTest.java
index 518b5e0..328cf67 100644
--- a/server/base/src/test/java/org/apache/accumulo/server/fs/PerTableVolumeChooserTest.java
+++ b/server/base/src/test/java/org/apache/accumulo/server/fs/PerTableVolumeChooserTest.java
@@ -121,7 +121,7 @@ public class PerTableVolumeChooserTest {
         .once();
     replay(serviceEnv, tableConf, systemConf);
 
-    assertThrows(VolumeChooserException.class, () -> getTableDelegate());
+    assertThrows(VolumeChooserException.class, this::getTableDelegate);
   }
 
   @Test
@@ -133,7 +133,7 @@ public class PerTableVolumeChooserTest {
         VolumeChooser.class)).andThrow(new RuntimeException());
     replay(serviceEnv, tableConf, systemConf);
 
-    assertThrows(VolumeChooserException.class, () -> getTableDelegate());
+    assertThrows(VolumeChooserException.class, this::getTableDelegate);
   }
 
   @Test
diff --git a/server/base/src/test/java/org/apache/accumulo/server/fs/PreferredVolumeChooserTest.java
b/server/base/src/test/java/org/apache/accumulo/server/fs/PreferredVolumeChooserTest.java
index c66c6bc..cfd653e 100644
--- a/server/base/src/test/java/org/apache/accumulo/server/fs/PreferredVolumeChooserTest.java
+++ b/server/base/src/test/java/org/apache/accumulo/server/fs/PreferredVolumeChooserTest.java
@@ -113,7 +113,7 @@ public class PreferredVolumeChooserTest {
         .once();
     replay(serviceEnv, tableConf, systemConf);
 
-    assertThrows(VolumeChooserException.class, () -> chooseForTable());
+    assertThrows(VolumeChooserException.class, this::chooseForTable);
   }
 
   @Test
@@ -121,7 +121,7 @@ public class PreferredVolumeChooserTest {
     expect(tableConf.getTableCustom(TABLE_CUSTOM_SUFFIX)).andReturn(",").once();
     replay(serviceEnv, tableConf, systemConf);
 
-    assertThrows(VolumeChooserException.class, () -> chooseForTable());
+    assertThrows(VolumeChooserException.class, this::chooseForTable);
   }
 
   @Test
@@ -131,7 +131,7 @@ public class PreferredVolumeChooserTest {
         .once();
     replay(serviceEnv, tableConf, systemConf);
 
-    assertThrows(VolumeChooserException.class, () -> chooseForTable());
+    assertThrows(VolumeChooserException.class, this::chooseForTable);
   }
 
   @Test
diff --git a/server/master/src/main/java/org/apache/accumulo/master/Master.java b/server/master/src/main/java/org/apache/accumulo/master/Master.java
index cfd51e1..212cda8 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/Master.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/Master.java
@@ -1114,7 +1114,7 @@ public class Master extends AbstractServer
       fate = new Fate<>(this, store, TraceRepo::toLogString);
       fate.startTransactionRunners(threads);
 
-      SimpleTimer.getInstance(getConfiguration()).schedule(() -> store.ageOff(), 63000,
63000);
+      SimpleTimer.getInstance(getConfiguration()).schedule(store::ageOff, 63000, 63000);
     } catch (KeeperException | InterruptedException e) {
       throw new IllegalStateException("Exception setting up FaTE cleanup thread", e);
     }
diff --git a/server/master/src/main/java/org/apache/accumulo/master/tableOps/bulkVer2/BulkImportMove.java
b/server/master/src/main/java/org/apache/accumulo/master/tableOps/bulkVer2/BulkImportMove.java
index 37ec695..1b63213 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/tableOps/bulkVer2/BulkImportMove.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/tableOps/bulkVer2/BulkImportMove.java
@@ -90,7 +90,7 @@ class BulkImportMove extends MasterRepo {
 
     try {
       Map<String,String> oldToNewNameMap =
-          BulkSerialize.readRenameMap(bulkDir.toString(), p -> fs.open(p));
+          BulkSerialize.readRenameMap(bulkDir.toString(), fs::open);
       moveFiles(tid, sourceDir, bulkDir, master, fs, oldToNewNameMap);
 
       return new LoadFiles(bulkInfo);
diff --git a/server/master/src/main/java/org/apache/accumulo/master/tableOps/bulkVer2/LoadFiles.java
b/server/master/src/main/java/org/apache/accumulo/master/tableOps/bulkVer2/LoadFiles.java
index a308d57..897c41e 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/tableOps/bulkVer2/LoadFiles.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/tableOps/bulkVer2/LoadFiles.java
@@ -96,8 +96,8 @@ class LoadFiles extends MasterRepo {
     }
     VolumeManager fs = master.getVolumeManager();
     final Path bulkDir = new Path(bulkInfo.bulkDir);
-    try (LoadMappingIterator lmi = BulkSerialize.getUpdatedLoadMapping(bulkDir.toString(),
-        bulkInfo.tableId, p -> fs.open(p))) {
+    try (LoadMappingIterator lmi =
+        BulkSerialize.getUpdatedLoadMapping(bulkDir.toString(), bulkInfo.tableId, fs::open))
{
       return loadFiles(bulkInfo.tableId, bulkDir, lmi, master, tid);
     }
   }
diff --git a/server/master/src/main/java/org/apache/accumulo/master/tableOps/bulkVer2/PrepBulkImport.java
b/server/master/src/main/java/org/apache/accumulo/master/tableOps/bulkVer2/PrepBulkImport.java
index f0d3e1d..d949f21 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/tableOps/bulkVer2/PrepBulkImport.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/tableOps/bulkVer2/PrepBulkImport.java
@@ -160,13 +160,13 @@ public class PrepBulkImport extends MasterRepo {
     VolumeManager fs = master.getVolumeManager();
     final Path bulkDir = new Path(bulkInfo.sourceDir);
     try (LoadMappingIterator lmi =
-        BulkSerialize.readLoadMapping(bulkDir.toString(), bulkInfo.tableId, p -> fs.open(p)))
{
+        BulkSerialize.readLoadMapping(bulkDir.toString(), bulkInfo.tableId, fs::open)) {
 
       TabletIterFactory tabletIterFactory = startRow -> TabletsMetadata.builder()
           .forTable(bulkInfo.tableId).overlapping(startRow, null).checkConsistency().fetch(PREV_ROW)
           .build(master.getContext()).stream().map(TabletMetadata::getExtent).iterator();
 
-      checkForMerge(bulkInfo.tableId.canonical(), Iterators.transform(lmi, entry -> entry.getKey()),
+      checkForMerge(bulkInfo.tableId.canonical(), Iterators.transform(lmi, Map.Entry::getKey),
           tabletIterFactory);
     }
   }
@@ -198,7 +198,7 @@ public class PrepBulkImport extends MasterRepo {
     // also have to move mapping file
     oldToNewNameMap.put(mappingFile.getName(), new Path(bulkDir, mappingFile.getName()).getName());
 
-    BulkSerialize.writeRenameMap(oldToNewNameMap, bulkDir.toString(), p -> fs.create(p));
+    BulkSerialize.writeRenameMap(oldToNewNameMap, bulkDir.toString(), fs::create);
 
     bulkInfo.bulkDir = bulkDir.toString();
     // return the next step, which will move files
diff --git a/server/tracer/src/main/java/org/apache/accumulo/tracer/TraceFormatter.java b/server/tracer/src/main/java/org/apache/accumulo/tracer/TraceFormatter.java
index 092703f..992b95f 100644
--- a/server/tracer/src/main/java/org/apache/accumulo/tracer/TraceFormatter.java
+++ b/server/tracer/src/main/java/org/apache/accumulo/tracer/TraceFormatter.java
@@ -86,7 +86,7 @@ public class TraceFormatter implements Formatter {
       result.append(String.format(" %12s:%s%n", "loc", span.svc + "@" + span.sender));
       result.append(String.format(" %12s:%s%n", "span", Long.toHexString(span.spanId)));
       String parentString = span.getParentIdsSize() == 0 ? "" : span.getParentIds().stream()
-          .map(x -> Long.toHexString(x)).collect(Collectors.toList()).toString();
+          .map(Long::toHexString).collect(Collectors.toList()).toString();
       result.append(String.format(" %12s:%s%n", "parent", parentString));
       result.append(String.format(" %12s:%s%n", "start", dateFormatter.format(span.start)));
       result.append(String.format(" %12s:%s%n", "ms", span.stop - span.start));
diff --git a/server/tracer/src/main/java/org/apache/accumulo/tracer/TraceServer.java b/server/tracer/src/main/java/org/apache/accumulo/tracer/TraceServer.java
index 1591d13..d3859a8 100644
--- a/server/tracer/src/main/java/org/apache/accumulo/tracer/TraceServer.java
+++ b/server/tracer/src/main/java/org/apache/accumulo/tracer/TraceServer.java
@@ -150,7 +150,7 @@ public class TraceServer implements Watcher, AutoCloseable {
       TCompactProtocol protocol = new TCompactProtocol(transport);
       s.write(protocol);
       String parentString = s.getParentIdsSize() == 0 ? "" : s.getParentIds().stream()
-          .map(x -> Long.toHexString(x)).collect(Collectors.toList()).toString();
+          .map(Long::toHexString).collect(Collectors.toList()).toString();
       put(spanMutation, "span", parentString + ":" + Long.toHexString(s.spanId), transport.get(),
           transport.len());
       // Map the root span to time so we can look up traces by time
@@ -303,7 +303,7 @@ public class TraceServer implements Watcher, AutoCloseable {
   }
 
   public void run() {
-    SimpleTimer.getInstance(context.getConfiguration()).schedule(() -> flush(), SCHEDULE_DELAY,
+    SimpleTimer.getInstance(context.getConfiguration()).schedule(this::flush, SCHEDULE_DELAY,
         SCHEDULE_PERIOD);
     server.serve();
   }
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
index a5aa5b2..3681859 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
@@ -341,8 +341,7 @@ public class TabletServer extends AbstractServer {
     updateMetrics = new TabletServerUpdateMetrics();
     scanMetrics = new TabletServerScanMetrics();
     mincMetrics = new TabletServerMinCMetrics();
-    SimpleTimer.getInstance(aconf).schedule(() -> TabletLocator.clearLocators(), jitter(),
-        jitter());
+    SimpleTimer.getInstance(aconf).schedule(TabletLocator::clearLocators, jitter(), jitter());
     walMarker = new WalStateManager(context);
 
     // Create the secret manager
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServerResourceManager.java
b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServerResourceManager.java
index 860a721..b84f07d 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServerResourceManager.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServerResourceManager.java
@@ -233,7 +233,7 @@ public class TabletServerResourceManager {
 
     scanExecQueues.put(sec.name, queue);
 
-    return createEs(() -> sec.getCurrentMaxThreads(), "scan-" + sec.name, queue, sec.priority);
+    return createEs(sec::getCurrentMaxThreads, "scan-" + sec.name, queue, sec.priority);
   }
 
   private ExecutorService createEs(IntSupplier maxThreadsSupplier, String name,
@@ -550,13 +550,13 @@ public class TabletServerResourceManager {
       memUsageReports = new LinkedBlockingQueue<>();
       maxMem = context.getConfiguration().getAsBytes(Property.TSERV_MAXMEM);
 
-      Runnable r1 = () -> processTabletMemStats();
+      Runnable r1 = this::processTabletMemStats;
 
       memoryGuardThread = new Daemon(new LoggingRunnable(log, r1));
       memoryGuardThread.setPriority(Thread.NORM_PRIORITY + 1);
       memoryGuardThread.setName("Accumulo Memory Guard");
 
-      Runnable r2 = () -> manageMemory();
+      Runnable r2 = this::manageMemory;
 
       minorCompactionInitiatorThread = new Daemon(new LoggingRunnable(log, r2));
       minorCompactionInitiatorThread.setName("Accumulo Minor Compaction Initiator");
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/ThriftClientHandler.java
b/server/tserver/src/main/java/org/apache/accumulo/tserver/ThriftClientHandler.java
index fd8a055..de18ded 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/ThriftClientHandler.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/ThriftClientHandler.java
@@ -1764,7 +1764,7 @@ class ThriftClientHandler extends ClientServiceHandler implements TabletClientSe
     BlockCache summaryCache = server.resourceManager.getSummaryCache();
     BlockCache indexCache = server.resourceManager.getIndexCache();
     Cache<String,Long> fileLenCache = server.resourceManager.getFileLenCache();
-    FileSystemResolver volMgr = p -> fs.getFileSystemByPath(p);
+    FileSystemResolver volMgr = fs::getFileSystemByPath;
     Future<SummaryCollection> future =
         new Gatherer(server.getContext(), request, tableCfg, server.getContext().getCryptoService())
             .processFiles(volMgr, files, summaryCache, indexCache, fileLenCache, srp);
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/compaction/strategies/TooManyDeletesCompactionStrategy.java
b/server/tserver/src/main/java/org/apache/accumulo/tserver/compaction/strategies/TooManyDeletesCompactionStrategy.java
index 7e1ffb3..f9ca9bf 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/compaction/strategies/TooManyDeletesCompactionStrategy.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/compaction/strategies/TooManyDeletesCompactionStrategy.java
@@ -119,7 +119,7 @@ public class TooManyDeletesCompactionStrategy extends DefaultCompactionStrategy
         SummarizerConfiguration.fromTableProperties(request.getTableProperties());
 
     // check if delete summarizer is configured for table
-    if (configuredSummarizers.stream().map(sc -> sc.getClassName())
+    if (configuredSummarizers.stream().map(SummarizerConfiguration::getClassName)
         .anyMatch(cn -> cn.equals(DeletesSummarizer.class.getName()))) {
       // This is called before gatherInformation, so need to always queue for compaction
until
       // context
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java
index 8d931e8..48eb6b5 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java
@@ -354,7 +354,7 @@ public class Tablet {
     final List<LogEntry> logEntries = tabletPaths.logEntries;
     final SortedMap<StoredTabletFile,DataFileValue> datafiles = tabletPaths.datafiles;
 
-    constraintChecker = tableConfiguration.newDeriver(conf -> new ConstraintChecker(conf));
+    constraintChecker = tableConfiguration.newDeriver(ConstraintChecker::new);
 
     if (extent.isMeta()) {
       defaultSecurityLabel = () -> EMPTY_BYTES;
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/AccumuloClientIT.java
b/test/src/main/java/org/apache/accumulo/test/functional/AccumuloClientIT.java
index 4243626..4662166 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/AccumuloClientIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/AccumuloClientIT.java
@@ -209,11 +209,11 @@ public class AccumuloClientIT extends AccumuloClusterHarness {
     expectClosed(() -> c.createScanner(tableName, Authorizations.EMPTY));
     expectClosed(() -> c.createConditionalWriter(tableName, new ConditionalWriterConfig()));
     expectClosed(() -> c.createBatchWriter(tableName));
-    expectClosed(() -> c.tableOperations());
-    expectClosed(() -> c.instanceOperations());
-    expectClosed(() -> c.securityOperations());
-    expectClosed(() -> c.namespaceOperations());
-    expectClosed(() -> c.properties());
+    expectClosed(c::tableOperations);
+    expectClosed(c::instanceOperations);
+    expectClosed(c::securityOperations);
+    expectClosed(c::namespaceOperations);
+    expectClosed(c::properties);
     expectClosed(() -> c.instanceOperations().getInstanceID());
 
     // check a few table ops to ensure they fail
diff --git a/test/src/main/java/org/apache/accumulo/test/gc/replication/CloseWriteAheadLogReferencesIT.java
b/test/src/main/java/org/apache/accumulo/test/gc/replication/CloseWriteAheadLogReferencesIT.java
index d131ccb..34b5aab 100644
--- a/test/src/main/java/org/apache/accumulo/test/gc/replication/CloseWriteAheadLogReferencesIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/gc/replication/CloseWriteAheadLogReferencesIT.java
@@ -112,7 +112,7 @@ public class CloseWriteAheadLogReferencesIT extends ConfigurableMacBase
{
       return systemConf.getBoolean((Property) args[0]);
     }).anyTimes();
 
-    EasyMock.expect(siteConfig.iterator()).andAnswer(() -> systemConf.iterator()).anyTimes();
+    EasyMock.expect(siteConfig.iterator()).andAnswer(systemConf::iterator).anyTimes();
     ServerContext context = createMock(ServerContext.class);
     expect(context.getProperties()).andReturn(new Properties()).anyTimes();
     expect(context.getZooKeepers()).andReturn("localhost").anyTimes();
diff --git a/test/src/main/java/org/apache/accumulo/test/replication/ReplicationIT.java b/test/src/main/java/org/apache/accumulo/test/replication/ReplicationIT.java
index 30ac99b..215462f 100644
--- a/test/src/main/java/org/apache/accumulo/test/replication/ReplicationIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/replication/ReplicationIT.java
@@ -279,13 +279,13 @@ public class ReplicationIT extends ConfigurableMacBase {
           // look for locality group column family definitions
           if (key.equals(
               Property.TABLE_LOCALITY_GROUP_PREFIX.getKey() + ReplicationTable.STATUS_LG_NAME)
-              && val.equals(j.join(Iterables.transform(ReplicationTable.STATUS_LG_COLFAMS,
-                  text -> text.toString())))) {
+              && val.equals(j
+                  .join(Iterables.transform(ReplicationTable.STATUS_LG_COLFAMS, Text::toString))))
{
             foundLocalityGroupDef1 = true;
           } else if (key
               .equals(Property.TABLE_LOCALITY_GROUP_PREFIX.getKey() + ReplicationTable.WORK_LG_NAME)
-              && val.equals(j.join(Iterables.transform(ReplicationTable.WORK_LG_COLFAMS,
-                  text -> text.toString())))) {
+              && val.equals(
+                  j.join(Iterables.transform(ReplicationTable.WORK_LG_COLFAMS, Text::toString))))
{
             foundLocalityGroupDef2 = true;
           }
         }
diff --git a/test/src/main/java/org/apache/accumulo/test/rpc/SimpleThriftServiceRunner.java
b/test/src/main/java/org/apache/accumulo/test/rpc/SimpleThriftServiceRunner.java
index 79488b9..6930582 100644
--- a/test/src/main/java/org/apache/accumulo/test/rpc/SimpleThriftServiceRunner.java
+++ b/test/src/main/java/org/apache/accumulo/test/rpc/SimpleThriftServiceRunner.java
@@ -39,7 +39,7 @@ public class SimpleThriftServiceRunner {
   public SimpleThriftServiceRunner(String threadName) {
     this.mocket = new Mocket();
     this.server = createServer();
-    this.serviceThread = new Thread(() -> server.serve(), threadName);
+    this.serviceThread = new Thread(server::serve, threadName);
   }
 
   public void startService() {


Mime
View raw message