You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ct...@apache.org on 2016/07/01 01:59:16 UTC
[19/32] accumulo git commit: ACCUMULO-4357 Remove unneeded code for
readability
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java
----------------------------------------------------------------------
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 15b5226..6637521 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
@@ -18,6 +18,7 @@ package org.apache.accumulo.tserver.tablet;
import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
import static java.nio.charset.StandardCharsets.UTF_8;
+import static java.util.Objects.requireNonNull;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
@@ -91,6 +92,7 @@ import org.apache.accumulo.core.trace.Span;
import org.apache.accumulo.core.trace.Trace;
import org.apache.accumulo.core.util.LocalityGroupUtil;
import org.apache.accumulo.core.util.Pair;
+import org.apache.accumulo.core.util.ratelimit.RateLimiter;
import org.apache.accumulo.server.ServerConstants;
import org.apache.accumulo.server.conf.TableConfiguration;
import org.apache.accumulo.server.fs.FileRef;
@@ -152,8 +154,6 @@ import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Optional;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
-import org.apache.accumulo.core.util.ratelimit.RateLimiter;
-import static java.util.Objects.requireNonNull;
/**
*
@@ -186,7 +186,7 @@ public class Tablet implements TabletCommitter {
return dataSourceDeletions.get();
}
- private final Set<ScanDataSource> activeScans = new HashSet<ScanDataSource>();
+ private final Set<ScanDataSource> activeScans = new HashSet<>();
private static enum CloseState {
OPEN, CLOSING, CLOSED, COMPLETE
@@ -209,14 +209,14 @@ public class Tablet implements TabletCommitter {
static enum CompactionState {
WAITING_TO_START, IN_PROGRESS
- };
+ }
private volatile CompactionState minorCompactionState = null;
private volatile CompactionState majorCompactionState = null;
private final Set<MajorCompactionReason> majorCompactionQueued = Collections.synchronizedSet(EnumSet.noneOf(MajorCompactionReason.class));
- private final AtomicReference<ConstraintChecker> constraintChecker = new AtomicReference<ConstraintChecker>();
+ private final AtomicReference<ConstraintChecker> constraintChecker = new AtomicReference<>();
private int writesInProgress = 0;
@@ -257,7 +257,7 @@ public class Tablet implements TabletCommitter {
}
public static class LookupResult {
- public List<Range> unfinishedRanges = new ArrayList<Range>();
+ public List<Range> unfinishedRanges = new ArrayList<>();
public long bytesAdded = 0;
public long dataSize = 0;
public boolean closed = false;
@@ -349,7 +349,7 @@ public class Tablet implements TabletCommitter {
this.location = locationPath;
this.tabletDirectory = tabletPaths.dir;
for (Entry<Long,List<FileRef>> entry : data.getBulkImported().entrySet()) {
- this.bulkImported.put(entry.getKey(), new CopyOnWriteArrayList<FileRef>(entry.getValue()));
+ this.bulkImported.put(entry.getKey(), new CopyOnWriteArrayList<>(entry.getValue()));
}
setupDefaultSecurityLabels(extent);
@@ -408,7 +408,7 @@ public class Tablet implements TabletCommitter {
final AtomicLong maxTime = new AtomicLong(Long.MIN_VALUE);
final CommitSession commitSession = getTabletMemory().getCommitSession();
try {
- Set<String> absPaths = new HashSet<String>();
+ Set<String> absPaths = new HashSet<>();
for (FileRef ref : datafiles.keySet())
absPaths.add(ref.path().toString());
@@ -466,7 +466,7 @@ public class Tablet implements TabletCommitter {
}
}
// make some closed references that represent the recovered logs
- currentLogs = new ConcurrentSkipListSet<DfsLogger>();
+ currentLogs = new ConcurrentSkipListSet<>();
for (LogEntry logEntry : logEntries) {
currentLogs.add(new DfsLogger(tabletServer.getServerConfig(), logEntry.filename, logEntry.getColumnQualifier().toString()));
}
@@ -704,7 +704,7 @@ public class Tablet implements TabletCommitter {
if (batchTimeOut == Long.MAX_VALUE || batchTimeOut <= 0) {
batchTimeOut = 0;
}
- List<KVEntry> results = new ArrayList<KVEntry>();
+ List<KVEntry> results = new ArrayList<>();
Key key = null;
Value value;
@@ -853,7 +853,7 @@ public class Tablet implements TabletCommitter {
private synchronized MinorCompactionTask prepareForMinC(long flushId, MinorCompactionReason mincReason) {
CommitSession oldCommitSession = getTabletMemory().prepareForMinC();
otherLogs = currentLogs;
- currentLogs = new ConcurrentSkipListSet<DfsLogger>();
+ currentLogs = new ConcurrentSkipListSet<>();
FileRef mergeFile = null;
if (mincReason != MinorCompactionReason.RECOVERY) {
@@ -1050,7 +1050,7 @@ public class Tablet implements TabletCommitter {
}
}
- return new Pair<Long,UserCompactionConfig>(compactID, compactionConfig);
+ return new Pair<>(compactID, compactionConfig);
} catch (InterruptedException e) {
throw new RuntimeException(e);
} catch (NumberFormatException nfe) {
@@ -1103,7 +1103,7 @@ public class Tablet implements TabletCommitter {
if (more != null) {
violations.add(more);
if (violators == null)
- violators = new ArrayList<Mutation>();
+ violators = new ArrayList<>();
violators.add(mutation);
}
}
@@ -1112,8 +1112,8 @@ public class Tablet implements TabletCommitter {
if (!violations.isEmpty()) {
- HashSet<Mutation> violatorsSet = new HashSet<Mutation>(violators);
- ArrayList<Mutation> nonViolators = new ArrayList<Mutation>();
+ HashSet<Mutation> violatorsSet = new HashSet<>(violators);
+ ArrayList<Mutation> nonViolators = new ArrayList<>();
for (Mutation mutation : mutations) {
if (!violatorsSet.contains(mutation)) {
@@ -1578,7 +1578,7 @@ public class Tablet implements TabletCommitter {
}
private Map<FileRef,Pair<Key,Key>> getFirstAndLastKeys(SortedMap<FileRef,DataFileValue> allFiles) throws IOException {
- Map<FileRef,Pair<Key,Key>> result = new HashMap<FileRef,Pair<Key,Key>>();
+ Map<FileRef,Pair<Key,Key>> result = new HashMap<>();
FileOperations fileFactory = FileOperations.getInstance();
VolumeManager fs = getTabletServer().getFileSystem();
for (Entry<FileRef,DataFileValue> entry : allFiles.entrySet()) {
@@ -1589,7 +1589,7 @@ public class Tablet implements TabletCommitter {
try {
Key first = openReader.getFirstKey();
Key last = openReader.getLastKey();
- result.put(file, new Pair<Key,Key>(first, last));
+ result.put(file, new Pair<>(first, last));
} finally {
openReader.close();
}
@@ -1598,7 +1598,7 @@ public class Tablet implements TabletCommitter {
}
List<FileRef> findChopFiles(KeyExtent extent, Map<FileRef,Pair<Key,Key>> firstAndLastKeys, Collection<FileRef> allFiles) throws IOException {
- List<FileRef> result = new ArrayList<FileRef>();
+ List<FileRef> result = new ArrayList<>();
if (firstAndLastKeys == null) {
result.addAll(allFiles);
return result;
@@ -1706,7 +1706,7 @@ public class Tablet implements TabletCommitter {
RootFiles.cleanupReplacement(fs, fs.listStatus(this.location), false);
}
SortedMap<FileRef,DataFileValue> allFiles = getDatafileManager().getDatafileSizes();
- List<FileRef> inputFiles = new ArrayList<FileRef>();
+ List<FileRef> inputFiles = new ArrayList<>();
if (reason == MajorCompactionReason.CHOP) {
// enforce rules: files with keys outside our range need to be compacted
inputFiles.addAll(findChopFiles(extent, firstAndLastKeys, allFiles.keySet()));
@@ -1773,7 +1773,7 @@ public class Tablet implements TabletCommitter {
}
}
- List<IteratorSetting> compactionIterators = new ArrayList<IteratorSetting>();
+ List<IteratorSetting> compactionIterators = new ArrayList<>();
if (compactionId != null) {
if (reason == MajorCompactionReason.USER) {
if (getCompactionCancelID() >= compactionId.getFirst()) {
@@ -1834,7 +1834,7 @@ public class Tablet implements TabletCommitter {
};
- HashMap<FileRef,DataFileValue> copy = new HashMap<FileRef,DataFileValue>(getDatafileManager().getDatafileSizes());
+ HashMap<FileRef,DataFileValue> copy = new HashMap<>(getDatafileManager().getDatafileSizes());
if (!copy.keySet().containsAll(smallestFiles))
throw new IllegalStateException("Cannot find data file values for " + smallestFiles);
@@ -1902,12 +1902,12 @@ public class Tablet implements TabletCommitter {
// short-circuit; also handles zero files case
if (filesToCompact.size() <= maxFilesToCompact) {
- Set<FileRef> smallestFiles = new HashSet<FileRef>(filesToCompact.keySet());
+ Set<FileRef> smallestFiles = new HashSet<>(filesToCompact.keySet());
filesToCompact.clear();
return smallestFiles;
}
- PriorityQueue<Pair<FileRef,Long>> fileHeap = new PriorityQueue<Pair<FileRef,Long>>(filesToCompact.size(), new Comparator<Pair<FileRef,Long>>() {
+ PriorityQueue<Pair<FileRef,Long>> fileHeap = new PriorityQueue<>(filesToCompact.size(), new Comparator<Pair<FileRef,Long>>() {
@Override
public int compare(Pair<FileRef,Long> o1, Pair<FileRef,Long> o2) {
if (o1.getSecond() == o2.getSecond())
@@ -1920,10 +1920,10 @@ public class Tablet implements TabletCommitter {
for (Iterator<Entry<FileRef,DataFileValue>> iterator = filesToCompact.entrySet().iterator(); iterator.hasNext();) {
Entry<FileRef,DataFileValue> entry = iterator.next();
- fileHeap.add(new Pair<FileRef,Long>(entry.getKey(), entry.getValue().getSize()));
+ fileHeap.add(new Pair<>(entry.getKey(), entry.getValue().getSize()));
}
- Set<FileRef> smallestFiles = new HashSet<FileRef>();
+ Set<FileRef> smallestFiles = new HashSet<>();
while (smallestFiles.size() < maxFilesToCompact && fileHeap.size() > 0) {
Pair<FileRef,Long> pair = fileHeap.remove();
filesToCompact.remove(pair.getFirst());
@@ -2092,7 +2092,7 @@ public class Tablet implements TabletCommitter {
synchronized (this) {
// java needs tuples ...
- TreeMap<KeyExtent,TabletData> newTablets = new TreeMap<KeyExtent,TabletData>();
+ TreeMap<KeyExtent,TabletData> newTablets = new TreeMap<>();
long t1 = System.currentTimeMillis();
// choose a split point
@@ -2123,9 +2123,9 @@ public class Tablet implements TabletCommitter {
String lowDirectory = createTabletDirectory(getTabletServer().getFileSystem(), extent.getTableId(), midRow);
// write new tablet information to MetadataTable
- SortedMap<FileRef,DataFileValue> lowDatafileSizes = new TreeMap<FileRef,DataFileValue>();
- SortedMap<FileRef,DataFileValue> highDatafileSizes = new TreeMap<FileRef,DataFileValue>();
- List<FileRef> highDatafilesToRemove = new ArrayList<FileRef>();
+ SortedMap<FileRef,DataFileValue> lowDatafileSizes = new TreeMap<>();
+ SortedMap<FileRef,DataFileValue> highDatafileSizes = new TreeMap<>();
+ List<FileRef> highDatafilesToRemove = new ArrayList<>();
MetadataTableUtil.splitDatafiles(extent.getTableId(), midRow, splitRatio, firstAndLastRows, getDatafileManager().getDatafileSizes(), lowDatafileSizes,
highDatafileSizes, highDatafilesToRemove);
@@ -2196,7 +2196,7 @@ public class Tablet implements TabletCommitter {
}
public void importMapFiles(long tid, Map<FileRef,MapFileInfo> fileMap, boolean setTime) throws IOException {
- Map<FileRef,DataFileValue> entries = new HashMap<FileRef,DataFileValue>(fileMap.size());
+ Map<FileRef,DataFileValue> entries = new HashMap<>(fileMap.size());
List<String> files = new ArrayList<>();
for (Entry<FileRef,MapFileInfo> entry : fileMap.entrySet()) {
@@ -2259,7 +2259,7 @@ public class Tablet implements TabletCommitter {
bulkImported.get(tid, new Callable<List<FileRef>>() {
@Override
public List<FileRef> call() throws Exception {
- return new ArrayList<FileRef>();
+ return new ArrayList<>();
}
}).addAll(fileMap.keySet());
} catch (Exception ex) {
@@ -2270,18 +2270,18 @@ public class Tablet implements TabletCommitter {
}
}
- private ConcurrentSkipListSet<DfsLogger> currentLogs = new ConcurrentSkipListSet<DfsLogger>();
+ private ConcurrentSkipListSet<DfsLogger> currentLogs = new ConcurrentSkipListSet<>();
// currentLogs may be updated while a tablet is otherwise locked
public Set<DfsLogger> getCurrentLogFiles() {
- return new HashSet<DfsLogger>(currentLogs);
+ return new HashSet<>(currentLogs);
}
Set<String> beginClearingUnusedLogs() {
- Set<String> doomed = new HashSet<String>();
+ Set<String> doomed = new HashSet<>();
- ArrayList<String> otherLogsCopy = new ArrayList<String>();
- ArrayList<String> currentLogsCopy = new ArrayList<String>();
+ ArrayList<String> otherLogsCopy = new ArrayList<>();
+ ArrayList<String> currentLogsCopy = new ArrayList<>();
// do not hold tablet lock while acquiring the log lock
logLock.lock();
@@ -2650,7 +2650,7 @@ public class Tablet implements TabletCommitter {
}
public Map<Long,List<FileRef>> getBulkIngestedFiles() {
- return new HashMap<Long,List<FileRef>>(bulkImported.asMap());
+ return new HashMap<>(bulkImported.asMap());
}
public void cleanupBulkLoadedFiles(Set<Long> tids) {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/TabletMemory.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/TabletMemory.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/TabletMemory.java
index 86cc262..f66e457 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/TabletMemory.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/TabletMemory.java
@@ -158,7 +158,7 @@ class TabletMemory implements Closeable {
}
public List<MemoryIterator> getIterators(SamplerConfigurationImpl samplerConfig) {
- List<MemoryIterator> toReturn = new ArrayList<MemoryIterator>(2);
+ List<MemoryIterator> toReturn = new ArrayList<>(2);
toReturn.add(memTable.skvIterator(samplerConfig));
if (otherMemTable != null)
toReturn.add(otherMemTable.skvIterator(samplerConfig));
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/server/tserver/src/test/java/org/apache/accumulo/tserver/AssignmentWatcherTest.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/test/java/org/apache/accumulo/tserver/AssignmentWatcherTest.java b/server/tserver/src/test/java/org/apache/accumulo/tserver/AssignmentWatcherTest.java
index 51e14df..5dd3c19 100644
--- a/server/tserver/src/test/java/org/apache/accumulo/tserver/AssignmentWatcherTest.java
+++ b/server/tserver/src/test/java/org/apache/accumulo/tserver/AssignmentWatcherTest.java
@@ -37,7 +37,7 @@ public class AssignmentWatcherTest {
@Before
public void setup() {
- assignments = new HashMap<KeyExtent,RunnableStartedAt>();
+ assignments = new HashMap<>();
timer = EasyMock.createMock(SimpleTimer.class);
conf = EasyMock.createMock(AccumuloConfiguration.class);
watcher = new AssignmentWatcher(conf, assignments, timer);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/server/tserver/src/test/java/org/apache/accumulo/tserver/CheckTabletMetadataTest.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/test/java/org/apache/accumulo/tserver/CheckTabletMetadataTest.java b/server/tserver/src/test/java/org/apache/accumulo/tserver/CheckTabletMetadataTest.java
index 27da12b..f474972 100644
--- a/server/tserver/src/test/java/org/apache/accumulo/tserver/CheckTabletMetadataTest.java
+++ b/server/tserver/src/test/java/org/apache/accumulo/tserver/CheckTabletMetadataTest.java
@@ -58,7 +58,7 @@ public class CheckTabletMetadataTest {
}
private static void assertFail(TreeMap<Key,Value> tabletMeta, KeyExtent ke, TServerInstance tsi, Key keyToDelete) {
- TreeMap<Key,Value> copy = new TreeMap<Key,Value>(tabletMeta);
+ TreeMap<Key,Value> copy = new TreeMap<>(tabletMeta);
Assert.assertNotNull(copy.remove(keyToDelete));
try {
Assert.assertNull(TabletServer.checkTabletMetadata(ke, tsi, copy, ke.getMetadataEntry()));
@@ -72,7 +72,7 @@ public class CheckTabletMetadataTest {
KeyExtent ke = new KeyExtent("1", null, null);
- TreeMap<Key,Value> tabletMeta = new TreeMap<Key,Value>();
+ TreeMap<Key,Value> tabletMeta = new TreeMap<>();
put(tabletMeta, "1<", TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN, KeyExtent.encodePrevEndRow(null).get());
put(tabletMeta, "1<", TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN, "/t1".getBytes());
@@ -101,18 +101,18 @@ public class CheckTabletMetadataTest {
assertFail(tabletMeta, ke, tsi, nk("1<", TabletsSection.FutureLocationColumnFamily.NAME, "4"));
- TreeMap<Key,Value> copy = new TreeMap<Key,Value>(tabletMeta);
+ TreeMap<Key,Value> copy = new TreeMap<>(tabletMeta);
put(copy, "1<", TabletsSection.CurrentLocationColumnFamily.NAME, "4", "127.0.0.1:9997");
assertFail(copy, ke, tsi);
assertFail(copy, ke, tsi, nk("1<", TabletsSection.FutureLocationColumnFamily.NAME, "4"));
- copy = new TreeMap<Key,Value>(tabletMeta);
+ copy = new TreeMap<>(tabletMeta);
put(copy, "1<", TabletsSection.CurrentLocationColumnFamily.NAME, "5", "127.0.0.1:9998");
assertFail(copy, ke, tsi);
put(copy, "1<", TabletsSection.CurrentLocationColumnFamily.NAME, "6", "127.0.0.1:9999");
assertFail(copy, ke, tsi);
- copy = new TreeMap<Key,Value>(tabletMeta);
+ copy = new TreeMap<>(tabletMeta);
put(copy, "1<", TabletsSection.FutureLocationColumnFamily.NAME, "5", "127.0.0.1:9998");
assertFail(copy, ke, tsi);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/server/tserver/src/test/java/org/apache/accumulo/tserver/CountingIteratorTest.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/test/java/org/apache/accumulo/tserver/CountingIteratorTest.java b/server/tserver/src/test/java/org/apache/accumulo/tserver/CountingIteratorTest.java
index 8a1dca5..423d522 100644
--- a/server/tserver/src/test/java/org/apache/accumulo/tserver/CountingIteratorTest.java
+++ b/server/tserver/src/test/java/org/apache/accumulo/tserver/CountingIteratorTest.java
@@ -36,7 +36,7 @@ import org.junit.Test;
public class CountingIteratorTest {
@Test
public void testDeepCopyCount() throws IOException {
- TreeMap<Key,Value> tm = new TreeMap<Key,Value>();
+ TreeMap<Key,Value> tm = new TreeMap<>();
tm.put(new Key("r1", "cf1", "cq1"), new Value("data1".getBytes()));
tm.put(new Key("r2", "cf1", "cq1"), new Value("data2".getBytes()));
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/server/tserver/src/test/java/org/apache/accumulo/tserver/InMemoryMapTest.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/test/java/org/apache/accumulo/tserver/InMemoryMapTest.java b/server/tserver/src/test/java/org/apache/accumulo/tserver/InMemoryMapTest.java
index 264145f..59dc68e 100644
--- a/server/tserver/src/test/java/org/apache/accumulo/tserver/InMemoryMapTest.java
+++ b/server/tserver/src/test/java/org/apache/accumulo/tserver/InMemoryMapTest.java
@@ -416,7 +416,7 @@ public class InMemoryMapTest {
imm.delete(0);
- ArrayList<ByteSequence> columns = new ArrayList<ByteSequence>();
+ ArrayList<ByteSequence> columns = new ArrayList<>();
columns.add(new ArrayByteSequence("bar"));
// this seek resulted in an infinite loop before a bug was fixed
@@ -474,7 +474,7 @@ public class InMemoryMapTest {
@Test
@Ignore
public void parallelWriteSpeed() throws Exception {
- List<Double> timings = new ArrayList<Double>();
+ List<Double> timings = new ArrayList<>();
for (int threads : new int[] {1, 2, 16, /* 64, 256 */}) {
final long now = System.currentTimeMillis();
final long counts[] = new long[threads];
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/server/tserver/src/test/java/org/apache/accumulo/tserver/compaction/DefaultCompactionStrategyTest.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/test/java/org/apache/accumulo/tserver/compaction/DefaultCompactionStrategyTest.java b/server/tserver/src/test/java/org/apache/accumulo/tserver/compaction/DefaultCompactionStrategyTest.java
index dd18584..e54e1c8 100644
--- a/server/tserver/src/test/java/org/apache/accumulo/tserver/compaction/DefaultCompactionStrategyTest.java
+++ b/server/tserver/src/test/java/org/apache/accumulo/tserver/compaction/DefaultCompactionStrategyTest.java
@@ -56,10 +56,10 @@ public class DefaultCompactionStrategyTest {
Key second = null;
if (secondString != null)
second = new Key(new Text(secondString));
- return new Pair<Key,Key>(first, second);
+ return new Pair<>(first, second);
}
- static final Map<String,Pair<Key,Key>> fakeFiles = new HashMap<String,Pair<Key,Key>>();
+ static final Map<String,Pair<Key,Key>> fakeFiles = new HashMap<>();
static {
fakeFiles.put("file1", keys("b", "m"));
@@ -162,7 +162,7 @@ public class DefaultCompactionStrategyTest {
}
private MajorCompactionRequest createRequest(KeyExtent extent, MajorCompactionReason reason, Object... objs) throws IOException {
- Map<FileRef,DataFileValue> files = new HashMap<FileRef,DataFileValue>();
+ Map<FileRef,DataFileValue> files = new HashMap<>();
for (int i = 0; i < objs.length; i += 2) {
files.put(new FileRef("hdfs://nn1/accumulo/tables/5/t-0001/" + (String) objs[i]), new DataFileValue(((Number) objs[i + 1]).longValue(), 0));
}
@@ -174,7 +174,7 @@ public class DefaultCompactionStrategyTest {
}
private static Set<String> asStringSet(Collection<FileRef> refs) {
- HashSet<String> result = new HashSet<String>();
+ HashSet<String> result = new HashSet<>();
for (FileRef ref : refs) {
result.add(ref.path().toString());
}
@@ -182,7 +182,7 @@ public class DefaultCompactionStrategyTest {
}
private static Set<String> asSet(Collection<String> strings) {
- HashSet<String> result = new HashSet<String>();
+ HashSet<String> result = new HashSet<>();
for (String string : strings)
result.add("hdfs://nn1/accumulo/tables/5/t-0001/" + string);
return result;
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/server/tserver/src/test/java/org/apache/accumulo/tserver/compaction/SizeLimitCompactionStrategyTest.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/test/java/org/apache/accumulo/tserver/compaction/SizeLimitCompactionStrategyTest.java b/server/tserver/src/test/java/org/apache/accumulo/tserver/compaction/SizeLimitCompactionStrategyTest.java
index a66715e..648f451 100644
--- a/server/tserver/src/test/java/org/apache/accumulo/tserver/compaction/SizeLimitCompactionStrategyTest.java
+++ b/server/tserver/src/test/java/org/apache/accumulo/tserver/compaction/SizeLimitCompactionStrategyTest.java
@@ -34,7 +34,7 @@ import org.junit.Test;
public class SizeLimitCompactionStrategyTest {
private Map<FileRef,DataFileValue> nfl(String... sa) {
- HashMap<FileRef,DataFileValue> ret = new HashMap<FileRef,DataFileValue>();
+ HashMap<FileRef,DataFileValue> ret = new HashMap<>();
for (int i = 0; i < sa.length; i += 2) {
ret.put(new FileRef("hdfs://nn1/accumulo/tables/5/t-0001/" + sa[i]), new DataFileValue(AccumuloConfiguration.getMemoryInBytes(sa[i + 1]), 1));
}
@@ -45,7 +45,7 @@ public class SizeLimitCompactionStrategyTest {
@Test
public void testLimits() throws IOException {
SizeLimitCompactionStrategy slcs = new SizeLimitCompactionStrategy();
- HashMap<String,String> opts = new HashMap<String,String>();
+ HashMap<String,String> opts = new HashMap<>();
opts.put(SizeLimitCompactionStrategy.SIZE_LIMIT_OPT, "1G");
slcs.init(opts);
@@ -62,7 +62,7 @@ public class SizeLimitCompactionStrategyTest {
mcr.setFiles(nfl("f1", "2G", "f2", "2G", "f3", "2G", "f4", "2G", "f5", "500M", "f6", "500M", "f7", "500M", "f8", "500M"));
Assert.assertTrue(slcs.shouldCompact(mcr));
- Assert.assertEquals(nfl("f5", "500M", "f6", "500M", "f7", "500M", "f8", "500M").keySet(), new HashSet<FileRef>(slcs.getCompactionPlan(mcr).inputFiles));
+ Assert.assertEquals(nfl("f5", "500M", "f6", "500M", "f7", "500M", "f8", "500M").keySet(), new HashSet<>(slcs.getCompactionPlan(mcr).inputFiles));
Assert.assertEquals(8, mcr.getFiles().size());
}
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/server/tserver/src/test/java/org/apache/accumulo/tserver/constraints/ConstraintCheckerTest.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/test/java/org/apache/accumulo/tserver/constraints/ConstraintCheckerTest.java b/server/tserver/src/test/java/org/apache/accumulo/tserver/constraints/ConstraintCheckerTest.java
index c590242..0765b5d 100644
--- a/server/tserver/src/test/java/org/apache/accumulo/tserver/constraints/ConstraintCheckerTest.java
+++ b/server/tserver/src/test/java/org/apache/accumulo/tserver/constraints/ConstraintCheckerTest.java
@@ -53,7 +53,7 @@ public class ConstraintCheckerTest {
@Before
public void setup() throws NoSuchMethodException, SecurityException {
cc = createMockBuilder(ConstraintChecker.class).addMockedMethod("getConstraints").createMock();
- constraints = new ArrayList<Constraint>();
+ constraints = new ArrayList<>();
expect(cc.getConstraints()).andReturn(constraints);
env = createMock(Environment.class);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/server/tserver/src/test/java/org/apache/accumulo/tserver/log/DfsLoggerTest.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/test/java/org/apache/accumulo/tserver/log/DfsLoggerTest.java b/server/tserver/src/test/java/org/apache/accumulo/tserver/log/DfsLoggerTest.java
index cd652e4..6f10a48 100644
--- a/server/tserver/src/test/java/org/apache/accumulo/tserver/log/DfsLoggerTest.java
+++ b/server/tserver/src/test/java/org/apache/accumulo/tserver/log/DfsLoggerTest.java
@@ -31,7 +31,7 @@ public class DfsLoggerTest {
@Test
public void testDurabilityForGroupCommit() {
- List<TabletMutations> lst = new ArrayList<TabletMutations>();
+ List<TabletMutations> lst = new ArrayList<>();
assertEquals(Durability.NONE, DfsLogger.chooseDurabilityForGroupCommit(lst));
TabletMutations m1 = new TabletMutations(0, 1, Collections.<Mutation> emptyList(), Durability.NONE);
lst.add(m1);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/server/tserver/src/test/java/org/apache/accumulo/tserver/log/SortedLogRecoveryTest.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/test/java/org/apache/accumulo/tserver/log/SortedLogRecoveryTest.java b/server/tserver/src/test/java/org/apache/accumulo/tserver/log/SortedLogRecoveryTest.java
index 882aed7..b65d5ce 100644
--- a/server/tserver/src/test/java/org/apache/accumulo/tserver/log/SortedLogRecoveryTest.java
+++ b/server/tserver/src/test/java/org/apache/accumulo/tserver/log/SortedLogRecoveryTest.java
@@ -113,7 +113,7 @@ public class SortedLogRecoveryTest {
}
private static class CaptureMutations implements MutationReceiver {
- public ArrayList<Mutation> result = new ArrayList<Mutation>();
+ public ArrayList<Mutation> result = new ArrayList<>();
@Override
public void receive(Mutation m) {
@@ -133,7 +133,7 @@ public class SortedLogRecoveryTest {
VolumeManager fs = VolumeManagerImpl.getLocal(workdir);
final Path workdirPath = new Path("file://" + workdir);
fs.deleteRecursively(workdirPath);
- ArrayList<Path> dirs = new ArrayList<Path>();
+ ArrayList<Path> dirs = new ArrayList<>();
try {
for (Entry<String,KeyValue[]> entry : logs.entrySet()) {
String path = workdir + "/" + entry.getKey();
@@ -177,7 +177,7 @@ public class SortedLogRecoveryTest {
KeyValue entries5[] = new KeyValue[] {createKeyValue(OPEN, 0, 4, "70"), createKeyValue(DEFINE_TABLET, 1, 4, extent),
createKeyValue(COMPACTION_START, 3, 4, "/t1/f3"), createKeyValue(MUTATION, 2, 4, ignored), createKeyValue(MUTATION, 6, 4, m2),};
- Map<String,KeyValue[]> logs = new TreeMap<String,KeyValue[]>();
+ Map<String,KeyValue[]> logs = new TreeMap<>();
logs.put("entries", entries);
logs.put("entries2", entries2);
logs.put("entries3", entries3);
@@ -217,7 +217,7 @@ public class SortedLogRecoveryTest {
createKeyValue(MUTATION, 11, 1, ignored), createKeyValue(MUTATION, 15, 1, m), createKeyValue(MUTATION, 16, 1, m2),};
KeyValue entries4[] = new KeyValue[] {createKeyValue(OPEN, 17, -1, "4"), createKeyValue(DEFINE_TABLET, 18, 1, extent),
createKeyValue(COMPACTION_START, 20, 1, "/t1/f3"), createKeyValue(MUTATION, 19, 1, m3), createKeyValue(MUTATION, 21, 1, m4),};
- Map<String,KeyValue[]> logs = new TreeMap<String,KeyValue[]>();
+ Map<String,KeyValue[]> logs = new TreeMap<>();
logs.put("entries", entries);
logs.put("entries2", entries2);
logs.put("entries3", entries3);
@@ -252,7 +252,7 @@ public class SortedLogRecoveryTest {
KeyValue entries2[] = new KeyValue[] {createKeyValue(OPEN, 0, 1, "2"), createKeyValue(DEFINE_TABLET, 1, 1, extent),
createKeyValue(COMPACTION_START, 2, 1, "/t1/f1"), createKeyValue(COMPACTION_FINISH, 3, 1, "/t1/f1"), createKeyValue(MUTATION, 3, 1, m2),};
- Map<String,KeyValue[]> logs = new TreeMap<String,KeyValue[]>();
+ Map<String,KeyValue[]> logs = new TreeMap<>();
logs.put("entries", entries);
logs.put("entries2", entries2);
@@ -269,7 +269,7 @@ public class SortedLogRecoveryTest {
public void testEmpty() throws IOException {
// Create a test log
KeyValue entries[] = new KeyValue[] {createKeyValue(OPEN, 0, -1, "1"), createKeyValue(DEFINE_TABLET, 1, 1, extent),};
- Map<String,KeyValue[]> logs = new TreeMap<String,KeyValue[]>();
+ Map<String,KeyValue[]> logs = new TreeMap<>();
logs.put("testlog", entries);
// Recover
List<Mutation> mutations = recover(logs, extent);
@@ -282,7 +282,7 @@ public class SortedLogRecoveryTest {
public void testMissingDefinition() {
// Create a test log
KeyValue entries[] = new KeyValue[] {createKeyValue(OPEN, 0, -1, "1"),};
- Map<String,KeyValue[]> logs = new TreeMap<String,KeyValue[]>();
+ Map<String,KeyValue[]> logs = new TreeMap<>();
logs.put("testlog", entries);
// Recover
try {
@@ -297,7 +297,7 @@ public class SortedLogRecoveryTest {
Mutation m = new ServerMutation(new Text("row1"));
m.put(cf, cq, value);
KeyValue entries[] = new KeyValue[] {createKeyValue(OPEN, 0, -1, "1"), createKeyValue(DEFINE_TABLET, 1, 1, extent), createKeyValue(MUTATION, 2, 1, m),};
- Map<String,KeyValue[]> logs = new TreeMap<String,KeyValue[]>();
+ Map<String,KeyValue[]> logs = new TreeMap<>();
logs.put("testlog", entries);
// Recover
List<Mutation> mutations = recover(logs, extent);
@@ -316,7 +316,7 @@ public class SortedLogRecoveryTest {
KeyValue entries[] = new KeyValue[] {createKeyValue(OPEN, 0, -1, "1"), createKeyValue(DEFINE_TABLET, 1, 1, extent),
createKeyValue(COMPACTION_START, 3, 1, "/t1/f1"), createKeyValue(COMPACTION_FINISH, 4, 1, null), createKeyValue(MUTATION, 2, 1, ignored),
createKeyValue(MUTATION, 5, 1, m),};
- Map<String,KeyValue[]> logs = new TreeMap<String,KeyValue[]>();
+ Map<String,KeyValue[]> logs = new TreeMap<>();
logs.put("testlog", entries);
// Recover
List<Mutation> mutations = recover(logs, extent);
@@ -336,7 +336,7 @@ public class SortedLogRecoveryTest {
createKeyValue(COMPACTION_START, 3, 1, "/t1/f1"), createKeyValue(MUTATION, 2, 1, ignored),};
KeyValue entries2[] = new KeyValue[] {createKeyValue(OPEN, 4, -1, "1"), createKeyValue(DEFINE_TABLET, 5, 1, extent),
createKeyValue(COMPACTION_FINISH, 6, 1, null), createKeyValue(MUTATION, 7, 1, m),};
- Map<String,KeyValue[]> logs = new TreeMap<String,KeyValue[]>();
+ Map<String,KeyValue[]> logs = new TreeMap<>();
logs.put("entries", entries);
logs.put("entries2", entries2);
// Recover
@@ -359,7 +359,7 @@ public class SortedLogRecoveryTest {
createKeyValue(COMPACTION_START, 3, 1, "/t1/f1"), createKeyValue(MUTATION, 2, 1, ignored), createKeyValue(MUTATION, 4, 1, m),};
KeyValue entries2[] = new KeyValue[] {createKeyValue(OPEN, 5, -1, "1"), createKeyValue(DEFINE_TABLET, 6, 1, extent),
createKeyValue(COMPACTION_FINISH, 7, 1, null), createKeyValue(MUTATION, 8, 1, m2),};
- Map<String,KeyValue[]> logs = new TreeMap<String,KeyValue[]>();
+ Map<String,KeyValue[]> logs = new TreeMap<>();
logs.put("entries", entries);
logs.put("entries2", entries2);
// Recover
@@ -382,7 +382,7 @@ public class SortedLogRecoveryTest {
KeyValue entries[] = new KeyValue[] {createKeyValue(OPEN, 0, -1, "1"), createKeyValue(DEFINE_TABLET, 1, 1, extent),
createKeyValue(COMPACTION_FINISH, 2, 1, null), createKeyValue(COMPACTION_START, 4, 1, "/t1/f1"), createKeyValue(COMPACTION_FINISH, 6, 1, null),
createKeyValue(MUTATION, 3, 1, ignored), createKeyValue(MUTATION, 5, 1, m), createKeyValue(MUTATION, 7, 1, m2),};
- Map<String,KeyValue[]> logs = new TreeMap<String,KeyValue[]>();
+ Map<String,KeyValue[]> logs = new TreeMap<>();
logs.put("entries", entries);
// Recover
List<Mutation> mutations = recover(logs, extent);
@@ -408,7 +408,7 @@ public class SortedLogRecoveryTest {
KeyValue entries2[] = new KeyValue[] {createKeyValue(OPEN, 5, -1, "1"), createKeyValue(DEFINE_TABLET, 6, 1, extent), createKeyValue(MUTATION, 7, 1, m2),};
KeyValue entries3[] = new KeyValue[] {createKeyValue(OPEN, 8, -1, "1"), createKeyValue(DEFINE_TABLET, 9, 1, extent),
createKeyValue(COMPACTION_FINISH, 10, 1, null), createKeyValue(MUTATION, 11, 1, m3),};
- Map<String,KeyValue[]> logs = new TreeMap<String,KeyValue[]>();
+ Map<String,KeyValue[]> logs = new TreeMap<>();
logs.put("entries", entries);
logs.put("entries2", entries2);
logs.put("entries3", entries3);
@@ -431,7 +431,7 @@ public class SortedLogRecoveryTest {
KeyValue entries[] = new KeyValue[] {createKeyValue(OPEN, 0, -1, "1"), createKeyValue(DEFINE_TABLET, 1, 1, extent),
createKeyValue(COMPACTION_START, 30, 1, "/t1/f1"), createKeyValue(COMPACTION_FINISH, 32, 1, "/t1/f1"), createKeyValue(MUTATION, 29, 1, m1),
createKeyValue(MUTATION, 30, 1, m2),};
- Map<String,KeyValue[]> logs = new TreeMap<String,KeyValue[]>();
+ Map<String,KeyValue[]> logs = new TreeMap<>();
logs.put("testlog", entries);
// Recover
List<Mutation> mutations = recover(logs, extent);
@@ -454,7 +454,7 @@ public class SortedLogRecoveryTest {
createKeyValue(COMPACTION_START, 2, 1, "/t1/f1"), createKeyValue(COMPACTION_FINISH, 4, 1, null), createKeyValue(MUTATION, 3, 1, m),};
KeyValue entries2[] = new KeyValue[] {createKeyValue(OPEN, 5, -1, "1"), createKeyValue(DEFINE_TABLET, 6, 1, extent),
createKeyValue(COMPACTION_START, 8, 1, "/t1/f1"), createKeyValue(MUTATION, 7, 1, m2), createKeyValue(MUTATION, 9, 1, m3),};
- Map<String,KeyValue[]> logs = new TreeMap<String,KeyValue[]>();
+ Map<String,KeyValue[]> logs = new TreeMap<>();
logs.put("entries", entries);
logs.put("entries2", entries2);
// Recover
@@ -498,7 +498,7 @@ public class SortedLogRecoveryTest {
// createKeyValue(COMPACTION_START, 18, 1, "somefile"),
// createKeyValue(COMPACTION_FINISH, 19, 1, null),
createKeyValue(MUTATION, 8, 1, m5), createKeyValue(MUTATION, 20, 1, m6),};
- Map<String,KeyValue[]> logs = new TreeMap<String,KeyValue[]>();
+ Map<String,KeyValue[]> logs = new TreeMap<>();
logs.put("entries", entries);
logs.put("entries2", entries2);
logs.put("entries3", entries3);
@@ -535,7 +535,7 @@ public class SortedLogRecoveryTest {
createKeyValue(MUTATION, 3, 1, m), createKeyValue(MUTATION, 3, 1, m2), createKeyValue(MUTATION, 3, 1, m3),};
KeyValue entries2[] = new KeyValue[] {createKeyValue(OPEN, 0, -1, "2"), createKeyValue(DEFINE_TABLET, 1, 1, extent),
createKeyValue(COMPACTION_START, 2, 1, "/t1/f12"), createKeyValue(MUTATION, 3, 1, m4), createKeyValue(MUTATION, 3, 1, m5),};
- Map<String,KeyValue[]> logs = new TreeMap<String,KeyValue[]>();
+ Map<String,KeyValue[]> logs = new TreeMap<>();
logs.put("entries", entries);
logs.put("entries2", entries2);
// Recover
@@ -566,7 +566,7 @@ public class SortedLogRecoveryTest {
Arrays.sort(entries);
- Map<String,KeyValue[]> logs = new TreeMap<String,KeyValue[]>();
+ Map<String,KeyValue[]> logs = new TreeMap<>();
logs.put("entries", entries);
List<Mutation> mutations = recover(logs, extent);
@@ -586,7 +586,7 @@ public class SortedLogRecoveryTest {
createKeyValue(MUTATION, 2, 2, ignored), createKeyValue(COMPACTION_START, 3, 2, "/t/f1")};
Arrays.sort(entries);
- Map<String,KeyValue[]> logs = new TreeMap<String,KeyValue[]>();
+ Map<String,KeyValue[]> logs = new TreeMap<>();
logs.put("entries", entries);
List<Mutation> mutations = recover(logs, Collections.singleton("/t/f1"), extent);
@@ -607,7 +607,7 @@ public class SortedLogRecoveryTest {
createKeyValue(MUTATION, 2, 2, ignored), createKeyValue(COMPACTION_START, 3, 2, "/t/f1"), createKeyValue(MUTATION, 4, 2, m),};
Arrays.sort(entries);
- Map<String,KeyValue[]> logs = new TreeMap<String,KeyValue[]>();
+ Map<String,KeyValue[]> logs = new TreeMap<>();
logs.put("entries", entries);
List<Mutation> mutations = recover(logs, Collections.singleton("/t/f1"), extent);
@@ -626,10 +626,10 @@ public class SortedLogRecoveryTest {
createKeyValue(COMPACTION_START, 3, 2, compactionStartFile), createKeyValue(MUTATION, 4, 2, m2),};
Arrays.sort(entries);
- Map<String,KeyValue[]> logs = new TreeMap<String,KeyValue[]>();
+ Map<String,KeyValue[]> logs = new TreeMap<>();
logs.put("entries", entries);
- HashSet<String> filesSet = new HashSet<String>();
+ HashSet<String> filesSet = new HashSet<>();
filesSet.addAll(Arrays.asList(tabletFiles));
List<Mutation> mutations = recover(logs, filesSet, extent);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/server/tserver/src/test/java/org/apache/accumulo/tserver/tablet/RootFilesTest.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/test/java/org/apache/accumulo/tserver/tablet/RootFilesTest.java b/server/tserver/src/test/java/org/apache/accumulo/tserver/tablet/RootFilesTest.java
index e5d893a..d9c6862 100644
--- a/server/tserver/src/test/java/org/apache/accumulo/tserver/tablet/RootFilesTest.java
+++ b/server/tserver/src/test/java/org/apache/accumulo/tserver/tablet/RootFilesTest.java
@@ -60,7 +60,7 @@ public class RootFilesTest {
rootTabletDir = new File(tempFolder.newFolder(), "accumulo/tables/+r/root_tablet");
assertTrue(rootTabletDir.mkdirs() || rootTabletDir.isDirectory());
- oldDatafiles = new HashSet<FileRef>();
+ oldDatafiles = new HashSet<>();
for (String filename : inputFiles) {
File file = new File(rootTabletDir, filename);
assertTrue(file.createNewFile());
@@ -91,17 +91,17 @@ public class RootFilesTest {
public Collection<String> cleanupReplacement(String... expectedFiles) throws IOException {
Collection<String> ret = RootFiles.cleanupReplacement(vm, vm.listStatus(new Path(rootTabletDir.toURI())), true);
- HashSet<String> expected = new HashSet<String>();
+ HashSet<String> expected = new HashSet<>();
for (String efile : expectedFiles)
expected.add(new File(rootTabletDir, efile).toURI().toString());
- Assert.assertEquals(expected, new HashSet<String>(ret));
+ Assert.assertEquals(expected, new HashSet<>(ret));
return ret;
}
public void assertFiles(String... files) {
- HashSet<String> actual = new HashSet<String>();
+ HashSet<String> actual = new HashSet<>();
File[] children = rootTabletDir.listFiles();
if (children != null) {
for (File file : children) {
@@ -109,7 +109,7 @@ public class RootFilesTest {
}
}
- HashSet<String> expected = new HashSet<String>();
+ HashSet<String> expected = new HashSet<>();
expected.addAll(Arrays.asList(files));
Assert.assertEquals(expected, actual);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/shell/src/main/java/org/apache/accumulo/shell/Shell.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/accumulo/shell/Shell.java b/shell/src/main/java/org/apache/accumulo/shell/Shell.java
index 5c95129..db9732c 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/Shell.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/Shell.java
@@ -206,12 +206,12 @@ public class Shell extends ShellOptions implements KeywordExecutable {
protected ConsoleReader reader;
private AuthenticationToken token;
private final Class<? extends Formatter> defaultFormatterClass = DefaultFormatter.class;
- public Map<String,List<IteratorSetting>> scanIteratorOptions = new HashMap<String,List<IteratorSetting>>();
- public Map<String,List<IteratorSetting>> iteratorProfiles = new HashMap<String,List<IteratorSetting>>();
+ public Map<String,List<IteratorSetting>> scanIteratorOptions = new HashMap<>();
+ public Map<String,List<IteratorSetting>> iteratorProfiles = new HashMap<>();
private Token rootToken;
- public final Map<String,Command> commandFactory = new TreeMap<String,Command>();
- public final Map<String,Command[]> commandGrouping = new TreeMap<String,Command[]>();
+ public final Map<String,Command> commandFactory = new TreeMap<>();
+ public final Map<String,Command[]> commandGrouping = new TreeMap<>();
// exit if true
private boolean exit = false;
@@ -875,15 +875,15 @@ public class Shell extends ShellOptions implements KeywordExecutable {
namespaces = Collections.emptySet();
}
- Map<Command.CompletionSet,Set<String>> options = new HashMap<Command.CompletionSet,Set<String>>();
+ Map<Command.CompletionSet,Set<String>> options = new HashMap<>();
- Set<String> commands = new HashSet<String>();
+ Set<String> commands = new HashSet<>();
for (String a : commandFactory.keySet())
commands.add(a);
- Set<String> modifiedUserlist = new HashSet<String>();
- Set<String> modifiedTablenames = new HashSet<String>();
- Set<String> modifiedNamespaces = new HashSet<String>();
+ Set<String> modifiedUserlist = new HashSet<>();
+ Set<String> modifiedTablenames = new HashSet<>();
+ Set<String> modifiedNamespaces = new HashSet<>();
for (String a : tableNames)
modifiedTablenames.add(a.replaceAll("([\\s'\"])", "\\\\$1"));
@@ -1026,7 +1026,7 @@ public class Shell extends ShellOptions implements KeywordExecutable {
@Override
public void close() {}
- };
+ }
public static class PrintFile implements PrintLine {
PrintWriter writer;
@@ -1044,7 +1044,7 @@ public class Shell extends ShellOptions implements KeywordExecutable {
public void close() {
writer.close();
}
- };
+ }
public final void printLines(Iterator<String> lines, boolean paginate) throws IOException {
printLines(lines, paginate, null);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/shell/src/main/java/org/apache/accumulo/shell/ShellOptionsJC.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/accumulo/shell/ShellOptionsJC.java b/shell/src/main/java/org/apache/accumulo/shell/ShellOptionsJC.java
index 01b7ce3..1e5156f 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/ShellOptionsJC.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/ShellOptionsJC.java
@@ -105,7 +105,7 @@ public class ShellOptionsJC {
String process(String value) {
return value;
}
- };
+ }
@Override
public String convert(String value) {
@@ -141,7 +141,7 @@ public class ShellOptionsJC {
private AuthenticationToken authenticationToken;
@DynamicParameter(names = {"-l", "--tokenProperty"}, description = "login properties in the format key=value. Reuse -l for each property")
- private Map<String,String> tokenProperties = new TreeMap<String,String>();
+ private Map<String,String> tokenProperties = new TreeMap<>();
@Parameter(names = "--disable-tab-completion", description = "disables tab completion (for less overhead when scripting)")
private boolean tabCompletionDisabled;
@@ -169,7 +169,7 @@ public class ShellOptionsJC {
private boolean hdfsZooInstance;
@Parameter(names = {"-z", "--zooKeeperInstance"}, description = "use a zookeeper instance with the given instance name and list of zoo hosts", arity = 2)
- private List<String> zooKeeperInstance = new ArrayList<String>();
+ private List<String> zooKeeperInstance = new ArrayList<>();
@Parameter(names = {"--ssl"}, description = "use ssl to connect to accumulo")
private boolean useSsl = false;
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/shell/src/main/java/org/apache/accumulo/shell/Token.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/accumulo/shell/Token.java b/shell/src/main/java/org/apache/accumulo/shell/Token.java
index fe29537..41921e5 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/Token.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/Token.java
@@ -30,8 +30,8 @@ import java.util.Set;
*/
public class Token {
- private Set<String> command = new HashSet<String>();
- private Set<Token> subcommands = new HashSet<Token>();
+ private Set<String> command = new HashSet<>();
+ private Set<Token> subcommands = new HashSet<>();
private boolean caseSensitive = false;
public Token() {}
@@ -73,7 +73,7 @@ public class Token {
}
public Set<String> getSubcommandNames() {
- HashSet<String> set = new HashSet<String>();
+ HashSet<String> set = new HashSet<>();
for (Token t : subcommands)
set.addAll(t.getCommandNames());
return set;
@@ -81,7 +81,7 @@ public class Token {
public Set<String> getSubcommandNames(String startsWith) {
Iterator<Token> iter = subcommands.iterator();
- HashSet<String> set = new HashSet<String>();
+ HashSet<String> set = new HashSet<>();
while (iter.hasNext()) {
Token t = iter.next();
Set<String> subset = t.getCommandNames();
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/shell/src/main/java/org/apache/accumulo/shell/commands/ActiveCompactionIterator.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/ActiveCompactionIterator.java b/shell/src/main/java/org/apache/accumulo/shell/commands/ActiveCompactionIterator.java
index bd039b0..27a5bc8 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/ActiveCompactionIterator.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/ActiveCompactionIterator.java
@@ -54,7 +54,7 @@ class ActiveCompactionIterator implements Iterator<String> {
}
private void readNext() {
- final List<String> compactions = new ArrayList<String>();
+ final List<String> compactions = new ArrayList<>();
while (tsIter.hasNext()) {
@@ -62,7 +62,7 @@ class ActiveCompactionIterator implements Iterator<String> {
try {
List<ActiveCompaction> acl = instanceOps.getActiveCompactions(tserver);
- acl = new ArrayList<ActiveCompaction>(acl);
+ acl = new ArrayList<>(acl);
Collections.sort(acl, new Comparator<ActiveCompaction>() {
@Override
@@ -80,8 +80,8 @@ class ActiveCompactionIterator implements Iterator<String> {
ac.getIterators();
- List<String> iterList = new ArrayList<String>();
- Map<String,Map<String,String>> iterOpts = new HashMap<String,Map<String,String>>();
+ List<String> iterList = new ArrayList<>();
+ Map<String,Map<String,String>> iterOpts = new HashMap<>();
for (IteratorSetting is : ac.getIterators()) {
iterList.add(is.getName() + "=" + is.getPriority() + "," + is.getIteratorClass());
iterOpts.put(is.getName(), is.getOptions());
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/shell/src/main/java/org/apache/accumulo/shell/commands/ActiveScanIterator.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/ActiveScanIterator.java b/shell/src/main/java/org/apache/accumulo/shell/commands/ActiveScanIterator.java
index 1089d78..ab0b344 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/ActiveScanIterator.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/ActiveScanIterator.java
@@ -33,7 +33,7 @@ class ActiveScanIterator implements Iterator<String> {
private Iterator<String> scansIter;
private void readNext() {
- final List<String> scans = new ArrayList<String>();
+ final List<String> scans = new ArrayList<>();
while (tsIter.hasNext()) {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/shell/src/main/java/org/apache/accumulo/shell/commands/AddSplitsCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/AddSplitsCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/AddSplitsCommand.java
index 964ec41..86d08a0 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/AddSplitsCommand.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/AddSplitsCommand.java
@@ -36,7 +36,7 @@ public class AddSplitsCommand extends Command {
final String tableName = OptUtil.getTableOpt(cl, shellState);
final boolean decode = cl.hasOption(base64Opt.getOpt());
- final TreeSet<Text> splits = new TreeSet<Text>();
+ final TreeSet<Text> splits = new TreeSet<>();
if (cl.hasOption(optSplitsFile.getOpt())) {
splits.addAll(ShellUtil.scanFile(cl.getOptionValue(optSplitsFile.getOpt()), decode));
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/shell/src/main/java/org/apache/accumulo/shell/commands/CloneTableCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/CloneTableCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/CloneTableCommand.java
index daca82c..8f99f9c 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/CloneTableCommand.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/CloneTableCommand.java
@@ -42,8 +42,8 @@ public class CloneTableCommand extends Command {
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws AccumuloException, AccumuloSecurityException,
TableNotFoundException, TableExistsException {
- final HashMap<String,String> props = new HashMap<String,String>();
- final HashSet<String> exclude = new HashSet<String>();
+ final HashMap<String,String> props = new HashMap<>();
+ final HashSet<String> exclude = new HashSet<>();
boolean flush = true;
if (cl.hasOption(setPropsOption.getOpt())) {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/shell/src/main/java/org/apache/accumulo/shell/commands/ConfigCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/ConfigCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/ConfigCommand.java
index ec3f276..482bd84 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/ConfigCommand.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/ConfigCommand.java
@@ -140,21 +140,21 @@ public class ConfigCommand extends Command {
}
} else {
// display properties
- final TreeMap<String,String> systemConfig = new TreeMap<String,String>();
+ final TreeMap<String,String> systemConfig = new TreeMap<>();
systemConfig.putAll(shellState.getConnector().instanceOperations().getSystemConfiguration());
final String outputFile = cl.getOptionValue(outputFileOpt.getOpt());
final PrintFile printFile = outputFile == null ? null : new PrintFile(outputFile);
- final TreeMap<String,String> siteConfig = new TreeMap<String,String>();
+ final TreeMap<String,String> siteConfig = new TreeMap<>();
siteConfig.putAll(shellState.getConnector().instanceOperations().getSiteConfiguration());
- final TreeMap<String,String> defaults = new TreeMap<String,String>();
+ final TreeMap<String,String> defaults = new TreeMap<>();
for (Entry<String,String> defaultEntry : AccumuloConfiguration.getDefaultConfiguration()) {
defaults.put(defaultEntry.getKey(), defaultEntry.getValue());
}
- final TreeMap<String,String> namespaceConfig = new TreeMap<String,String>();
+ final TreeMap<String,String> namespaceConfig = new TreeMap<>();
if (tableName != null) {
String n = Namespaces.getNamespaceName(shellState.getInstance(),
Tables.getNamespaceId(shellState.getInstance(), Tables.getTableId(shellState.getInstance(), tableName)));
@@ -169,7 +169,7 @@ public class ConfigCommand extends Command {
} else if (namespace != null) {
acuconf = shellState.getConnector().namespaceOperations().getProperties(namespace);
}
- final TreeMap<String,String> sortedConf = new TreeMap<String,String>();
+ final TreeMap<String,String> sortedConf = new TreeMap<>();
for (Entry<String,String> propEntry : acuconf) {
sortedConf.put(propEntry.getKey(), propEntry.getValue());
}
@@ -187,7 +187,7 @@ public class ConfigCommand extends Command {
COL2 = Math.max(COL2, propEntry.getKey().length() + 3);
}
- final ArrayList<String> output = new ArrayList<String>();
+ final ArrayList<String> output = new ArrayList<>();
printConfHeader(output);
for (Entry<String,String> propEntry : sortedConf.entrySet()) {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/shell/src/main/java/org/apache/accumulo/shell/commands/CreateTableCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/CreateTableCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/CreateTableCommand.java
index b0aca92..eac16fa 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/CreateTableCommand.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/CreateTableCommand.java
@@ -62,7 +62,7 @@ public class CreateTableCommand extends Command {
TableExistsException, TableNotFoundException, IOException, ClassNotFoundException {
final String testTableName = cl.getArgs()[0];
- final HashMap<String,String> props = new HashMap<String,String>();
+ final HashMap<String,String> props = new HashMap<>();
if (!testTableName.matches(Tables.VALID_NAME_REGEX)) {
shellState.getReader().println("Only letters, numbers and underscores are allowed for use in table names.");
@@ -73,7 +73,7 @@ public class CreateTableCommand extends Command {
if (shellState.getConnector().tableOperations().exists(tableName)) {
throw new TableExistsException(null, tableName, null);
}
- final SortedSet<Text> partitions = new TreeSet<Text>();
+ final SortedSet<Text> partitions = new TreeSet<>();
final boolean decode = cl.hasOption(base64Opt.getOpt());
if (cl.hasOption(createTableOptSplit.getOpt())) {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/shell/src/main/java/org/apache/accumulo/shell/commands/DUCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/DUCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/DUCommand.java
index 2adcc81..4d312fc 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/DUCommand.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/DUCommand.java
@@ -42,7 +42,7 @@ public class DUCommand extends Command {
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws IOException, TableNotFoundException,
NamespaceNotFoundException {
- final SortedSet<String> tables = new TreeSet<String>(Arrays.asList(cl.getArgs()));
+ final SortedSet<String> tables = new TreeSet<>(Arrays.asList(cl.getArgs()));
if (cl.hasOption(ShellOptions.tableOption)) {
tables.add(cl.getOptionValue(ShellOptions.tableOption));
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/shell/src/main/java/org/apache/accumulo/shell/commands/DeleteAuthsCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/DeleteAuthsCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/DeleteAuthsCommand.java
index 859dd57..995db0c 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/DeleteAuthsCommand.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/DeleteAuthsCommand.java
@@ -46,7 +46,7 @@ public class DeleteAuthsCommand extends Command {
final Authorizations auths = connector.securityOperations().getUserAuthorizations(user);
final StringBuilder userAuths = new StringBuilder();
final String[] toBeRemovedAuths = scanOpts.split(",");
- final Set<String> toBeRemovedSet = new HashSet<String>();
+ final Set<String> toBeRemovedSet = new HashSet<>();
for (String auth : toBeRemovedAuths) {
toBeRemovedSet.add(auth);
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/shell/src/main/java/org/apache/accumulo/shell/commands/ExtensionCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/ExtensionCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/ExtensionCommand.java
index 3cff189..f78a503 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/ExtensionCommand.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/ExtensionCommand.java
@@ -34,9 +34,9 @@ public class ExtensionCommand extends Command {
private ServiceLoader<ShellExtension> extensions = null;
- private Set<String> loadedHeaders = new HashSet<String>();
- private Set<String> loadedCommands = new HashSet<String>();
- private Set<String> loadedExtensions = new TreeSet<String>();
+ private Set<String> loadedHeaders = new HashSet<>();
+ private Set<String> loadedCommands = new HashSet<>();
+ private Set<String> loadedExtensions = new TreeSet<>();
@Override
public int execute(String fullCommand, CommandLine cl, Shell shellState) throws Exception {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/shell/src/main/java/org/apache/accumulo/shell/commands/FateCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/FateCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/FateCommand.java
index e5d6c59..88eeefd 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/FateCommand.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/FateCommand.java
@@ -123,12 +123,12 @@ public class FateCommand extends Command {
String cmd = args[0];
boolean failedCommand = false;
- AdminUtil<FateCommand> admin = new AdminUtil<FateCommand>(false);
+ AdminUtil<FateCommand> admin = new AdminUtil<>(false);
String path = ZooUtil.getRoot(instance) + Constants.ZFATE;
String masterPath = ZooUtil.getRoot(instance) + Constants.ZMASTER_LOCK;
IZooReaderWriter zk = getZooReaderWriter(shellState.getInstance(), cl.getOptionValue(secretOption.getOpt()));
- ZooStore<FateCommand> zs = new ZooStore<FateCommand>(path, zk);
+ ZooStore<FateCommand> zs = new ZooStore<>(path, zk);
if ("fail".equals(cmd)) {
if (args.length <= 1) {
@@ -156,7 +156,7 @@ public class FateCommand extends Command {
// Parse transaction ID filters for print display
Set<Long> filterTxid = null;
if (args.length >= 2) {
- filterTxid = new HashSet<Long>(args.length);
+ filterTxid = new HashSet<>(args.length);
for (int i = 1; i < args.length; i++) {
try {
Long val = Long.parseLong(args[i], 16);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/shell/src/main/java/org/apache/accumulo/shell/commands/GetAuthsCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/GetAuthsCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/GetAuthsCommand.java
index 5c6a4eb..1f6cec0 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/GetAuthsCommand.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/GetAuthsCommand.java
@@ -46,7 +46,7 @@ public class GetAuthsCommand extends Command {
}
protected List<String> sortAuthorizations(Authorizations auths) {
- List<String> list = new ArrayList<String>();
+ List<String> list = new ArrayList<>();
for (byte[] auth : auths) {
list.add(new String(auth));
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/shell/src/main/java/org/apache/accumulo/shell/commands/HelpCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/HelpCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/HelpCommand.java
index 5945cc3..bf26a45 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/HelpCommand.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/HelpCommand.java
@@ -49,7 +49,7 @@ public class HelpCommand extends Command {
if (numColumns < 40) {
throw new IllegalArgumentException("numColumns must be at least 40 (was " + numColumns + ")");
}
- final ArrayList<String> output = new ArrayList<String>();
+ final ArrayList<String> output = new ArrayList<>();
for (Entry<String,Command[]> cmdGroup : shellState.commandGrouping.entrySet()) {
output.add(cmdGroup.getKey());
for (Command c : cmdGroup.getValue()) {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/shell/src/main/java/org/apache/accumulo/shell/commands/InsertCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/InsertCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/InsertCommand.java
index af5f810..c9da47e 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/InsertCommand.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/InsertCommand.java
@@ -106,7 +106,7 @@ public class InsertCommand extends Command {
try {
bw.close();
} catch (MutationsRejectedException e) {
- final ArrayList<String> lines = new ArrayList<String>();
+ final ArrayList<String> lines = new ArrayList<>();
if (e.getSecurityErrorCodes().isEmpty() == false) {
lines.add("\tAuthorization Failures:");
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/shell/src/main/java/org/apache/accumulo/shell/commands/ListBulkCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/ListBulkCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/ListBulkCommand.java
index 6db9327..8f09e8a 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/ListBulkCommand.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/ListBulkCommand.java
@@ -60,7 +60,7 @@ public class ListBulkCommand extends Command {
final boolean paginate = !cl.hasOption(disablePaginationOpt.getOpt());
if (cl.hasOption(tserverOption.getOpt())) {
- tservers = new ArrayList<String>();
+ tservers = new ArrayList<>();
tservers.add(cl.getOptionValue(tserverOption.getOpt()));
} else {
tservers = Collections.emptyList();
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/shell/src/main/java/org/apache/accumulo/shell/commands/ListCompactionsCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/ListCompactionsCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/ListCompactionsCommand.java
index e4b3410..f59c481 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/ListCompactionsCommand.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/ListCompactionsCommand.java
@@ -45,7 +45,7 @@ public class ListCompactionsCommand extends Command {
final boolean paginate = !cl.hasOption(disablePaginationOpt.getOpt());
if (cl.hasOption(tserverOption.getOpt())) {
- tservers = new ArrayList<String>();
+ tservers = new ArrayList<>();
tservers.add(cl.getOptionValue(tserverOption.getOpt()));
} else {
tservers = instanceOps.getTabletServers();
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/shell/src/main/java/org/apache/accumulo/shell/commands/ListIterCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/ListIterCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/ListIterCommand.java
index 6187300..4a1c0bf 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/ListIterCommand.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/ListIterCommand.java
@@ -63,7 +63,7 @@ public class ListIterCommand extends Command {
}
final boolean allScopes = cl.hasOption(allScopesOpt.getOpt());
- Set<IteratorScope> desiredScopes = new HashSet<IteratorScope>();
+ Set<IteratorScope> desiredScopes = new HashSet<>();
for (IteratorScope scope : IteratorScope.values()) {
if (allScopes || cl.hasOption(scopeOpts.get(scope).getOpt()))
desiredScopes.add(scope);
@@ -120,7 +120,7 @@ public class ListIterCommand extends Command {
allScopesOpt = new Option("all", "all-scopes", false, "list from all scopes");
o.addOption(allScopesOpt);
- scopeOpts = new EnumMap<IteratorScope,Option>(IteratorScope.class);
+ scopeOpts = new EnumMap<>(IteratorScope.class);
scopeOpts.put(IteratorScope.minc, new Option(IteratorScope.minc.name(), "minor-compaction", false, "list iterator for minor compaction scope"));
scopeOpts.put(IteratorScope.majc, new Option(IteratorScope.majc.name(), "major-compaction", false, "list iterator for major compaction scope"));
scopeOpts.put(IteratorScope.scan, new Option(IteratorScope.scan.name(), "scan-time", false, "list iterator for scan scope"));
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/shell/src/main/java/org/apache/accumulo/shell/commands/ListScansCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/ListScansCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/ListScansCommand.java
index f89b6fc..261db07 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/ListScansCommand.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/ListScansCommand.java
@@ -45,7 +45,7 @@ public class ListScansCommand extends Command {
final boolean paginate = !cl.hasOption(disablePaginationOpt.getOpt());
if (cl.hasOption(tserverOption.getOpt())) {
- tservers = new ArrayList<String>();
+ tservers = new ArrayList<>();
tservers.add(cl.getOptionValue(tserverOption.getOpt()));
} else {
tservers = instanceOps.getTabletServers();
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/shell/src/main/java/org/apache/accumulo/shell/commands/NamespacesCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/NamespacesCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/NamespacesCommand.java
index d88d6f1..cb37505 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/NamespacesCommand.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/NamespacesCommand.java
@@ -41,7 +41,7 @@ public class NamespacesCommand extends Command {
@Override
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws AccumuloException, AccumuloSecurityException, IOException {
- Map<String,String> namespaces = new TreeMap<String,String>(shellState.getConnector().namespaceOperations().namespaceIdMap());
+ Map<String,String> namespaces = new TreeMap<>(shellState.getConnector().namespaceOperations().namespaceIdMap());
Iterator<String> it = Iterators.transform(namespaces.entrySet().iterator(), new Function<Entry<String,String>,String>() {
@Override
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/shell/src/main/java/org/apache/accumulo/shell/commands/PingCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/PingCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/PingCommand.java
index ba6de68..c0271b7 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/PingCommand.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/PingCommand.java
@@ -48,7 +48,7 @@ public class PingCommand extends Command {
final boolean paginate = !cl.hasOption(disablePaginationOpt.getOpt());
if (cl.hasOption(tserverOption.getOpt())) {
- tservers = new ArrayList<String>();
+ tservers = new ArrayList<>();
tservers.add(cl.getOptionValue(tserverOption.getOpt()));
} else {
tservers = instanceOps.getTabletServers();
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/shell/src/main/java/org/apache/accumulo/shell/commands/QuotedStringTokenizer.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/QuotedStringTokenizer.java b/shell/src/main/java/org/apache/accumulo/shell/commands/QuotedStringTokenizer.java
index 74397de..a66188e 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/QuotedStringTokenizer.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/QuotedStringTokenizer.java
@@ -38,7 +38,7 @@ public class QuotedStringTokenizer implements Iterable<String> {
private String input;
public QuotedStringTokenizer(final String t) throws BadArgumentException {
- tokens = new ArrayList<String>();
+ tokens = new ArrayList<>();
this.input = t;
try {
createTokens();
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/shell/src/main/java/org/apache/accumulo/shell/commands/ScriptCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/ScriptCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/ScriptCommand.java
index 3059b52..82b7d57 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/ScriptCommand.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/ScriptCommand.java
@@ -88,7 +88,7 @@ public class ScriptCommand extends Command {
Bindings b = engine.getBindings(ScriptContext.ENGINE_SCOPE);
b.put("connection", shellState.getConnector());
- List<Object> argValues = new ArrayList<Object>();
+ List<Object> argValues = new ArrayList<>();
if (cl.hasOption(args.getOpt())) {
String[] argList = cl.getOptionValue(args.getOpt()).split(",");
for (String arg : argList) {
@@ -249,7 +249,7 @@ public class ScriptCommand extends Command {
private void listJSREngineInfo(ScriptEngineManager mgr, Shell shellState) throws IOException {
List<ScriptEngineFactory> factories = mgr.getEngineFactories();
- Set<String> lines = new TreeSet<String>();
+ Set<String> lines = new TreeSet<>();
for (ScriptEngineFactory factory : factories) {
lines.add("ScriptEngineFactory Info");
String engName = factory.getEngineName();
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/shell/src/main/java/org/apache/accumulo/shell/commands/SetGroupsCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/SetGroupsCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/SetGroupsCommand.java
index 62ed1a2..b095bcf 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/SetGroupsCommand.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/SetGroupsCommand.java
@@ -36,7 +36,7 @@ public class SetGroupsCommand extends Command {
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws Exception {
final String tableName = OptUtil.getTableOpt(cl, shellState);
- final HashMap<String,Set<Text>> groups = new HashMap<String,Set<Text>>();
+ final HashMap<String,Set<Text>> groups = new HashMap<>();
for (String arg : cl.getArgs()) {
final String sa[] = arg.split("=", 2);
@@ -44,7 +44,7 @@ public class SetGroupsCommand extends Command {
throw new IllegalArgumentException("Missing '='");
}
final String group = sa[0];
- final HashSet<Text> colFams = new HashSet<Text>();
+ final HashSet<Text> colFams = new HashSet<>();
for (String family : sa[1].split(",")) {
colFams.add(new Text(family.getBytes(Shell.CHARSET)));
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/shell/src/main/java/org/apache/accumulo/shell/commands/SetIterCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/SetIterCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/SetIterCommand.java
index 23b98a6..fffdf21 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/SetIterCommand.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/SetIterCommand.java
@@ -64,7 +64,7 @@ public class SetIterCommand extends Command {
final int priority = Integer.parseInt(cl.getOptionValue(priorityOpt.getOpt()));
- final Map<String,String> options = new HashMap<String,String>();
+ final Map<String,String> options = new HashMap<>();
String classname = cl.getOptionValue(classnameTypeOpt.getOpt());
if (cl.hasOption(aggTypeOpt.getOpt())) {
Shell.log.warn("aggregators are deprecated");
@@ -240,7 +240,7 @@ public class SetIterCommand extends Command {
if (className.contains(".")) {
shortClassName = className.substring(className.lastIndexOf('.') + 1);
}
- final Map<String,String> localOptions = new HashMap<String,String>();
+ final Map<String,String> localOptions = new HashMap<>();
do {
// clean up the overall options that caused things to fail
for (String key : localOptions.keySet()) {
@@ -311,7 +311,7 @@ public class SetIterCommand extends Command {
reader.flush();
reader.println("Optional, configure name-value options for iterator:");
String prompt = Shell.repeat("-", 10) + "> set option (<name> <value>, hit enter to skip): ";
- final HashMap<String,String> localOptions = new HashMap<String,String>();
+ final HashMap<String,String> localOptions = new HashMap<>();
while (true) {
reader.flush();
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/shell/src/main/java/org/apache/accumulo/shell/commands/SetScanIterCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/SetScanIterCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/SetScanIterCommand.java
index e7d2793..2399d0e 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/SetScanIterCommand.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/SetScanIterCommand.java
@@ -63,7 +63,7 @@ public class SetScanIterCommand extends SetIterCommand {
List<IteratorSetting> tableScanIterators = shellState.scanIteratorOptions.get(tableName);
if (tableScanIterators == null) {
- tableScanIterators = new ArrayList<IteratorSetting>();
+ tableScanIterators = new ArrayList<>();
shellState.scanIteratorOptions.put(tableName, tableScanIterators);
}
final IteratorSetting setting = new IteratorSetting(priority, name, classname);
@@ -92,7 +92,7 @@ public class SetScanIterCommand extends SetIterCommand {
public Options getOptions() {
// Remove the options that specify which type of iterator this is, since
// they are all scan iterators with this command.
- final HashSet<OptionGroup> groups = new HashSet<OptionGroup>();
+ final HashSet<OptionGroup> groups = new HashSet<>();
final Options parentOptions = super.getOptions();
final Options modifiedOptions = new Options();
for (Iterator<?> it = parentOptions.getOptions().iterator(); it.hasNext();) {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/shell/src/main/java/org/apache/accumulo/shell/commands/SetShellIterCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/SetShellIterCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/SetShellIterCommand.java
index ad66995..e1fa5e0 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/SetShellIterCommand.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/SetShellIterCommand.java
@@ -62,7 +62,7 @@ public class SetShellIterCommand extends SetIterCommand {
List<IteratorSetting> tableScanIterators = shellState.iteratorProfiles.get(profile);
if (tableScanIterators == null) {
- tableScanIterators = new ArrayList<IteratorSetting>();
+ tableScanIterators = new ArrayList<>();
shellState.iteratorProfiles.put(profile, tableScanIterators);
}
final IteratorSetting setting = new IteratorSetting(priority, name, classname);
@@ -87,7 +87,7 @@ public class SetShellIterCommand extends SetIterCommand {
public Options getOptions() {
// Remove the options that specify which type of iterator this is, since
// they are all scan iterators with this command.
- final HashSet<OptionGroup> groups = new HashSet<OptionGroup>();
+ final HashSet<OptionGroup> groups = new HashSet<>();
final Options parentOptions = super.getOptions();
final Options modifiedOptions = new Options();
for (Iterator<?> it = parentOptions.getOptions().iterator(); it.hasNext();) {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/shell/src/main/java/org/apache/accumulo/shell/commands/TableOperation.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/TableOperation.java b/shell/src/main/java/org/apache/accumulo/shell/commands/TableOperation.java
index b7d0f44..6ad1246 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/TableOperation.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/TableOperation.java
@@ -43,7 +43,7 @@ public abstract class TableOperation extends Command {
@Override
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws Exception {
// populate the tableSet set with the tables you want to operate on
- final SortedSet<String> tableSet = new TreeSet<String>();
+ final SortedSet<String> tableSet = new TreeSet<>();
if (cl.hasOption(optTablePattern.getOpt())) {
String tablePattern = cl.getOptionValue(optTablePattern.getOpt());
for (String table : shellState.getConnector().tableOperations().list())
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/shell/src/main/java/org/apache/accumulo/shell/commands/TablesCommand.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/TablesCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/TablesCommand.java
index a70cc13..397b450 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/TablesCommand.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/TablesCommand.java
@@ -62,7 +62,7 @@ public class TablesCommand extends Command {
});
final boolean sortByTableId = cl.hasOption(sortByTableIdOption.getOpt());
- tables = new TreeMap<String,String>((sortByTableId ? MapUtils.invertMap(tables) : tables));
+ tables = new TreeMap<>((sortByTableId ? MapUtils.invertMap(tables) : tables));
Iterator<String> it = Iterators.transform(tables.entrySet().iterator(), new Function<Entry<String,String>,String>() {
@Override
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/shell/src/test/java/org/apache/accumulo/shell/ShellSetInstanceTest.java
----------------------------------------------------------------------
diff --git a/shell/src/test/java/org/apache/accumulo/shell/ShellSetInstanceTest.java b/shell/src/test/java/org/apache/accumulo/shell/ShellSetInstanceTest.java
index 331b183..428481a 100644
--- a/shell/src/test/java/org/apache/accumulo/shell/ShellSetInstanceTest.java
+++ b/shell/src/test/java/org/apache/accumulo/shell/ShellSetInstanceTest.java
@@ -243,7 +243,7 @@ public class ShellSetInstanceTest {
expect(clientConf.getString(ClientProperty.INSTANCE_NAME.getKey())).andReturn("foo");
expect(clientConf.withZkHosts("host1,host2")).andReturn(clientConf);
expect(clientConf.getString(ClientProperty.INSTANCE_ZK_HOST.getKey())).andReturn("host1,host2");
- List<String> zl = new java.util.ArrayList<String>();
+ List<String> zl = new java.util.ArrayList<>();
zl.add("foo");
zl.add("host1,host2");
expect(opts.getZooKeeperInstance()).andReturn(zl);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/shell/src/test/java/org/apache/accumulo/shell/commands/DeleteTableCommandTest.java
----------------------------------------------------------------------
diff --git a/shell/src/test/java/org/apache/accumulo/shell/commands/DeleteTableCommandTest.java b/shell/src/test/java/org/apache/accumulo/shell/commands/DeleteTableCommandTest.java
index 4877552..ad9624f 100644
--- a/shell/src/test/java/org/apache/accumulo/shell/commands/DeleteTableCommandTest.java
+++ b/shell/src/test/java/org/apache/accumulo/shell/commands/DeleteTableCommandTest.java
@@ -32,11 +32,11 @@ public class DeleteTableCommandTest {
@Test
public void removeAccumuloNamespaceTables() {
- Set<String> tables = new HashSet<String>(Arrays.asList(MetadataTable.NAME, RootTable.NAME, "a1", "a2"));
+ Set<String> tables = new HashSet<>(Arrays.asList(MetadataTable.NAME, RootTable.NAME, "a1", "a2"));
DeleteTableCommand cmd = new DeleteTableCommand();
cmd.pruneTables("a.*", tables);
- Assert.assertEquals(new HashSet<String>(Arrays.asList("a1", "a2")), tables);
+ Assert.assertEquals(new HashSet<>(Arrays.asList("a1", "a2")), tables);
}
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/shell/src/test/java/org/apache/accumulo/shell/format/DeleterFormatterTest.java
----------------------------------------------------------------------
diff --git a/shell/src/test/java/org/apache/accumulo/shell/format/DeleterFormatterTest.java b/shell/src/test/java/org/apache/accumulo/shell/format/DeleterFormatterTest.java
index 0698beb..2eba15e 100644
--- a/shell/src/test/java/org/apache/accumulo/shell/format/DeleterFormatterTest.java
+++ b/shell/src/test/java/org/apache/accumulo/shell/format/DeleterFormatterTest.java
@@ -34,6 +34,7 @@ import java.io.InputStream;
import java.util.Collections;
import java.util.Map;
import java.util.TreeMap;
+
import org.apache.accumulo.core.client.BatchWriter;
import org.apache.accumulo.core.client.MutationsRejectedException;
import org.apache.accumulo.core.data.Key;
@@ -41,11 +42,11 @@ import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.util.format.FormatterConfig;
import org.apache.accumulo.shell.Shell;
+import org.junit.Before;
+import org.junit.Test;
import jline.UnsupportedTerminal;
import jline.console.ConsoleReader;
-import org.junit.Before;
-import org.junit.Test;
public class DeleterFormatterTest {
DeleterFormatter formatter;
@@ -70,7 +71,7 @@ public class DeleterFormatterTest {
public void set(String in) {
bais = new ByteArrayInputStream(in.getBytes(UTF_8));
}
- };
+ }
@Before
public void setUp() throws IOException, MutationsRejectedException {
@@ -93,7 +94,7 @@ public class DeleterFormatterTest {
replay(writer, exceptionWriter, shellState);
- data = new TreeMap<Key,Value>();
+ data = new TreeMap<>();
data.put(new Key("r", "cf", "cq"), new Value("value".getBytes(UTF_8)));
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/start/src/main/java/org/apache/accumulo/start/classloader/AccumuloClassLoader.java
----------------------------------------------------------------------
diff --git a/start/src/main/java/org/apache/accumulo/start/classloader/AccumuloClassLoader.java b/start/src/main/java/org/apache/accumulo/start/classloader/AccumuloClassLoader.java
index 9ebbae0..991e89e 100644
--- a/start/src/main/java/org/apache/accumulo/start/classloader/AccumuloClassLoader.java
+++ b/start/src/main/java/org/apache/accumulo/start/classloader/AccumuloClassLoader.java
@@ -224,9 +224,9 @@ public class AccumuloClassLoader {
private static ArrayList<URL> findAccumuloURLs() throws IOException {
String cp = getAccumuloString(AccumuloClassLoader.CLASSPATH_PROPERTY_NAME, AccumuloClassLoader.ACCUMULO_CLASSPATH_VALUE);
if (cp == null)
- return new ArrayList<URL>();
+ return new ArrayList<>();
String[] cps = replaceEnvVars(cp, System.getenv()).split(",");
- ArrayList<URL> urls = new ArrayList<URL>();
+ ArrayList<URL> urls = new ArrayList<>();
for (String classpath : getMavenClasspaths())
addUrl(classpath, urls);
for (String classpath : cps) {
@@ -241,7 +241,7 @@ public class AccumuloClassLoader {
String baseDirname = AccumuloClassLoader.getAccumuloString(MAVEN_PROJECT_BASEDIR_PROPERTY_NAME, DEFAULT_MAVEN_PROJECT_BASEDIR_VALUE);
if (baseDirname == null || baseDirname.trim().isEmpty())
return Collections.emptySet();
- Set<String> paths = new TreeSet<String>();
+ Set<String> paths = new TreeSet<>();
findMavenTargetClasses(paths, new File(baseDirname.trim()), 0);
return paths;
}