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/11/04 22:17:06 UTC
[29/48] accumulo git commit: ACCUMULO-4514 Remove unnecessary code
http://git-wip-us.apache.org/repos/asf/accumulo/blob/717febbf/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java
index 6f9ea29..1e7b4ec 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java
@@ -133,7 +133,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
@Override
public SortedSet<String> list() {
OpTimer opTimer = new OpTimer(log, Level.TRACE).start("Fetching list of tables...");
- TreeSet<String> tableNames = new TreeSet<String>(Tables.getNameToIdMap(context.getInstance()).keySet());
+ TreeSet<String> tableNames = new TreeSet<>(Tables.getNameToIdMap(context.getInstance()).keySet());
opTimer.stop("Fetched " + tableNames.size() + " table names in %DURATION%");
return tableNames;
}
@@ -346,7 +346,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
return;
if (splits.size() <= 2) {
- addSplits(env.tableName, new TreeSet<Text>(splits), env.tableId);
+ addSplits(env.tableName, new TreeSet<>(splits), env.tableId);
for (int i = 0; i < splits.size(); i++)
env.latch.countDown();
return;
@@ -356,7 +356,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
// split the middle split point to ensure that child task split different tablets and can therefore
// run in parallel
- addSplits(env.tableName, new TreeSet<Text>(splits.subList(mid, mid + 1)), env.tableId);
+ addSplits(env.tableName, new TreeSet<>(splits.subList(mid, mid + 1)), env.tableId);
env.latch.countDown();
env.executor.submit(new SplitTask(env, splits.subList(0, mid)));
@@ -373,13 +373,13 @@ public class TableOperationsImpl extends TableOperationsHelper {
public void addSplits(String tableName, SortedSet<Text> partitionKeys) throws TableNotFoundException, AccumuloException, AccumuloSecurityException {
String tableId = Tables.getTableId(context.getInstance(), tableName);
- List<Text> splits = new ArrayList<Text>(partitionKeys);
+ List<Text> splits = new ArrayList<>(partitionKeys);
// should be sorted because we copied from a sorted set, but that makes assumptions about
// how the copy was done so resort to be sure.
Collections.sort(splits);
CountDownLatch latch = new CountDownLatch(splits.size());
- AtomicReference<Exception> exception = new AtomicReference<Exception>(null);
+ AtomicReference<Exception> exception = new AtomicReference<>(null);
ExecutorService executor = Executors.newFixedThreadPool(16, new NamingThreadFactory("addSplits"));
try {
@@ -491,7 +491,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
ByteBuffer EMPTY = ByteBuffer.allocate(0);
List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableName.getBytes(UTF_8)), start == null ? EMPTY : TextUtil.getByteBuffer(start),
end == null ? EMPTY : TextUtil.getByteBuffer(end));
- Map<String,String> opts = new HashMap<String,String>();
+ Map<String,String> opts = new HashMap<>();
try {
doTableFateOperation(tableName, TableNotFoundException.class, FateOperation.TABLE_MERGE, args, opts);
} catch (TableExistsException e) {
@@ -507,7 +507,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
ByteBuffer EMPTY = ByteBuffer.allocate(0);
List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableName.getBytes(UTF_8)), start == null ? EMPTY : TextUtil.getByteBuffer(start),
end == null ? EMPTY : TextUtil.getByteBuffer(end));
- Map<String,String> opts = new HashMap<String,String>();
+ Map<String,String> opts = new HashMap<>();
try {
doTableFateOperation(tableName, TableNotFoundException.class, FateOperation.TABLE_DELETE_RANGE, args, opts);
} catch (TableExistsException e) {
@@ -523,7 +523,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
String tableId = Tables.getTableId(context.getInstance(), tableName);
- TreeMap<KeyExtent,String> tabletLocations = new TreeMap<KeyExtent,String>();
+ TreeMap<KeyExtent,String> tabletLocations = new TreeMap<>();
while (true) {
try {
@@ -547,7 +547,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
}
}
- ArrayList<Text> endRows = new ArrayList<Text>(tabletLocations.size());
+ ArrayList<Text> endRows = new ArrayList<>(tabletLocations.size());
for (KeyExtent ke : tabletLocations.keySet())
if (ke.getEndRow() != null)
@@ -576,7 +576,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
double r = (maxSplits + 1) / (double) (endRows.size());
double pos = 0;
- ArrayList<Text> subset = new ArrayList<Text>(maxSplits);
+ ArrayList<Text> subset = new ArrayList<>(maxSplits);
int j = 0;
for (int i = 0; i < endRows.size() && j < maxSplits; i++) {
@@ -606,7 +606,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
checkArgument(tableName != null, "tableName is null");
List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableName.getBytes(UTF_8)));
- Map<String,String> opts = new HashMap<String,String>();
+ Map<String,String> opts = new HashMap<>();
try {
doTableFateOperation(tableName, TableNotFoundException.class, FateOperation.TABLE_DELETE, args, opts);
@@ -636,7 +636,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
propertiesToSet = Collections.emptyMap();
List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(srcTableId.getBytes(UTF_8)), ByteBuffer.wrap(newTableName.getBytes(UTF_8)));
- Map<String,String> opts = new HashMap<String,String>();
+ Map<String,String> opts = new HashMap<>();
for (Entry<String,String> entry : propertiesToSet.entrySet()) {
if (entry.getKey().startsWith(CLONE_EXCLUDE_PREFIX))
throw new IllegalArgumentException("Property can not start with " + CLONE_EXCLUDE_PREFIX);
@@ -655,7 +655,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
TableExistsException {
List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(oldTableName.getBytes(UTF_8)), ByteBuffer.wrap(newTableName.getBytes(UTF_8)));
- Map<String,String> opts = new HashMap<String,String>();
+ Map<String,String> opts = new HashMap<>();
doTableFateOperation(oldTableName, TableNotFoundException.class, FateOperation.TABLE_RENAME, args, opts);
}
@@ -723,7 +723,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
: TextUtil.getByteBuffer(end), ByteBuffer.wrap(IteratorUtil.encodeIteratorSettings(config.getIterators())), ByteBuffer
.wrap(CompactionStrategyConfigUtil.encode(config.getCompactionStrategy())));
- Map<String,String> opts = new HashMap<String,String>();
+ Map<String,String> opts = new HashMap<>();
try {
doFateOperation(FateOperation.TABLE_COMPACT, args, opts, tableName, config.getWait());
} catch (TableExistsException e) {
@@ -743,7 +743,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableId.getBytes(UTF_8)));
- Map<String,String> opts = new HashMap<String,String>();
+ Map<String,String> opts = new HashMap<>();
try {
doTableFateOperation(tableName, TableNotFoundException.class, FateOperation.TABLE_CANCEL_COMPACT, args, opts);
} catch (TableExistsException e) {
@@ -872,7 +872,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
@Override
public void setLocalityGroups(String tableName, Map<String,Set<Text>> groups) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
// ensure locality groups do not overlap
- HashSet<Text> all = new HashSet<Text>();
+ HashSet<Text> all = new HashSet<>();
for (Entry<String,Set<Text>> entry : groups.entrySet()) {
if (!Collections.disjoint(all, entry.getValue())) {
@@ -918,10 +918,10 @@ public class TableOperationsImpl extends TableOperationsHelper {
AccumuloConfiguration conf = new ConfigurationCopy(this.getProperties(tableName));
Map<String,Set<ByteSequence>> groups = LocalityGroupUtil.getLocalityGroups(conf);
- Map<String,Set<Text>> groups2 = new HashMap<String,Set<Text>>();
+ Map<String,Set<Text>> groups2 = new HashMap<>();
for (Entry<String,Set<ByteSequence>> entry : groups.entrySet()) {
- HashSet<Text> colFams = new HashSet<Text>();
+ HashSet<Text> colFams = new HashSet<>();
for (ByteSequence bs : entry.getValue()) {
colFams.add(new Text(bs.toArray()));
@@ -944,7 +944,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
return Collections.singleton(range);
Random random = new Random();
- Map<String,Map<KeyExtent,List<Range>>> binnedRanges = new HashMap<String,Map<KeyExtent,List<Range>>>();
+ Map<String,Map<KeyExtent,List<Range>>> binnedRanges = new HashMap<>();
String tableId = Tables.getTableId(context.getInstance(), tableName);
TabletLocator tl = TabletLocator.getLocator(context, new Text(tableId));
// its possible that the cache could contain complete, but old information about a tables tablets... so clear it
@@ -963,8 +963,8 @@ public class TableOperationsImpl extends TableOperationsHelper {
}
// group key extents to get <= maxSplits
- LinkedList<KeyExtent> unmergedExtents = new LinkedList<KeyExtent>();
- List<KeyExtent> mergedExtents = new ArrayList<KeyExtent>();
+ LinkedList<KeyExtent> unmergedExtents = new LinkedList<>();
+ List<KeyExtent> mergedExtents = new ArrayList<>();
for (Map<KeyExtent,List<Range>> map : binnedRanges.values())
unmergedExtents.addAll(map.keySet());
@@ -989,7 +989,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
mergedExtents.addAll(unmergedExtents);
- Set<Range> ranges = new HashSet<Range>();
+ Set<Range> ranges = new HashSet<>();
for (KeyExtent k : mergedExtents)
ranges.add(k.toDataRange().clip(range));
@@ -1040,7 +1040,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableName.getBytes(UTF_8)), ByteBuffer.wrap(dirPath.toString().getBytes(UTF_8)),
ByteBuffer.wrap(failPath.toString().getBytes(UTF_8)), ByteBuffer.wrap((setTime + "").getBytes(UTF_8)));
- Map<String,String> opts = new HashMap<String,String>();
+ Map<String,String> opts = new HashMap<>();
try {
doTableFateOperation(tableName, TableNotFoundException.class, FateOperation.TABLE_BULK_IMPORT, args, opts);
@@ -1087,7 +1087,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
int waitFor = 0;
int holes = 0;
Text continueRow = null;
- MapCounter<String> serverCounts = new MapCounter<String>();
+ MapCounter<String> serverCounts = new MapCounter<>();
while (rowIter.hasNext()) {
Iterator<Entry<Key,Value>> row = rowIter.next();
@@ -1187,7 +1187,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
checkArgument(tableName != null, "tableName is null");
String tableId = Tables.getTableId(context.getInstance(), tableName);
List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableId.getBytes(UTF_8)));
- Map<String,String> opts = new HashMap<String,String>();
+ Map<String,String> opts = new HashMap<>();
try {
doTableFateOperation(tableName, TableNotFoundException.class, FateOperation.TABLE_OFFLINE, args, opts);
@@ -1210,7 +1210,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
checkArgument(tableName != null, "tableName is null");
String tableId = Tables.getTableId(context.getInstance(), tableName);
List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableId.getBytes(UTF_8)));
- Map<String,String> opts = new HashMap<String,String>();
+ Map<String,String> opts = new HashMap<>();
try {
doTableFateOperation(tableName, TableNotFoundException.class, FateOperation.TABLE_ONLINE, args, opts);
@@ -1284,16 +1284,16 @@ public class TableOperationsImpl extends TableOperationsHelper {
}
}
- List<DiskUsage> finalUsages = new ArrayList<DiskUsage>();
+ List<DiskUsage> finalUsages = new ArrayList<>();
for (TDiskUsage diskUsage : diskUsages) {
- finalUsages.add(new DiskUsage(new TreeSet<String>(diskUsage.getTables()), diskUsage.getUsage()));
+ finalUsages.add(new DiskUsage(new TreeSet<>(diskUsage.getTables()), diskUsage.getUsage()));
}
return finalUsages;
}
public static Map<String,String> getExportedProps(FileSystem fs, Path path) throws IOException {
- HashMap<String,String> props = new HashMap<String,String>();
+ HashMap<String,String> props = new HashMap<>();
ZipInputStream zis = new ZipInputStream(fs.open(path));
try {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/717febbf/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java b/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java
index beacea9..58ebb72 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java
@@ -60,8 +60,8 @@ public class Tables {
ZooCache zc = getZooCache(instance);
List<String> tableIds = zc.getChildren(ZooUtil.getRoot(instance) + Constants.ZTABLES);
- TreeMap<String,String> tableMap = new TreeMap<String,String>();
- Map<String,String> namespaceIdToNameMap = new HashMap<String,String>();
+ TreeMap<String,String> tableMap = new TreeMap<>();
+ Map<String,String> namespaceIdToNameMap = new HashMap<>();
for (String tableId : tableIds) {
byte[] tableName = zc.get(ZooUtil.getRoot(instance) + Constants.ZTABLES + "/" + tableId + Constants.ZTABLE_NAME);
@@ -211,9 +211,9 @@ public class Tables {
tableName = MetadataTable.NAME;
if (tableName.contains(".")) {
String[] s = tableName.split("\\.", 2);
- return new Pair<String,String>(s[0], s[1]);
+ return new Pair<>(s[0], s[1]);
}
- return new Pair<String,String>(defaultNamespace, tableName);
+ return new Pair<>(defaultNamespace, tableName);
}
/**
http://git-wip-us.apache.org/repos/asf/accumulo/blob/717febbf/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocator.java b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocator.java
index 1fbaee8..5ecc319 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocator.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocator.java
@@ -90,7 +90,7 @@ public abstract class TabletLocator {
}
- private static HashMap<LocatorKey,TabletLocator> locators = new HashMap<LocatorKey,TabletLocator>();
+ private static HashMap<LocatorKey,TabletLocator> locators = new HashMap<>();
public static synchronized void clearLocators() {
locators.clear();
@@ -136,7 +136,7 @@ public abstract class TabletLocator {
}
public static class TabletLocation implements Comparable<TabletLocation> {
- private static final WeakHashMap<String,WeakReference<String>> tabletLocs = new WeakHashMap<String,WeakReference<String>>();
+ private static final WeakHashMap<String,WeakReference<String>> tabletLocs = new WeakHashMap<>();
private static String dedupeLocation(String tabletLoc) {
synchronized (tabletLocs) {
@@ -148,7 +148,7 @@ public abstract class TabletLocator {
}
}
- tabletLocs.put(tabletLoc, new WeakReference<String>(tabletLoc));
+ tabletLocs.put(tabletLoc, new WeakReference<>(tabletLoc));
return tabletLoc;
}
}
@@ -203,13 +203,13 @@ public abstract class TabletLocator {
public TabletServerMutations(String tserverSession) {
this.tserverSession = tserverSession;
- this.mutations = new HashMap<KeyExtent,List<T>>();
+ this.mutations = new HashMap<>();
}
public void addMutation(KeyExtent ke, T m) {
List<T> mutList = mutations.get(ke);
if (mutList == null) {
- mutList = new ArrayList<T>();
+ mutList = new ArrayList<>();
mutations.put(ke, mutList);
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/717febbf/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocatorImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocatorImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocatorImpl.java
index c28320d..63f3eb5 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocatorImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocatorImpl.java
@@ -88,12 +88,12 @@ public class TabletLocatorImpl extends TabletLocator {
protected Text tableId;
protected TabletLocator parent;
- protected TreeMap<Text,TabletLocation> metaCache = new TreeMap<Text,TabletLocation>(endRowComparator);
+ protected TreeMap<Text,TabletLocation> metaCache = new TreeMap<>(endRowComparator);
protected TabletLocationObtainer locationObtainer;
private TabletServerLockChecker lockChecker;
protected Text lastTabletRow;
- private TreeSet<KeyExtent> badExtents = new TreeSet<KeyExtent>();
+ private TreeSet<KeyExtent> badExtents = new TreeSet<>();
private ReentrantReadWriteLock rwLock = new ReentrantReadWriteLock();
private final Lock rLock = rwLock.readLock();
private final Lock wLock = rwLock.writeLock();
@@ -117,8 +117,8 @@ public class TabletLocatorImpl extends TabletLocator {
private class LockCheckerSession {
- private HashSet<Pair<String,String>> okLocks = new HashSet<Pair<String,String>>();
- private HashSet<Pair<String,String>> invalidLocks = new HashSet<Pair<String,String>>();
+ private HashSet<Pair<String,String>> okLocks = new HashSet<>();
+ private HashSet<Pair<String,String>> invalidLocks = new HashSet<>();
private TabletLocation checkLock(TabletLocation tl) {
// the goal of this class is to minimize calls out to lockChecker under that assumption that its a resource synchronized among many threads... want to
@@ -128,7 +128,7 @@ public class TabletLocatorImpl extends TabletLocator {
if (tl == null)
return null;
- Pair<String,String> lock = new Pair<String,String>(tl.tablet_location, tl.tablet_session);
+ Pair<String,String> lock = new Pair<>(tl.tablet_location, tl.tablet_session);
if (okLocks.contains(lock))
return tl;
@@ -168,7 +168,7 @@ public class TabletLocatorImpl extends TabletLocator {
if (log.isTraceEnabled())
opTimer = new OpTimer(log, Level.TRACE).start("Binning " + mutations.size() + " mutations for table " + tableId);
- ArrayList<T> notInCache = new ArrayList<T>();
+ ArrayList<T> notInCache = new ArrayList<>();
Text row = new Text();
LockCheckerSession lcSession = new LockCheckerSession();
@@ -238,7 +238,7 @@ public class TabletLocatorImpl extends TabletLocator {
// do lock check once per tserver here to make binning faster
boolean lockHeld = lcSession.checkLock(tl) != null;
if (lockHeld) {
- tsm = new TabletServerMutations<T>(tl.tablet_session);
+ tsm = new TabletServerMutations<>(tl.tablet_session);
binnedMutations.put(tl.tablet_location, tsm);
} else {
return false;
@@ -256,8 +256,8 @@ public class TabletLocatorImpl extends TabletLocator {
private List<Range> binRanges(ClientContext context, List<Range> ranges, Map<String,Map<KeyExtent,List<Range>>> binnedRanges, boolean useCache,
LockCheckerSession lcSession) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
- List<Range> failures = new ArrayList<Range>();
- List<TabletLocation> tabletLocations = new ArrayList<TabletLocation>();
+ List<Range> failures = new ArrayList<>();
+ List<TabletLocation> tabletLocations = new ArrayList<>();
boolean lookupFailed = false;
@@ -656,7 +656,7 @@ public class TabletLocatorImpl extends TabletLocator {
return;
}
- List<Range> lookups = new ArrayList<Range>(badExtents.size());
+ List<Range> lookups = new ArrayList<>(badExtents.size());
for (KeyExtent be : badExtents) {
lookups.add(be.toMetadataRange());
@@ -665,12 +665,12 @@ public class TabletLocatorImpl extends TabletLocator {
lookups = Range.mergeOverlapping(lookups);
- Map<String,Map<KeyExtent,List<Range>>> binnedRanges = new HashMap<String,Map<KeyExtent,List<Range>>>();
+ Map<String,Map<KeyExtent,List<Range>>> binnedRanges = new HashMap<>();
parent.binRanges(context, lookups, binnedRanges);
// randomize server order
- ArrayList<String> tabletServers = new ArrayList<String>(binnedRanges.keySet());
+ ArrayList<String> tabletServers = new ArrayList<>(binnedRanges.keySet());
Collections.shuffle(tabletServers);
for (String tserver : tabletServers) {
@@ -691,13 +691,13 @@ public class TabletLocatorImpl extends TabletLocator {
protected static void addRange(Map<String,Map<KeyExtent,List<Range>>> binnedRanges, String location, KeyExtent ke, Range range) {
Map<KeyExtent,List<Range>> tablets = binnedRanges.get(location);
if (tablets == null) {
- tablets = new HashMap<KeyExtent,List<Range>>();
+ tablets = new HashMap<>();
binnedRanges.put(location, tablets);
}
List<Range> tabletsRanges = tablets.get(ke);
if (tabletsRanges == null) {
- tabletsRanges = new ArrayList<Range>();
+ tabletsRanges = new ArrayList<>();
tablets.put(ke, tabletsRanges);
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/717febbf/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReader.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReader.java b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReader.java
index 6d09936..5eabf15 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReader.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReader.java
@@ -98,7 +98,7 @@ public class TabletServerBatchReader extends ScannerOptions implements BatchScan
throw new IllegalStateException("batch reader closed");
}
- this.ranges = new ArrayList<Range>(ranges);
+ this.ranges = new ArrayList<>(ranges);
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/717febbf/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java
index 053f2b3..3c29c16 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java
@@ -87,7 +87,7 @@ public class TabletServerBatchReaderIterator implements Iterator<Entry<Key,Value
private ArrayBlockingQueue<List<Entry<Key,Value>>> resultsQueue;
private Iterator<Entry<Key,Value>> batchIterator;
private List<Entry<Key,Value>> batch;
- private static final List<Entry<Key,Value>> LAST_BATCH = new ArrayList<Map.Entry<Key,Value>>();
+ private static final List<Entry<Key,Value>> LAST_BATCH = new ArrayList<>();
private final Object nextLock = new Object();
private long failSleepTime = 100;
@@ -114,7 +114,7 @@ public class TabletServerBatchReaderIterator implements Iterator<Entry<Key,Value
this.numThreads = numThreads;
this.queryThreadPool = queryThreadPool;
this.options = new ScannerOptions(scannerOptions);
- resultsQueue = new ArrayBlockingQueue<List<Entry<Key,Value>>>(numThreads);
+ resultsQueue = new ArrayBlockingQueue<>(numThreads);
this.locator = new TimeoutTabletLocator(TabletLocator.getLocator(context, new Text(table)), timeout);
@@ -123,7 +123,7 @@ public class TabletServerBatchReaderIterator implements Iterator<Entry<Key,Value
this.timeout = timeout;
if (options.fetchedColumns.size() > 0) {
- ArrayList<Range> ranges2 = new ArrayList<Range>(ranges.size());
+ ArrayList<Range> ranges2 = new ArrayList<>(ranges.size());
for (Range range : ranges) {
ranges2.add(range.bound(options.fetchedColumns.first(), options.fetchedColumns.last()));
}
@@ -212,10 +212,10 @@ public class TabletServerBatchReaderIterator implements Iterator<Entry<Key,Value
}
private synchronized void lookup(List<Range> ranges, ResultReceiver receiver) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
- List<Column> columns = new ArrayList<Column>(options.fetchedColumns);
+ List<Column> columns = new ArrayList<>(options.fetchedColumns);
ranges = Range.mergeOverlapping(ranges);
- Map<String,Map<KeyExtent,List<Range>>> binnedRanges = new HashMap<String,Map<KeyExtent,List<Range>>>();
+ Map<String,Map<KeyExtent,List<Range>>> binnedRanges = new HashMap<>();
binRanges(locator, ranges, binnedRanges);
@@ -260,13 +260,13 @@ public class TabletServerBatchReaderIterator implements Iterator<Entry<Key,Value
// truncate the ranges to within the tablets... this makes it easier to know what work
// needs to be redone when failures occurs and tablets have merged or split
- Map<String,Map<KeyExtent,List<Range>>> binnedRanges2 = new HashMap<String,Map<KeyExtent,List<Range>>>();
+ Map<String,Map<KeyExtent,List<Range>>> binnedRanges2 = new HashMap<>();
for (Entry<String,Map<KeyExtent,List<Range>>> entry : binnedRanges.entrySet()) {
- Map<KeyExtent,List<Range>> tabletMap = new HashMap<KeyExtent,List<Range>>();
+ Map<KeyExtent,List<Range>> tabletMap = new HashMap<>();
binnedRanges2.put(entry.getKey(), tabletMap);
for (Entry<KeyExtent,List<Range>> tabletRanges : entry.getValue().entrySet()) {
Range tabletRange = tabletRanges.getKey().toDataRange();
- List<Range> clippedRanges = new ArrayList<Range>();
+ List<Range> clippedRanges = new ArrayList<>();
tabletMap.put(tabletRanges.getKey(), clippedRanges);
for (Range range : tabletRanges.getValue())
clippedRanges.add(tabletRange.clip(range));
@@ -294,8 +294,8 @@ public class TabletServerBatchReaderIterator implements Iterator<Entry<Key,Value
failSleepTime = Math.min(5000, failSleepTime * 2);
- Map<String,Map<KeyExtent,List<Range>>> binnedRanges = new HashMap<String,Map<KeyExtent,List<Range>>>();
- List<Range> allRanges = new ArrayList<Range>();
+ Map<String,Map<KeyExtent,List<Range>>> binnedRanges = new HashMap<>();
+ List<Range> allRanges = new ArrayList<>();
for (List<Range> ranges : failures.values())
allRanges.addAll(ranges);
@@ -338,8 +338,8 @@ public class TabletServerBatchReaderIterator implements Iterator<Entry<Key,Value
public void run() {
String threadName = Thread.currentThread().getName();
Thread.currentThread().setName(threadName + " looking up " + tabletsRanges.size() + " ranges at " + tsLocation);
- Map<KeyExtent,List<Range>> unscanned = new HashMap<KeyExtent,List<Range>>();
- Map<KeyExtent,List<Range>> tsFailures = new HashMap<KeyExtent,List<Range>>();
+ Map<KeyExtent,List<Range>> unscanned = new HashMap<>();
+ Map<KeyExtent,List<Range>> tsFailures = new HashMap<>();
try {
TimeoutTracker timeoutTracker = timeoutTrackers.get(tsLocation);
if (timeoutTracker == null) {
@@ -456,7 +456,7 @@ public class TabletServerBatchReaderIterator implements Iterator<Entry<Key,Value
}
- Map<KeyExtent,List<Range>> failures = new HashMap<KeyExtent,List<Range>>();
+ Map<KeyExtent,List<Range>> failures = new HashMap<>();
if (timedoutServers.size() > 0) {
// go ahead and fail any timed out servers
@@ -471,10 +471,10 @@ public class TabletServerBatchReaderIterator implements Iterator<Entry<Key,Value
// randomize tabletserver order... this will help when there are multiple
// batch readers and writers running against accumulo
- List<String> locations = new ArrayList<String>(binnedRanges.keySet());
+ List<String> locations = new ArrayList<>(binnedRanges.keySet());
Collections.shuffle(locations);
- List<QueryTask> queryTasks = new ArrayList<QueryTask>();
+ List<QueryTask> queryTasks = new ArrayList<>();
for (final String tsLocation : locations) {
@@ -483,13 +483,13 @@ public class TabletServerBatchReaderIterator implements Iterator<Entry<Key,Value
QueryTask queryTask = new QueryTask(tsLocation, tabletsRanges, failures, receiver, columns);
queryTasks.add(queryTask);
} else {
- HashMap<KeyExtent,List<Range>> tabletSubset = new HashMap<KeyExtent,List<Range>>();
+ HashMap<KeyExtent,List<Range>> tabletSubset = new HashMap<>();
for (Entry<KeyExtent,List<Range>> entry : tabletsRanges.entrySet()) {
tabletSubset.put(entry.getKey(), entry.getValue());
if (tabletSubset.size() >= maxTabletsPerRequest) {
QueryTask queryTask = new QueryTask(tsLocation, tabletSubset, failures, receiver, columns);
queryTasks.add(queryTask);
- tabletSubset = new HashMap<KeyExtent,List<Range>>();
+ tabletSubset = new HashMap<>();
}
}
@@ -512,13 +512,12 @@ public class TabletServerBatchReaderIterator implements Iterator<Entry<Key,Value
static void trackScanning(Map<KeyExtent,List<Range>> failures, Map<KeyExtent,List<Range>> unscanned, MultiScanResult scanResult) {
// translate returned failures, remove them from unscanned, and add them to failures
- Map<KeyExtent,List<Range>> retFailures = Translator.translate(scanResult.failures, Translators.TKET, new Translator.ListTranslator<TRange,Range>(
- Translators.TRT));
+ Map<KeyExtent,List<Range>> retFailures = Translator.translate(scanResult.failures, Translators.TKET, new Translator.ListTranslator<>(Translators.TRT));
unscanned.keySet().removeAll(retFailures.keySet());
failures.putAll(retFailures);
// translate full scans and remove them from unscanned
- HashSet<KeyExtent> fullScans = new HashSet<KeyExtent>(Translator.translate(scanResult.fullScans, Translators.TKET));
+ HashSet<KeyExtent> fullScans = new HashSet<>(Translator.translate(scanResult.fullScans, Translators.TKET));
unscanned.keySet().removeAll(fullScans);
// remove partial scan from unscanned
@@ -606,7 +605,7 @@ public class TabletServerBatchReaderIterator implements Iterator<Entry<Key,Value
// copy requested to unscanned map. we will remove ranges as they are scanned in trackScanning()
for (Entry<KeyExtent,List<Range>> entry : requested.entrySet()) {
- ArrayList<Range> ranges = new ArrayList<Range>();
+ ArrayList<Range> ranges = new ArrayList<>();
for (Range range : entry.getValue()) {
ranges.add(new Range(range));
}
@@ -631,8 +630,7 @@ public class TabletServerBatchReaderIterator implements Iterator<Entry<Key,Value
TabletType ttype = TabletType.type(requested.keySet());
boolean waitForWrites = !ThriftScanner.serversWaitedForWrites.get(ttype).contains(server);
- Map<TKeyExtent,List<TRange>> thriftTabletRanges = Translator.translate(requested, Translators.KET, new Translator.ListTranslator<Range,TRange>(
- Translators.RT));
+ Map<TKeyExtent,List<TRange>> thriftTabletRanges = Translator.translate(requested, Translators.KET, new Translator.ListTranslator<>(Translators.RT));
InitialMultiScan imsr = client.startMultiScan(Tracer.traceInfo(), context.rpcCreds(), thriftTabletRanges,
Translator.translate(columns, Translators.CT), options.serverSideIteratorList, options.serverSideIteratorOptions,
ByteBufferUtil.toByteBuffers(authorizations.getAuthorizations()), waitForWrites);
@@ -644,9 +642,9 @@ public class TabletServerBatchReaderIterator implements Iterator<Entry<Key,Value
opTimer.stop("Got 1st multi scan results, #results=" + scanResult.results.size() + (scanResult.more ? " scanID=" + imsr.scanID : "")
+ " in %DURATION%");
- ArrayList<Entry<Key,Value>> entries = new ArrayList<Map.Entry<Key,Value>>(scanResult.results.size());
+ ArrayList<Entry<Key,Value>> entries = new ArrayList<>(scanResult.results.size());
for (TKeyValue kv : scanResult.results) {
- entries.add(new SimpleImmutableEntry<Key,Value>(new Key(kv.key), new Value(kv.value)));
+ entries.add(new SimpleImmutableEntry<>(new Key(kv.key), new Value(kv.value)));
}
if (entries.size() > 0)
@@ -666,9 +664,9 @@ public class TabletServerBatchReaderIterator implements Iterator<Entry<Key,Value
opTimer.stop("Got more multi scan results, #results=" + scanResult.results.size() + (scanResult.more ? " scanID=" + imsr.scanID : "")
+ " in %DURATION%");
- entries = new ArrayList<Map.Entry<Key,Value>>(scanResult.results.size());
+ entries = new ArrayList<>(scanResult.results.size());
for (TKeyValue kv : scanResult.results) {
- entries.add(new SimpleImmutableEntry<Key,Value>(new Key(kv.key), new Value(kv.value)));
+ entries.add(new SimpleImmutableEntry<>(new Key(kv.key), new Value(kv.value)));
}
if (entries.size() > 0)
http://git-wip-us.apache.org/repos/asf/accumulo/blob/717febbf/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchWriter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchWriter.java b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchWriter.java
index a8afa5a..f951bfb 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchWriter.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchWriter.java
@@ -151,8 +151,8 @@ public class TabletServerBatchWriter {
// error handling
private final Violations violations = new Violations();
- private final Map<KeyExtent,Set<SecurityErrorCode>> authorizationFailures = new HashMap<KeyExtent,Set<SecurityErrorCode>>();
- private final HashSet<String> serverSideErrors = new HashSet<String>();
+ private final Map<KeyExtent,Set<SecurityErrorCode>> authorizationFailures = new HashMap<>();
+ private final HashSet<String> serverSideErrors = new HashSet<>();
private final FailedMutations failedMutations = new FailedMutations();
private int unknownErrors = 0;
private boolean somethingFailed = false;
@@ -504,7 +504,7 @@ public class TabletServerBatchWriter {
}
private void updateAuthorizationFailures(Set<KeyExtent> keySet, SecurityErrorCode code) {
- HashMap<KeyExtent,SecurityErrorCode> map = new HashMap<KeyExtent,SecurityErrorCode>();
+ HashMap<KeyExtent,SecurityErrorCode> map = new HashMap<>();
for (KeyExtent ke : keySet)
map.put(ke, code);
@@ -515,7 +515,7 @@ public class TabletServerBatchWriter {
if (authorizationFailures.size() > 0) {
// was a table deleted?
- HashSet<String> tableIds = new HashSet<String>();
+ HashSet<String> tableIds = new HashSet<>();
for (KeyExtent ke : authorizationFailures.keySet())
tableIds.add(ke.getTableId().toString());
@@ -536,7 +536,7 @@ public class TabletServerBatchWriter {
for (Entry<KeyExtent,SecurityErrorCode> entry : addition.entrySet()) {
Set<SecurityErrorCode> secs = source.get(entry.getKey());
if (secs == null) {
- secs = new HashSet<SecurityErrorCode>();
+ secs = new HashSet<>();
source.put(entry.getKey(), secs);
}
secs.add(entry.getValue());
@@ -564,9 +564,9 @@ public class TabletServerBatchWriter {
private void checkForFailures() throws MutationsRejectedException {
if (somethingFailed) {
List<ConstraintViolationSummary> cvsList = violations.asList();
- HashMap<TabletId,Set<org.apache.accumulo.core.client.security.SecurityErrorCode>> af = new HashMap<TabletId,Set<org.apache.accumulo.core.client.security.SecurityErrorCode>>();
+ HashMap<TabletId,Set<org.apache.accumulo.core.client.security.SecurityErrorCode>> af = new HashMap<>();
for (Entry<KeyExtent,Set<SecurityErrorCode>> entry : authorizationFailures.entrySet()) {
- HashSet<org.apache.accumulo.core.client.security.SecurityErrorCode> codes = new HashSet<org.apache.accumulo.core.client.security.SecurityErrorCode>();
+ HashSet<org.apache.accumulo.core.client.security.SecurityErrorCode> codes = new HashSet<>();
for (SecurityErrorCode sce : entry.getValue()) {
codes.add(org.apache.accumulo.core.client.security.SecurityErrorCode.valueOf(sce.name()));
@@ -664,10 +664,10 @@ public class TabletServerBatchWriter {
private final Map<String,TabletLocator> locators;
public MutationWriter(int numSendThreads) {
- serversMutations = new HashMap<String,TabletServerMutations<Mutation>>();
- queued = new HashSet<String>();
+ serversMutations = new HashMap<>();
+ queued = new HashSet<>();
sendThreadPool = new SimpleThreadPool(numSendThreads, this.getClass().getName());
- locators = new HashMap<String,TabletLocator>();
+ locators = new HashMap<>();
binningThreadPool = new SimpleThreadPool(1, "BinMutations", new SynchronousQueue<Runnable>());
binningThreadPool.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
}
@@ -695,7 +695,7 @@ public class TabletServerBatchWriter {
List<Mutation> tableMutations = entry.getValue();
if (tableMutations != null) {
- ArrayList<Mutation> tableFailures = new ArrayList<Mutation>();
+ ArrayList<Mutation> tableFailures = new ArrayList<>();
locator.binMutations(context, tableMutations, binnedMutations, tableFailures);
if (tableFailures.size() > 0) {
@@ -752,7 +752,7 @@ public class TabletServerBatchWriter {
}
private void addMutations(MutationSet mutationsToSend) {
- Map<String,TabletServerMutations<Mutation>> binnedMutations = new HashMap<String,TabletServerMutations<Mutation>>();
+ Map<String,TabletServerMutations<Mutation>> binnedMutations = new HashMap<>();
Span span = Trace.start("binMutations");
try {
long t1 = System.currentTimeMillis();
@@ -795,7 +795,7 @@ public class TabletServerBatchWriter {
log.trace(String.format("Started sending %,d mutations to %,d tablet servers", count, binnedMutations.keySet().size()));
// randomize order of servers
- ArrayList<String> servers = new ArrayList<String>(binnedMutations.keySet());
+ ArrayList<String> servers = new ArrayList<>(binnedMutations.keySet());
Collections.shuffle(servers);
for (String server : servers)
@@ -848,7 +848,7 @@ public class TabletServerBatchWriter {
long count = 0;
- Set<Text> tableIds = new TreeSet<Text>();
+ Set<Text> tableIds = new TreeSet<>();
for (Map.Entry<KeyExtent,List<Mutation>> entry : mutationBatch.entrySet()) {
count += entry.getValue().size();
tableIds.add(entry.getKey().getTableId());
@@ -896,7 +896,7 @@ public class TabletServerBatchWriter {
if (log.isTraceEnabled())
log.trace("failed to send mutations to {} : {}", location, e.getMessage());
- HashSet<String> tables = new HashSet<String>();
+ HashSet<String> tables = new HashSet<>();
for (KeyExtent ke : mutationBatch.keySet())
tables.add(ke.getTableId().toString());
@@ -947,7 +947,7 @@ public class TabletServerBatchWriter {
long usid = client.startUpdate(tinfo, context.rpcCreds(), DurabilityImpl.toThrift(durability));
- List<TMutation> updates = new ArrayList<TMutation>();
+ List<TMutation> updates = new ArrayList<>();
for (Entry<KeyExtent,List<Mutation>> entry : tabMuts.entrySet()) {
long size = 0;
Iterator<Mutation> iter = entry.getValue().iterator();
@@ -1022,13 +1022,13 @@ public class TabletServerBatchWriter {
private int memoryUsed = 0;
MutationSet() {
- mutations = new HashMap<String,List<Mutation>>();
+ mutations = new HashMap<>();
}
void addMutation(String table, Mutation mutation) {
List<Mutation> tabMutList = mutations.get(table);
if (tabMutList == null) {
- tabMutList = new ArrayList<Mutation>();
+ tabMutList = new ArrayList<>();
mutations.put(table, tabMutList);
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/717febbf/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftScanner.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftScanner.java b/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftScanner.java
index d2fc259..cfb0235 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftScanner.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftScanner.java
@@ -71,7 +71,7 @@ import com.google.common.net.HostAndPort;
public class ThriftScanner {
private static final Logger log = Logger.getLogger(ThriftScanner.class);
- public static final Map<TabletType,Set<String>> serversWaitedForWrites = new EnumMap<TabletType,Set<String>>(TabletType.class);
+ public static final Map<TabletType,Set<String>> serversWaitedForWrites = new EnumMap<>(TabletType.class);
static {
for (TabletType ttype : TabletType.values()) {
@@ -164,7 +164,7 @@ public class ThriftScanner {
;
this.authorizations = authorizations;
- columns = new ArrayList<Column>(fetchedColumns.size());
+ columns = new ArrayList<>(fetchedColumns.size());
for (Column column : fetchedColumns) {
columns.add(column);
}
@@ -457,7 +457,7 @@ public class ThriftScanner {
if (sr.results.size() > 0 && !scanState.finished)
scanState.range = new Range(new Key(sr.results.get(sr.results.size() - 1).key), false, scanState.range.getEndKey(), scanState.range.isEndKeyInclusive());
- List<KeyValue> results = new ArrayList<KeyValue>(sr.results.size());
+ List<KeyValue> results = new ArrayList<>(sr.results.size());
for (TKeyValue tkv : sr.results)
results.add(new KeyValue(new Key(tkv.key), tkv.value));
http://git-wip-us.apache.org/repos/asf/accumulo/blob/717febbf/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftTransportPool.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftTransportPool.java b/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftTransportPool.java
index ba62cec..682ecbd 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftTransportPool.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftTransportPool.java
@@ -48,10 +48,10 @@ public class ThriftTransportPool {
private static final Random random = new Random();
private long killTime = 1000 * 3;
- private Map<ThriftTransportKey,List<CachedConnection>> cache = new HashMap<ThriftTransportKey,List<CachedConnection>>();
- private Map<ThriftTransportKey,Long> errorCount = new HashMap<ThriftTransportKey,Long>();
- private Map<ThriftTransportKey,Long> errorTime = new HashMap<ThriftTransportKey,Long>();
- private Set<ThriftTransportKey> serversWarnedAbout = new HashSet<ThriftTransportKey>();
+ private Map<ThriftTransportKey,List<CachedConnection>> cache = new HashMap<>();
+ private Map<ThriftTransportKey,Long> errorCount = new HashMap<>();
+ private Map<ThriftTransportKey,Long> errorTime = new HashMap<>();
+ private Set<ThriftTransportKey> serversWarnedAbout = new HashSet<>();
private CountDownLatch closerExitLatch;
@@ -95,7 +95,7 @@ public class ThriftTransportPool {
private void closeConnections() {
while (true) {
- ArrayList<CachedConnection> connectionsToClose = new ArrayList<CachedConnection>();
+ ArrayList<CachedConnection> connectionsToClose = new ArrayList<>();
synchronized (pool) {
for (List<CachedConnection> ccl : pool.getCache().values()) {
@@ -394,7 +394,7 @@ public class ThriftTransportPool {
List<CachedConnection> ccl = getCache().get(cacheKey);
if (ccl == null) {
- ccl = new LinkedList<CachedConnection>();
+ ccl = new LinkedList<>();
getCache().put(cacheKey, ccl);
}
@@ -413,10 +413,10 @@ public class ThriftTransportPool {
@VisibleForTesting
public Pair<String,TTransport> getAnyTransport(List<ThriftTransportKey> servers, boolean preferCachedConnection) throws TTransportException {
- servers = new ArrayList<ThriftTransportKey>(servers);
+ servers = new ArrayList<>(servers);
if (preferCachedConnection) {
- HashSet<ThriftTransportKey> serversSet = new HashSet<ThriftTransportKey>(servers);
+ HashSet<ThriftTransportKey> serversSet = new HashSet<>(servers);
synchronized (this) {
@@ -424,7 +424,7 @@ public class ThriftTransportPool {
serversSet.retainAll(getCache().keySet());
if (serversSet.size() > 0) {
- ArrayList<ThriftTransportKey> cachedServers = new ArrayList<ThriftTransportKey>(serversSet);
+ ArrayList<ThriftTransportKey> cachedServers = new ArrayList<>(serversSet);
Collections.shuffle(cachedServers, random);
for (ThriftTransportKey ttk : cachedServers) {
@@ -463,7 +463,7 @@ public class ThriftTransportPool {
}
try {
- return new Pair<String,TTransport>(ttk.getServer().toString(), createNewTransport(ttk));
+ return new Pair<>(ttk.getServer().toString(), createNewTransport(ttk));
} catch (TTransportException tte) {
log.debug("Failed to connect to {}", servers.get(index), tte);
servers.remove(index);
@@ -490,7 +490,7 @@ public class ThriftTransportPool {
List<CachedConnection> ccl = getCache().get(cacheKey);
if (ccl == null) {
- ccl = new LinkedList<CachedConnection>();
+ ccl = new LinkedList<>();
getCache().put(cacheKey, ccl);
}
@@ -511,7 +511,7 @@ public class ThriftTransportPool {
boolean existInCache = false;
CachedTTransport ctsc = (CachedTTransport) tsc;
- ArrayList<CachedConnection> closeList = new ArrayList<ThriftTransportPool.CachedConnection>();
+ ArrayList<CachedConnection> closeList = new ArrayList<>();
synchronized (this) {
List<CachedConnection> ccl = getCache().get(ctsc.getCacheKey());
http://git-wip-us.apache.org/repos/asf/accumulo/blob/717febbf/core/src/main/java/org/apache/accumulo/core/client/impl/Translator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/Translator.java b/core/src/main/java/org/apache/accumulo/core/client/impl/Translator.java
index e5141cf..00c43ac 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/Translator.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/Translator.java
@@ -111,7 +111,7 @@ public abstract class Translator<IT,OT> {
}
public static <IKT,OKT,T> Map<OKT,T> translate(Map<IKT,T> input, Translator<IKT,OKT> keyTranslator) {
- HashMap<OKT,T> output = new HashMap<OKT,T>();
+ HashMap<OKT,T> output = new HashMap<>();
for (Entry<IKT,T> entry : input.entrySet())
output.put(keyTranslator.translate(entry.getKey()), entry.getValue());
@@ -120,7 +120,7 @@ public abstract class Translator<IT,OT> {
}
public static <IKT,OKT,IVT,OVT> Map<OKT,OVT> translate(Map<IKT,IVT> input, Translator<IKT,OKT> keyTranslator, Translator<IVT,OVT> valueTranslator) {
- HashMap<OKT,OVT> output = new HashMap<OKT,OVT>();
+ HashMap<OKT,OVT> output = new HashMap<>();
for (Entry<IKT,IVT> entry : input.entrySet())
output.put(keyTranslator.translate(entry.getKey()), valueTranslator.translate(entry.getValue()));
@@ -129,7 +129,7 @@ public abstract class Translator<IT,OT> {
}
public static <IT,OT> List<OT> translate(Collection<IT> input, Translator<IT,OT> translator) {
- ArrayList<OT> output = new ArrayList<OT>(input.size());
+ ArrayList<OT> output = new ArrayList<>(input.size());
for (IT in : input)
output.add(translator.translate(in));
http://git-wip-us.apache.org/repos/asf/accumulo/blob/717febbf/core/src/main/java/org/apache/accumulo/core/client/lexicoder/ListLexicoder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/lexicoder/ListLexicoder.java b/core/src/main/java/org/apache/accumulo/core/client/lexicoder/ListLexicoder.java
index d78cff2..cbdf23e 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/lexicoder/ListLexicoder.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/lexicoder/ListLexicoder.java
@@ -66,7 +66,7 @@ public class ListLexicoder<LT> extends AbstractLexicoder<List<LT>> implements Le
protected List<LT> decodeUnchecked(byte[] b, int offset, int len) {
byte[][] escapedElements = split(b, offset, len);
- ArrayList<LT> ret = new ArrayList<LT>(escapedElements.length);
+ ArrayList<LT> ret = new ArrayList<>(escapedElements.length);
for (byte[] escapedElement : escapedElements) {
ret.add(lexicoder.decode(unescape(escapedElement)));
http://git-wip-us.apache.org/repos/asf/accumulo/blob/717febbf/core/src/main/java/org/apache/accumulo/core/client/lexicoder/PairLexicoder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/lexicoder/PairLexicoder.java b/core/src/main/java/org/apache/accumulo/core/client/lexicoder/PairLexicoder.java
index 9198b43..7ed2d07 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/lexicoder/PairLexicoder.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/lexicoder/PairLexicoder.java
@@ -79,7 +79,7 @@ public class PairLexicoder<A extends Comparable<A>,B extends Comparable<B>> exte
throw new RuntimeException("Data does not have 2 fields, it has " + fields.length);
}
- return new ComparablePair<A,B>(firstLexicoder.decode(unescape(fields[0])), secondLexicoder.decode(unescape(fields[1])));
+ return new ComparablePair<>(firstLexicoder.decode(unescape(fields[0])), secondLexicoder.decode(unescape(fields[1])));
}
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/717febbf/core/src/main/java/org/apache/accumulo/core/client/lexicoder/impl/ByteUtils.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/lexicoder/impl/ByteUtils.java b/core/src/main/java/org/apache/accumulo/core/client/lexicoder/impl/ByteUtils.java
index b168807..0daceaa 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/lexicoder/impl/ByteUtils.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/lexicoder/impl/ByteUtils.java
@@ -97,7 +97,7 @@ public class ByteUtils {
* Splits a byte array by 0x00
*/
public static byte[][] split(byte[] data, int dataOffset, int len) {
- ArrayList<Integer> offsets = new ArrayList<Integer>();
+ ArrayList<Integer> offsets = new ArrayList<>();
for (int i = dataOffset; i < (dataOffset + len); i++) {
if (data[i] == 0x00) {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/717febbf/core/src/main/java/org/apache/accumulo/core/client/mapred/AbstractInputFormat.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapred/AbstractInputFormat.java b/core/src/main/java/org/apache/accumulo/core/client/mapred/AbstractInputFormat.java
index 86a7adf..967daf6 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mapred/AbstractInputFormat.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mapred/AbstractInputFormat.java
@@ -621,7 +621,7 @@ public abstract class AbstractInputFormat<K,V> implements InputFormat<K,V> {
validateOptions(job);
Random random = new Random();
- LinkedList<InputSplit> splits = new LinkedList<InputSplit>();
+ LinkedList<InputSplit> splits = new LinkedList<>();
Map<String,InputTableConfig> tableConfigs = getInputTableConfigs(job);
for (Map.Entry<String,InputTableConfig> tableConfigEntry : tableConfigs.entrySet()) {
String tableName = tableConfigEntry.getKey();
@@ -655,12 +655,12 @@ public abstract class AbstractInputFormat<K,V> implements InputFormat<K,V> {
List<Range> ranges = autoAdjust ? Range.mergeOverlapping(tableConfig.getRanges()) : tableConfig.getRanges();
if (ranges.isEmpty()) {
- ranges = new ArrayList<Range>(1);
+ ranges = new ArrayList<>(1);
ranges.add(new Range());
}
// get the metadata information for these ranges
- Map<String,Map<KeyExtent,List<Range>>> binnedRanges = new HashMap<String,Map<KeyExtent,List<Range>>>();
+ Map<String,Map<KeyExtent,List<Range>>> binnedRanges = new HashMap<>();
TabletLocator tl;
try {
if (tableConfig.isOfflineScan()) {
@@ -697,9 +697,9 @@ public abstract class AbstractInputFormat<K,V> implements InputFormat<K,V> {
HashMap<Range,ArrayList<String>> splitsToAdd = null;
if (!autoAdjust)
- splitsToAdd = new HashMap<Range,ArrayList<String>>();
+ splitsToAdd = new HashMap<>();
- HashMap<String,String> hostNameCache = new HashMap<String,String>();
+ HashMap<String,String> hostNameCache = new HashMap<>();
for (Map.Entry<String,Map<KeyExtent,List<Range>>> tserverBin : binnedRanges.entrySet()) {
String ip = tserverBin.getKey().split(":", 2)[0];
String location = hostNameCache.get(ip);
@@ -712,7 +712,7 @@ public abstract class AbstractInputFormat<K,V> implements InputFormat<K,V> {
Range ke = extentRanges.getKey().toDataRange();
if (batchScan) {
// group ranges by tablet to be read by a BatchScanner
- ArrayList<Range> clippedRanges = new ArrayList<Range>();
+ ArrayList<Range> clippedRanges = new ArrayList<>();
for (Range r : extentRanges.getValue())
clippedRanges.add(ke.clip(r));
@@ -736,7 +736,7 @@ public abstract class AbstractInputFormat<K,V> implements InputFormat<K,V> {
// don't divide ranges
ArrayList<String> locations = splitsToAdd.get(r);
if (locations == null)
- locations = new ArrayList<String>(1);
+ locations = new ArrayList<>(1);
locations.add(location);
splitsToAdd.put(r, locations);
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/717febbf/core/src/main/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormat.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormat.java b/core/src/main/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormat.java
index c194cf6..6ad93f3 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormat.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormat.java
@@ -429,7 +429,7 @@ public class AccumuloOutputFormat implements OutputFormat<Text,Mutation> {
if (simulate)
log.info("Simulating output only. No writes to tables will occur");
- this.bws = new HashMap<Text,BatchWriter>();
+ this.bws = new HashMap<>();
String tname = getDefaultTableName(job);
this.defaultTableName = (tname == null) ? null : new Text(tname);
@@ -543,11 +543,11 @@ public class AccumuloOutputFormat implements OutputFormat<Text,Mutation> {
mtbw.close();
} catch (MutationsRejectedException e) {
if (e.getSecurityErrorCodes().size() >= 0) {
- HashMap<String,Set<SecurityErrorCode>> tables = new HashMap<String,Set<SecurityErrorCode>>();
+ HashMap<String,Set<SecurityErrorCode>> tables = new HashMap<>();
for (Entry<TabletId,Set<SecurityErrorCode>> ke : e.getSecurityErrorCodes().entrySet()) {
Set<SecurityErrorCode> secCodes = tables.get(ke.getKey().getTableId().toString());
if (secCodes == null) {
- secCodes = new HashSet<SecurityErrorCode>();
+ secCodes = new HashSet<>();
tables.put(ke.getKey().getTableId().toString(), secCodes);
}
secCodes.addAll(ke.getValue());
http://git-wip-us.apache.org/repos/asf/accumulo/blob/717febbf/core/src/main/java/org/apache/accumulo/core/client/mapred/AccumuloRowInputFormat.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapred/AccumuloRowInputFormat.java b/core/src/main/java/org/apache/accumulo/core/client/mapred/AccumuloRowInputFormat.java
index 6f257ff..ab60327 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mapred/AccumuloRowInputFormat.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mapred/AccumuloRowInputFormat.java
@@ -78,7 +78,7 @@ public class AccumuloRowInputFormat extends InputFormatBase<Text,PeekingIterator
@Override
public PeekingIterator<Entry<Key,Value>> createValue() {
- return new PeekingIterator<Entry<Key,Value>>();
+ return new PeekingIterator<>();
}
};
recordReader.initialize(split, job);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/717febbf/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AbstractInputFormat.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AbstractInputFormat.java b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AbstractInputFormat.java
index 2575fe5..83aa269 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AbstractInputFormat.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AbstractInputFormat.java
@@ -667,7 +667,7 @@ public abstract class AbstractInputFormat<K,V> extends InputFormat<K,V> {
log.setLevel(logLevel);
validateOptions(context);
Random random = new Random();
- LinkedList<InputSplit> splits = new LinkedList<InputSplit>();
+ LinkedList<InputSplit> splits = new LinkedList<>();
Map<String,InputTableConfig> tableConfigs = getInputTableConfigs(context);
for (Map.Entry<String,InputTableConfig> tableConfigEntry : tableConfigs.entrySet()) {
@@ -702,12 +702,12 @@ public abstract class AbstractInputFormat<K,V> extends InputFormat<K,V> {
List<Range> ranges = autoAdjust ? Range.mergeOverlapping(tableConfig.getRanges()) : tableConfig.getRanges();
if (ranges.isEmpty()) {
- ranges = new ArrayList<Range>(1);
+ ranges = new ArrayList<>(1);
ranges.add(new Range());
}
// get the metadata information for these ranges
- Map<String,Map<KeyExtent,List<Range>>> binnedRanges = new HashMap<String,Map<KeyExtent,List<Range>>>();
+ Map<String,Map<KeyExtent,List<Range>>> binnedRanges = new HashMap<>();
TabletLocator tl;
try {
if (tableConfig.isOfflineScan()) {
@@ -747,9 +747,9 @@ public abstract class AbstractInputFormat<K,V> extends InputFormat<K,V> {
HashMap<Range,ArrayList<String>> splitsToAdd = null;
if (!autoAdjust)
- splitsToAdd = new HashMap<Range,ArrayList<String>>();
+ splitsToAdd = new HashMap<>();
- HashMap<String,String> hostNameCache = new HashMap<String,String>();
+ HashMap<String,String> hostNameCache = new HashMap<>();
for (Map.Entry<String,Map<KeyExtent,List<Range>>> tserverBin : binnedRanges.entrySet()) {
String ip = tserverBin.getKey().split(":", 2)[0];
String location = hostNameCache.get(ip);
@@ -762,7 +762,7 @@ public abstract class AbstractInputFormat<K,V> extends InputFormat<K,V> {
Range ke = extentRanges.getKey().toDataRange();
if (batchScan) {
// group ranges by tablet to be read by a BatchScanner
- ArrayList<Range> clippedRanges = new ArrayList<Range>();
+ ArrayList<Range> clippedRanges = new ArrayList<>();
for (Range r : extentRanges.getValue())
clippedRanges.add(ke.clip(r));
BatchInputSplit split = new BatchInputSplit(tableName, tableId, clippedRanges, new String[] {location});
@@ -785,7 +785,7 @@ public abstract class AbstractInputFormat<K,V> extends InputFormat<K,V> {
// don't divide ranges
ArrayList<String> locations = splitsToAdd.get(r);
if (locations == null)
- locations = new ArrayList<String>(1);
+ locations = new ArrayList<>(1);
locations.add(location);
splitsToAdd.put(r, locations);
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/717febbf/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java
index 4cb46a3..e736a0f 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java
@@ -429,7 +429,7 @@ public class AccumuloOutputFormat extends OutputFormat<Text,Mutation> {
if (simulate)
log.info("Simulating output only. No writes to tables will occur");
- this.bws = new HashMap<Text,BatchWriter>();
+ this.bws = new HashMap<>();
String tname = getDefaultTableName(context);
this.defaultTableName = (tname == null) ? null : new Text(tname);
@@ -543,11 +543,11 @@ public class AccumuloOutputFormat extends OutputFormat<Text,Mutation> {
mtbw.close();
} catch (MutationsRejectedException e) {
if (e.getSecurityErrorCodes().size() >= 0) {
- HashMap<String,Set<SecurityErrorCode>> tables = new HashMap<String,Set<SecurityErrorCode>>();
+ HashMap<String,Set<SecurityErrorCode>> tables = new HashMap<>();
for (Entry<TabletId,Set<SecurityErrorCode>> ke : e.getSecurityErrorCodes().entrySet()) {
Set<SecurityErrorCode> secCodes = tables.get(ke.getKey().getTableId().toString());
if (secCodes == null) {
- secCodes = new HashSet<SecurityErrorCode>();
+ secCodes = new HashSet<>();
tables.put(ke.getKey().getTableId().toString(), secCodes);
}
secCodes.addAll(ke.getValue());
http://git-wip-us.apache.org/repos/asf/accumulo/blob/717febbf/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloRowInputFormat.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloRowInputFormat.java b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloRowInputFormat.java
index 77081bf..53a45ca 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloRowInputFormat.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloRowInputFormat.java
@@ -68,7 +68,7 @@ public class AccumuloRowInputFormat extends InputFormatBase<Text,PeekingIterator
public boolean nextKeyValue() throws IOException, InterruptedException {
if (!rowIterator.hasNext())
return false;
- currentV = new PeekingIterator<Entry<Key,Value>>(rowIterator.next());
+ currentV = new PeekingIterator<>(rowIterator.next());
numKeysRead = rowIterator.getKVCount();
currentKey = currentV.peek().getKey();
currentK = new Text(currentKey.getRow());
http://git-wip-us.apache.org/repos/asf/accumulo/blob/717febbf/core/src/main/java/org/apache/accumulo/core/client/mapreduce/InputTableConfig.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/InputTableConfig.java b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/InputTableConfig.java
index 257f6c9..505c75a 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/InputTableConfig.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/InputTableConfig.java
@@ -283,13 +283,13 @@ public class InputTableConfig implements Writable {
// load iterators
long iterSize = dataInput.readInt();
if (iterSize > 0)
- iterators = new ArrayList<IteratorSetting>();
+ iterators = new ArrayList<>();
for (int i = 0; i < iterSize; i++)
iterators.add(new IteratorSetting(dataInput));
// load ranges
long rangeSize = dataInput.readInt();
if (rangeSize > 0)
- ranges = new ArrayList<Range>();
+ ranges = new ArrayList<>();
for (int i = 0; i < rangeSize; i++) {
Range range = new Range();
range.readFields(dataInput);
@@ -298,7 +298,7 @@ public class InputTableConfig implements Writable {
// load columns
long columnSize = dataInput.readInt();
if (columnSize > 0)
- columns = new HashSet<Pair<Text,Text>>();
+ columns = new HashSet<>();
for (int i = 0; i < columnSize; i++) {
long numPairs = dataInput.readInt();
Text colFam = new Text();
@@ -308,7 +308,7 @@ public class InputTableConfig implements Writable {
} else if (numPairs == 2) {
Text colQual = new Text();
colQual.readFields(dataInput);
- columns.add(new Pair<Text,Text>(colFam, colQual));
+ columns.add(new Pair<>(colFam, colQual));
}
}
autoAdjustRanges = dataInput.readBoolean();
http://git-wip-us.apache.org/repos/asf/accumulo/blob/717febbf/core/src/main/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplit.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplit.java b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplit.java
index e337977..41ace4f 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplit.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplit.java
@@ -157,7 +157,7 @@ public class RangeInputSplit extends InputSplit implements Writable {
if (in.readBoolean()) {
int numColumns = in.readInt();
- List<String> columns = new ArrayList<String>(numColumns);
+ List<String> columns = new ArrayList<>(numColumns);
for (int i = 0; i < numColumns; i++) {
columns.add(in.readUTF());
}
@@ -206,7 +206,7 @@ public class RangeInputSplit extends InputSplit implements Writable {
if (in.readBoolean()) {
int numIterators = in.readInt();
- iterators = new ArrayList<IteratorSetting>(numIterators);
+ iterators = new ArrayList<>(numIterators);
for (int i = 0; i < numIterators; i++) {
iterators.add(new IteratorSetting(in));
}
@@ -455,7 +455,7 @@ public class RangeInputSplit extends InputSplit implements Writable {
}
public void setFetchedColumns(Collection<Pair<Text,Text>> fetchedColumns) {
- this.fetchedColumns = new HashSet<Pair<Text,Text>>();
+ this.fetchedColumns = new HashSet<>();
for (Pair<Text,Text> columns : fetchedColumns) {
this.fetchedColumns.add(columns);
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/717febbf/core/src/main/java/org/apache/accumulo/core/client/mapreduce/impl/BatchInputSplit.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/impl/BatchInputSplit.java b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/impl/BatchInputSplit.java
index 04875ac..2965788 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/impl/BatchInputSplit.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/impl/BatchInputSplit.java
@@ -107,7 +107,7 @@ public class BatchInputSplit extends RangeInputSplit {
super.readFields(in);
int numRanges = in.readInt();
- ranges = new ArrayList<Range>(numRanges);
+ ranges = new ArrayList<>(numRanges);
for (int i = 0; i < numRanges; ++i) {
Range r = new Range();
r.readFields(in);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/717febbf/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/InputConfigurator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/InputConfigurator.java b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/InputConfigurator.java
index 0e640b4..eaf6f6d 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/InputConfigurator.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/InputConfigurator.java
@@ -176,7 +176,7 @@ public class InputConfigurator extends ConfiguratorBase {
public static void setRanges(Class<?> implementingClass, Configuration conf, Collection<Range> ranges) {
checkArgument(ranges != null, "ranges is null");
- ArrayList<String> rangeStrings = new ArrayList<String>(ranges.size());
+ ArrayList<String> rangeStrings = new ArrayList<>(ranges.size());
try {
for (Range r : ranges) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -205,7 +205,7 @@ public class InputConfigurator extends ConfiguratorBase {
public static List<Range> getRanges(Class<?> implementingClass, Configuration conf) throws IOException {
Collection<String> encodedRanges = conf.getStringCollection(enumToConfKey(implementingClass, ScanOpts.RANGES));
- List<Range> ranges = new ArrayList<Range>();
+ List<Range> ranges = new ArrayList<>();
for (String rangeString : encodedRanges) {
ByteArrayInputStream bais = new ByteArrayInputStream(Base64.decodeBase64(rangeString.getBytes(UTF_8)));
Range range = new Range();
@@ -231,11 +231,11 @@ public class InputConfigurator extends ConfiguratorBase {
// If no iterators are present, return an empty list
if (iterators == null || iterators.isEmpty())
- return new ArrayList<IteratorSetting>();
+ return new ArrayList<>();
// Compose the set of iterators encoded in the job configuration
StringTokenizer tokens = new StringTokenizer(iterators, StringUtils.COMMA_STR);
- List<IteratorSetting> list = new ArrayList<IteratorSetting>();
+ List<IteratorSetting> list = new ArrayList<>();
try {
while (tokens.hasMoreTokens()) {
String itstring = tokens.nextToken();
@@ -271,7 +271,7 @@ public class InputConfigurator extends ConfiguratorBase {
public static String[] serializeColumns(Collection<Pair<Text,Text>> columnFamilyColumnQualifierPairs) {
checkArgument(columnFamilyColumnQualifierPairs != null, "columnFamilyColumnQualifierPairs is null");
- ArrayList<String> columnStrings = new ArrayList<String>(columnFamilyColumnQualifierPairs.size());
+ ArrayList<String> columnStrings = new ArrayList<>(columnFamilyColumnQualifierPairs.size());
for (Pair<Text,Text> column : columnFamilyColumnQualifierPairs) {
if (column.getFirst() == null)
@@ -300,7 +300,7 @@ public class InputConfigurator extends ConfiguratorBase {
public static Set<Pair<Text,Text>> getFetchedColumns(Class<?> implementingClass, Configuration conf) {
checkArgument(conf != null, "conf is null");
String confValue = conf.get(enumToConfKey(implementingClass, ScanOpts.COLUMNS));
- List<String> serialized = new ArrayList<String>();
+ List<String> serialized = new ArrayList<>();
if (confValue != null) {
// Split and include any trailing empty strings to allow empty column families
for (String val : confValue.split(",", -1)) {
@@ -311,7 +311,7 @@ public class InputConfigurator extends ConfiguratorBase {
}
public static Set<Pair<Text,Text>> deserializeFetchedColumns(Collection<String> serialized) {
- Set<Pair<Text,Text>> columns = new HashSet<Pair<Text,Text>>();
+ Set<Pair<Text,Text>> columns = new HashSet<>();
if (null == serialized) {
return columns;
@@ -321,7 +321,7 @@ public class InputConfigurator extends ConfiguratorBase {
int idx = col.indexOf(":");
Text cf = new Text(idx < 0 ? Base64.decodeBase64(col.getBytes(UTF_8)) : Base64.decodeBase64(col.substring(0, idx).getBytes(UTF_8)));
Text cq = idx < 0 ? null : new Text(Base64.decodeBase64(col.substring(idx + 1).getBytes(UTF_8)));
- columns.add(new Pair<Text,Text>(cf, cq));
+ columns.add(new Pair<>(cf, cq));
}
return columns;
}
@@ -589,7 +589,7 @@ public class InputConfigurator extends ConfiguratorBase {
* @since 1.6.0
*/
public static Map<String,InputTableConfig> getInputTableConfigs(Class<?> implementingClass, Configuration conf) {
- Map<String,InputTableConfig> configs = new HashMap<String,InputTableConfig>();
+ Map<String,InputTableConfig> configs = new HashMap<>();
Map.Entry<String,InputTableConfig> defaultConfig = getDefaultInputTableConfig(implementingClass, conf);
if (defaultConfig != null)
configs.put(defaultConfig.getKey(), defaultConfig.getValue());
@@ -814,7 +814,7 @@ public class InputConfigurator extends ConfiguratorBase {
public static Map<String,Map<KeyExtent,List<Range>>> binOffline(String tableId, List<Range> ranges, Instance instance, Connector conn)
throws AccumuloException, TableNotFoundException {
- Map<String,Map<KeyExtent,List<Range>>> binnedRanges = new HashMap<String,Map<KeyExtent,List<Range>>>();
+ Map<String,Map<KeyExtent,List<Range>>> binnedRanges = new HashMap<>();
if (Tables.getTableState(instance, tableId) != TableState.OFFLINE) {
Tables.clearCache(instance);
@@ -879,13 +879,13 @@ public class InputConfigurator extends ConfiguratorBase {
Map<KeyExtent,List<Range>> tabletRanges = binnedRanges.get(last);
if (tabletRanges == null) {
- tabletRanges = new HashMap<KeyExtent,List<Range>>();
+ tabletRanges = new HashMap<>();
binnedRanges.put(last, tabletRanges);
}
List<Range> rangeList = tabletRanges.get(extent);
if (rangeList == null) {
- rangeList = new ArrayList<Range>();
+ rangeList = new ArrayList<>();
tabletRanges.put(extent, rangeList);
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/717febbf/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/partition/RangePartitioner.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/partition/RangePartitioner.java b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/partition/RangePartitioner.java
index c0c0097..fa80831 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/partition/RangePartitioner.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/partition/RangePartitioner.java
@@ -89,7 +89,7 @@ public class RangePartitioner extends Partitioner<Text,Writable> implements Conf
if (cf != null) {
for (Path path : cf) {
if (path.toUri().getPath().endsWith(cutFileName.substring(cutFileName.lastIndexOf('/')))) {
- TreeSet<Text> cutPoints = new TreeSet<Text>();
+ TreeSet<Text> cutPoints = new TreeSet<>();
Scanner in = new Scanner(new BufferedReader(new InputStreamReader(new FileInputStream(path.toString()), UTF_8)));
try {
while (in.hasNextLine())
http://git-wip-us.apache.org/repos/asf/accumulo/blob/717febbf/core/src/main/java/org/apache/accumulo/core/client/mock/MockAccumulo.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mock/MockAccumulo.java b/core/src/main/java/org/apache/accumulo/core/client/mock/MockAccumulo.java
index e1ca768..eaa2e4e 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mock/MockAccumulo.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mock/MockAccumulo.java
@@ -41,10 +41,10 @@ import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.io.Text;
public class MockAccumulo {
- final Map<String,MockTable> tables = new HashMap<String,MockTable>();
- final Map<String,MockNamespace> namespaces = new HashMap<String,MockNamespace>();
- final Map<String,String> systemProperties = new HashMap<String,String>();
- Map<String,MockUser> users = new HashMap<String,MockUser>();
+ final Map<String,MockTable> tables = new HashMap<>();
+ final Map<String,MockNamespace> namespaces = new HashMap<>();
+ final Map<String,String> systemProperties = new HashMap<>();
+ Map<String,MockUser> users = new HashMap<>();
final FileSystem fs;
final AtomicInteger tableIdCounter = new AtomicInteger(0);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/717febbf/core/src/main/java/org/apache/accumulo/core/client/mock/MockBatchScanner.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mock/MockBatchScanner.java b/core/src/main/java/org/apache/accumulo/core/client/mock/MockBatchScanner.java
index 4034271..5b2b8e9 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mock/MockBatchScanner.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mock/MockBatchScanner.java
@@ -46,7 +46,7 @@ public class MockBatchScanner extends MockScannerBase implements BatchScanner {
throw new IllegalArgumentException("ranges must be non null and contain at least 1 range");
}
- this.ranges = new ArrayList<Range>(ranges);
+ this.ranges = new ArrayList<>(ranges);
}
@SuppressWarnings("unchecked")
http://git-wip-us.apache.org/repos/asf/accumulo/blob/717febbf/core/src/main/java/org/apache/accumulo/core/client/mock/MockInstance.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mock/MockInstance.java b/core/src/main/java/org/apache/accumulo/core/client/mock/MockInstance.java
index 57cd5ee..839b478 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mock/MockInstance.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mock/MockInstance.java
@@ -54,7 +54,7 @@ import org.apache.hadoop.io.Text;
public class MockInstance implements Instance {
static final String genericAddress = "localhost:1234";
- static final Map<String,MockAccumulo> instances = new HashMap<String,MockAccumulo>();
+ static final Map<String,MockAccumulo> instances = new HashMap<>();
MockAccumulo acu;
String instanceName;
http://git-wip-us.apache.org/repos/asf/accumulo/blob/717febbf/core/src/main/java/org/apache/accumulo/core/client/mock/MockInstanceOperations.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mock/MockInstanceOperations.java b/core/src/main/java/org/apache/accumulo/core/client/mock/MockInstanceOperations.java
index c1acc04..05e171d 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mock/MockInstanceOperations.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mock/MockInstanceOperations.java
@@ -59,12 +59,12 @@ class MockInstanceOperations implements InstanceOperations {
@Override
public List<String> getTabletServers() {
- return new ArrayList<String>();
+ return new ArrayList<>();
}
@Override
public List<ActiveScan> getActiveScans(String tserver) throws AccumuloException, AccumuloSecurityException {
- return new ArrayList<ActiveScan>();
+ return new ArrayList<>();
}
@Override
@@ -80,7 +80,7 @@ class MockInstanceOperations implements InstanceOperations {
@Override
public List<ActiveCompaction> getActiveCompactions(String tserver) throws AccumuloException, AccumuloSecurityException {
- return new ArrayList<ActiveCompaction>();
+ return new ArrayList<>();
}
@Override
http://git-wip-us.apache.org/repos/asf/accumulo/blob/717febbf/core/src/main/java/org/apache/accumulo/core/client/mock/MockMultiTableBatchWriter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mock/MockMultiTableBatchWriter.java b/core/src/main/java/org/apache/accumulo/core/client/mock/MockMultiTableBatchWriter.java
index 9cc3dfb..0e04854 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mock/MockMultiTableBatchWriter.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mock/MockMultiTableBatchWriter.java
@@ -32,7 +32,7 @@ public class MockMultiTableBatchWriter implements MultiTableBatchWriter {
public MockMultiTableBatchWriter(MockAccumulo acu) {
this.acu = acu;
- bws = new HashMap<String,MockBatchWriter>();
+ bws = new HashMap<>();
}
@Override
http://git-wip-us.apache.org/repos/asf/accumulo/blob/717febbf/core/src/main/java/org/apache/accumulo/core/client/mock/MockNamespace.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mock/MockNamespace.java b/core/src/main/java/org/apache/accumulo/core/client/mock/MockNamespace.java
index 955564f..32f0a24 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mock/MockNamespace.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mock/MockNamespace.java
@@ -30,10 +30,10 @@ import org.apache.accumulo.core.security.NamespacePermission;
public class MockNamespace {
final HashMap<String,String> settings;
- Map<String,EnumSet<NamespacePermission>> userPermissions = new HashMap<String,EnumSet<NamespacePermission>>();
+ Map<String,EnumSet<NamespacePermission>> userPermissions = new HashMap<>();
public MockNamespace() {
- settings = new HashMap<String,String>();
+ settings = new HashMap<>();
for (Entry<String,String> entry : AccumuloConfiguration.getDefaultConfiguration()) {
String key = entry.getKey();
if (key.startsWith(Property.TABLE_PREFIX.getKey())) {
@@ -43,7 +43,7 @@ public class MockNamespace {
}
public List<String> getTables(MockAccumulo acu) {
- List<String> l = new LinkedList<String>();
+ List<String> l = new LinkedList<>();
for (String t : acu.tables.keySet()) {
if (acu.tables.get(t).getNamespace().equals(this)) {
l.add(t);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/717febbf/core/src/main/java/org/apache/accumulo/core/client/mock/MockNamespaceOperations.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mock/MockNamespaceOperations.java b/core/src/main/java/org/apache/accumulo/core/client/mock/MockNamespaceOperations.java
index 004124d..fc8d73b 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mock/MockNamespaceOperations.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mock/MockNamespaceOperations.java
@@ -48,7 +48,7 @@ class MockNamespaceOperations extends NamespaceOperationsHelper {
@Override
public SortedSet<String> list() {
- return new TreeSet<String>(acu.namespaces.keySet());
+ return new TreeSet<>(acu.namespaces.keySet());
}
@Override
@@ -112,7 +112,7 @@ class MockNamespaceOperations extends NamespaceOperationsHelper {
@Override
public Map<String,String> namespaceIdMap() {
- Map<String,String> result = new HashMap<String,String>();
+ Map<String,String> result = new HashMap<>();
for (String table : acu.tables.keySet()) {
result.put(table, table);
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/717febbf/core/src/main/java/org/apache/accumulo/core/client/mock/MockScannerBase.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/mock/MockScannerBase.java b/core/src/main/java/org/apache/accumulo/core/client/mock/MockScannerBase.java
index 3c746e1..0a31bf2 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mock/MockScannerBase.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mock/MockScannerBase.java
@@ -54,7 +54,7 @@ public class MockScannerBase extends ScannerOptions implements ScannerBase {
}
static HashSet<ByteSequence> createColumnBSS(Collection<Column> columns) {
- HashSet<ByteSequence> columnSet = new HashSet<ByteSequence>();
+ HashSet<ByteSequence> columnSet = new HashSet<>();
for (Column c : columns) {
columnSet.add(new ArrayByteSequence(c.getColumnFamily()));
}
@@ -89,7 +89,7 @@ public class MockScannerBase extends ScannerOptions implements ScannerBase {
return false;
}
- private ArrayList<SortedKeyValueIterator<Key,Value>> topLevelIterators = new ArrayList<SortedKeyValueIterator<Key,Value>>();
+ private ArrayList<SortedKeyValueIterator<Key,Value>> topLevelIterators = new ArrayList<>();
@Override
public void registerSideChannel(SortedKeyValueIterator<Key,Value> iter) {
@@ -104,7 +104,7 @@ public class MockScannerBase extends ScannerOptions implements ScannerBase {
SortedKeyValueIterator<Key,Value> getTopLevelIterator(SortedKeyValueIterator<Key,Value> iter) {
if (topLevelIterators.isEmpty())
return iter;
- ArrayList<SortedKeyValueIterator<Key,Value>> allIters = new ArrayList<SortedKeyValueIterator<Key,Value>>(topLevelIterators);
+ ArrayList<SortedKeyValueIterator<Key,Value>> allIters = new ArrayList<>(topLevelIterators);
allIters.add(iter);
return new MultiIterator(allIters, false);
}
@@ -113,7 +113,7 @@ public class MockScannerBase extends ScannerOptions implements ScannerBase {
public SortedKeyValueIterator<Key,Value> createFilter(SortedKeyValueIterator<Key,Value> inner) throws IOException {
byte[] defaultLabels = {};
inner = new ColumnFamilySkippingIterator(new DeletingIterator(inner, false));
- ColumnQualifierFilter cqf = new ColumnQualifierFilter(inner, new HashSet<Column>(fetchedColumns));
+ ColumnQualifierFilter cqf = new ColumnQualifierFilter(inner, new HashSet<>(fetchedColumns));
VisibilityFilter vf = new VisibilityFilter(cqf, auths, defaultLabels);
AccumuloConfiguration conf = new MockConfiguration(table.settings);
MockIteratorEnvironment iterEnv = new MockIteratorEnvironment(auths);