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:26 UTC
[29/32] accumulo git commit: ACCUMULO-4357 Remove unneeded code for
readability
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsHelper.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsHelper.java b/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsHelper.java
index 4068dee..a81241a 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsHelper.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsHelper.java
@@ -59,7 +59,7 @@ public abstract class TableOperationsHelper implements TableOperations {
@Override
public void removeIterator(String tableName, String name, EnumSet<IteratorScope> scopes) throws AccumuloSecurityException, AccumuloException,
TableNotFoundException {
- Map<String,String> copy = new TreeMap<String,String>();
+ Map<String,String> copy = new TreeMap<>();
for (Entry<String,String> property : this.getProperties(tableName)) {
copy.put(property.getKey(), property.getValue());
}
@@ -80,7 +80,7 @@ public abstract class TableOperationsHelper implements TableOperations {
checkArgument(scope != null, "scope is null");
int priority = -1;
String classname = null;
- Map<String,String> settings = new HashMap<String,String>();
+ Map<String,String> settings = new HashMap<>();
String root = String.format("%s%s.%s", Property.TABLE_ITERATOR_PREFIX, scope.name().toLowerCase(), name);
String opt = root + ".opt.";
@@ -104,7 +104,7 @@ public abstract class TableOperationsHelper implements TableOperations {
@Override
public Map<String,EnumSet<IteratorScope>> listIterators(String tableName) throws AccumuloSecurityException, AccumuloException, TableNotFoundException {
- Map<String,EnumSet<IteratorScope>> result = new TreeMap<String,EnumSet<IteratorScope>>();
+ Map<String,EnumSet<IteratorScope>> result = new TreeMap<>();
for (Entry<String,String> property : this.getProperties(tableName)) {
String name = property.getKey();
String[] parts = name.split("\\.");
@@ -129,7 +129,7 @@ public abstract class TableOperationsHelper implements TableOperations {
String scopeStr = String.format("%s%s", Property.TABLE_ITERATOR_PREFIX, scope.name().toLowerCase());
String nameStr = String.format("%s.%s", scopeStr, setting.getName());
String optStr = String.format("%s.opt.", nameStr);
- Map<String,String> optionConflicts = new TreeMap<String,String>();
+ Map<String,String> optionConflicts = new TreeMap<>();
for (Entry<String,String> property : this.getProperties(tableName)) {
if (property.getKey().startsWith(scopeStr)) {
if (property.getKey().equals(nameStr))
@@ -157,8 +157,8 @@ public abstract class TableOperationsHelper implements TableOperations {
@Override
public int addConstraint(String tableName, String constraintClassName) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
- TreeSet<Integer> constraintNumbers = new TreeSet<Integer>();
- TreeMap<String,Integer> constraintClasses = new TreeMap<String,Integer>();
+ TreeSet<Integer> constraintNumbers = new TreeSet<>();
+ TreeMap<String,Integer> constraintClasses = new TreeMap<>();
int i;
for (Entry<String,String> property : this.getProperties(tableName)) {
if (property.getKey().startsWith(Property.TABLE_CONSTRAINT_PREFIX.toString())) {
@@ -188,7 +188,7 @@ public abstract class TableOperationsHelper implements TableOperations {
@Override
public Map<String,Integer> listConstraints(String tableName) throws AccumuloException, TableNotFoundException {
- Map<String,Integer> constraints = new TreeMap<String,Integer>();
+ Map<String,Integer> constraints = new TreeMap<>();
for (Entry<String,String> property : this.getProperties(tableName)) {
if (property.getKey().startsWith(Property.TABLE_CONSTRAINT_PREFIX.toString())) {
if (constraints.containsKey(property.getValue()))
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/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 1940a26..3d17a85 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
@@ -148,7 +148,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
timer = new OpTimer().start();
}
- TreeSet<String> tableNames = new TreeSet<String>(Tables.getNameToIdMap(context.getInstance()).keySet());
+ TreeSet<String> tableNames = new TreeSet<>(Tables.getNameToIdMap(context.getInstance()).keySet());
if (timer != null) {
timer.stop();
@@ -378,7 +378,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;
@@ -388,7 +388,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)));
@@ -405,13 +405,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 {
@@ -529,7 +529,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) {
@@ -545,7 +545,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) {
@@ -561,7 +561,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 {
@@ -585,7 +585,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)
@@ -614,7 +614,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++) {
@@ -644,7 +644,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);
@@ -674,7 +674,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);
@@ -693,7 +693,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);
}
@@ -761,7 +761,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) {
@@ -781,7 +781,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) {
@@ -910,7 +910,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())) {
@@ -956,10 +956,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()));
@@ -982,7 +982,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, tableId);
// its possible that the cache could contain complete, but old information about a tables tablets... so clear it
@@ -1001,8 +1001,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());
@@ -1027,7 +1027,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));
@@ -1079,7 +1079,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);
@@ -1126,7 +1126,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();
@@ -1225,7 +1225,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);
@@ -1248,7 +1248,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);
@@ -1322,16 +1322,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/b102e760/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 cf388bf..9f869ff 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/b102e760/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 6054c19..9229643 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
@@ -99,7 +99,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() {
for (TabletLocator locator : locators.values()) {
@@ -148,7 +148,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) {
@@ -160,7 +160,7 @@ public abstract class TabletLocator {
}
}
- tabletLocs.put(tabletLoc, new WeakReference<String>(tabletLoc));
+ tabletLocs.put(tabletLoc, new WeakReference<>(tabletLoc));
return tabletLoc;
}
}
@@ -215,13 +215,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/b102e760/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 1422b0c..5932fda 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
@@ -90,12 +90,12 @@ public class TabletLocatorImpl extends TabletLocator {
protected String 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();
@@ -119,8 +119,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
@@ -130,7 +130,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;
@@ -173,7 +173,7 @@ public class TabletLocatorImpl extends TabletLocator {
timer = new OpTimer().start();
}
- ArrayList<T> notInCache = new ArrayList<T>();
+ ArrayList<T> notInCache = new ArrayList<>();
Text row = new Text();
LockCheckerSession lcSession = new LockCheckerSession();
@@ -247,7 +247,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;
@@ -265,8 +265,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;
@@ -676,7 +676,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());
@@ -685,12 +685,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) {
@@ -711,13 +711,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/b102e760/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 ce28f8b..0d4909b 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/b102e760/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 baeb2c9..8796d3c 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
@@ -90,7 +90,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;
@@ -117,7 +117,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(timeout, context, tableId);
@@ -126,7 +126,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()));
}
@@ -215,10 +215,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);
@@ -264,13 +264,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));
@@ -298,8 +298,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);
@@ -342,8 +342,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) {
@@ -462,7 +462,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
@@ -477,10 +477,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) {
@@ -489,13 +489,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<>();
}
}
@@ -518,13 +518,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
@@ -612,7 +611,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));
}
@@ -643,8 +642,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,
@@ -660,9 +658,9 @@ public class TabletServerBatchReaderIterator implements Iterator<Entry<Key,Value
(scanResult.more ? "scanID=" + imsr.scanID : ""), String.format("%.3f secs", timer.scale(TimeUnit.SECONDS)));
}
- 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)
@@ -692,9 +690,9 @@ public class TabletServerBatchReaderIterator implements Iterator<Entry<Key,Value
scanResult.results.size(), (scanResult.more ? " scanID=" + imsr.scanID : ""), String.format("%.3f secs", timer.scale(TimeUnit.SECONDS)));
}
- 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/b102e760/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 92f90a3..4df2db6 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
@@ -150,8 +150,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;
@@ -503,7 +503,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);
@@ -514,7 +514,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());
@@ -535,7 +535,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());
@@ -563,9 +563,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()));
@@ -663,10 +663,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());
}
@@ -693,7 +693,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) {
@@ -749,7 +749,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();
@@ -792,7 +792,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)
@@ -893,7 +893,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());
@@ -944,7 +944,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();
@@ -1019,13 +1019,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/b102e760/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 9a7f782..91b2637 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
@@ -75,7 +75,7 @@ import com.google.common.net.HostAndPort;
public class ThriftScanner {
private static final Logger log = LoggerFactory.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()) {
@@ -171,7 +171,7 @@ public class ThriftScanner {
this.authorizations = authorizations;
this.classLoaderContext = classLoaderContext;
- columns = new ArrayList<Column>(fetchedColumns.size());
+ columns = new ArrayList<>(fetchedColumns.size());
for (Column column : fetchedColumns) {
columns.add(column);
}
@@ -498,7 +498,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/b102e760/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/b102e760/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/b102e760/core/src/main/java/org/apache/accumulo/core/client/lexicoder/BigIntegerLexicoder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/lexicoder/BigIntegerLexicoder.java b/core/src/main/java/org/apache/accumulo/core/client/lexicoder/BigIntegerLexicoder.java
index 8147f18..669d070 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/lexicoder/BigIntegerLexicoder.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/lexicoder/BigIntegerLexicoder.java
@@ -16,22 +16,22 @@
*/
package org.apache.accumulo.core.client.lexicoder;
-import org.apache.accumulo.core.client.lexicoder.impl.AbstractLexicoder;
-import org.apache.accumulo.core.client.lexicoder.impl.FixedByteArrayOutputStream;
-import org.apache.accumulo.core.iterators.ValueFormatException;
-
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.math.BigInteger;
+import org.apache.accumulo.core.client.lexicoder.impl.AbstractLexicoder;
+import org.apache.accumulo.core.client.lexicoder.impl.FixedByteArrayOutputStream;
+import org.apache.accumulo.core.iterators.ValueFormatException;
+
/**
* A lexicoder to encode/decode a BigInteger to/from bytes that maintain its native Java sort order.
*
* @since 1.6.0
*/
-public class BigIntegerLexicoder extends AbstractLexicoder<BigInteger> implements Lexicoder<BigInteger> {
+public class BigIntegerLexicoder extends AbstractLexicoder<BigInteger> {
@Override
public byte[] encode(BigInteger v) {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/core/src/main/java/org/apache/accumulo/core/client/lexicoder/BytesLexicoder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/lexicoder/BytesLexicoder.java b/core/src/main/java/org/apache/accumulo/core/client/lexicoder/BytesLexicoder.java
index ae4dfbd..c755db6 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/lexicoder/BytesLexicoder.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/lexicoder/BytesLexicoder.java
@@ -24,7 +24,7 @@ import org.apache.accumulo.core.client.lexicoder.impl.AbstractLexicoder;
*
* @since 1.6.0
*/
-public class BytesLexicoder extends AbstractLexicoder<byte[]> implements Lexicoder<byte[]> {
+public class BytesLexicoder extends AbstractLexicoder<byte[]> {
@Override
public byte[] encode(byte[] data) {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/core/src/main/java/org/apache/accumulo/core/client/lexicoder/DateLexicoder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/lexicoder/DateLexicoder.java b/core/src/main/java/org/apache/accumulo/core/client/lexicoder/DateLexicoder.java
index 84ad808..8ce9c4d 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/lexicoder/DateLexicoder.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/lexicoder/DateLexicoder.java
@@ -16,16 +16,16 @@
*/
package org.apache.accumulo.core.client.lexicoder;
-import org.apache.accumulo.core.client.lexicoder.impl.AbstractLexicoder;
-
import java.util.Date;
+import org.apache.accumulo.core.client.lexicoder.impl.AbstractLexicoder;
+
/**
* A lexicoder for date objects. It preserves the native Java sort order for Date.
*
* @since 1.6.0
*/
-public class DateLexicoder extends AbstractLexicoder<Date> implements Lexicoder<Date> {
+public class DateLexicoder extends AbstractLexicoder<Date> {
private LongLexicoder longEncoder = new LongLexicoder();
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/core/src/main/java/org/apache/accumulo/core/client/lexicoder/DoubleLexicoder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/lexicoder/DoubleLexicoder.java b/core/src/main/java/org/apache/accumulo/core/client/lexicoder/DoubleLexicoder.java
index 67cf4d9..252523f 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/lexicoder/DoubleLexicoder.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/lexicoder/DoubleLexicoder.java
@@ -23,7 +23,7 @@ import org.apache.accumulo.core.client.lexicoder.impl.AbstractLexicoder;
*
* @since 1.6.0
*/
-public class DoubleLexicoder extends AbstractLexicoder<Double> implements Lexicoder<Double> {
+public class DoubleLexicoder extends AbstractLexicoder<Double> {
private ULongLexicoder longEncoder = new ULongLexicoder();
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/core/src/main/java/org/apache/accumulo/core/client/lexicoder/IntegerLexicoder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/lexicoder/IntegerLexicoder.java b/core/src/main/java/org/apache/accumulo/core/client/lexicoder/IntegerLexicoder.java
index f113f48..b58e673 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/lexicoder/IntegerLexicoder.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/lexicoder/IntegerLexicoder.java
@@ -24,7 +24,7 @@ import org.apache.accumulo.core.client.lexicoder.impl.AbstractLexicoder;
*
* @since 1.6.0
*/
-public class IntegerLexicoder extends AbstractLexicoder<Integer> implements Lexicoder<Integer> {
+public class IntegerLexicoder extends AbstractLexicoder<Integer> {
private UIntegerLexicoder uil = new UIntegerLexicoder();
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/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..8a38eb0 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
@@ -31,7 +31,7 @@ import org.apache.accumulo.core.client.lexicoder.impl.AbstractLexicoder;
*
* @since 1.6.0
*/
-public class ListLexicoder<LT> extends AbstractLexicoder<List<LT>> implements Lexicoder<List<LT>> {
+public class ListLexicoder<LT> extends AbstractLexicoder<List<LT>> {
private Lexicoder<LT> lexicoder;
@@ -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/b102e760/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..b286cf4 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
@@ -16,14 +16,14 @@
*/
package org.apache.accumulo.core.client.lexicoder;
-import org.apache.accumulo.core.client.lexicoder.impl.AbstractLexicoder;
-import org.apache.accumulo.core.util.ComparablePair;
-
import static org.apache.accumulo.core.client.lexicoder.impl.ByteUtils.concat;
import static org.apache.accumulo.core.client.lexicoder.impl.ByteUtils.escape;
import static org.apache.accumulo.core.client.lexicoder.impl.ByteUtils.split;
import static org.apache.accumulo.core.client.lexicoder.impl.ByteUtils.unescape;
+import org.apache.accumulo.core.client.lexicoder.impl.AbstractLexicoder;
+import org.apache.accumulo.core.util.ComparablePair;
+
/**
* This class is a lexicoder that sorts a ComparablePair. Each item in the pair is encoded with the given lexicoder and concatenated together. This makes it
* easy to construct a sortable key based on two components. There are many examples of this- but a key/value relationship is a great one.
@@ -49,8 +49,7 @@ import static org.apache.accumulo.core.client.lexicoder.impl.ByteUtils.unescape;
* @since 1.6.0
*/
-public class PairLexicoder<A extends Comparable<A>,B extends Comparable<B>> extends AbstractLexicoder<ComparablePair<A,B>> implements
- Lexicoder<ComparablePair<A,B>> {
+public class PairLexicoder<A extends Comparable<A>,B extends Comparable<B>> extends AbstractLexicoder<ComparablePair<A,B>> {
private Lexicoder<A> firstLexicoder;
private Lexicoder<B> secondLexicoder;
@@ -79,7 +78,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/b102e760/core/src/main/java/org/apache/accumulo/core/client/lexicoder/ReverseLexicoder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/lexicoder/ReverseLexicoder.java b/core/src/main/java/org/apache/accumulo/core/client/lexicoder/ReverseLexicoder.java
index 3a422d5..5243ea9 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/lexicoder/ReverseLexicoder.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/lexicoder/ReverseLexicoder.java
@@ -16,11 +16,11 @@
*/
package org.apache.accumulo.core.client.lexicoder;
-import org.apache.accumulo.core.client.lexicoder.impl.AbstractLexicoder;
-
import static org.apache.accumulo.core.client.lexicoder.impl.ByteUtils.escape;
import static org.apache.accumulo.core.client.lexicoder.impl.ByteUtils.unescape;
+import org.apache.accumulo.core.client.lexicoder.impl.AbstractLexicoder;
+
/**
* A lexicoder that flips the sort order from another lexicoder. If this is applied to {@link DateLexicoder}, the most recent date will be sorted first and the
* oldest date will be sorted last. If it's applied to {@link LongLexicoder}, the Long.MAX_VALUE will be sorted first and Long.MIN_VALUE will be sorted last,
@@ -29,7 +29,7 @@ import static org.apache.accumulo.core.client.lexicoder.impl.ByteUtils.unescape;
* @since 1.6.0
*/
-public class ReverseLexicoder<T> extends AbstractLexicoder<T> implements Lexicoder<T> {
+public class ReverseLexicoder<T> extends AbstractLexicoder<T> {
private Lexicoder<T> lexicoder;
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/core/src/main/java/org/apache/accumulo/core/client/lexicoder/StringLexicoder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/lexicoder/StringLexicoder.java b/core/src/main/java/org/apache/accumulo/core/client/lexicoder/StringLexicoder.java
index cec78de..17d4578 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/lexicoder/StringLexicoder.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/lexicoder/StringLexicoder.java
@@ -16,10 +16,10 @@
*/
package org.apache.accumulo.core.client.lexicoder;
-import org.apache.accumulo.core.client.lexicoder.impl.AbstractLexicoder;
-
import static java.nio.charset.StandardCharsets.UTF_8;
+import org.apache.accumulo.core.client.lexicoder.impl.AbstractLexicoder;
+
/**
* This lexicoder encodes/decodes a given String to/from bytes without further processing. It can be combined with other encoders like the
* {@link ReverseLexicoder} to flip the default sort order.
@@ -27,7 +27,7 @@ import static java.nio.charset.StandardCharsets.UTF_8;
* @since 1.6.0
*/
-public class StringLexicoder extends AbstractLexicoder<String> implements Lexicoder<String> {
+public class StringLexicoder extends AbstractLexicoder<String> {
@Override
public byte[] encode(String data) {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/core/src/main/java/org/apache/accumulo/core/client/lexicoder/TextLexicoder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/lexicoder/TextLexicoder.java b/core/src/main/java/org/apache/accumulo/core/client/lexicoder/TextLexicoder.java
index 2129ce7..c5a7596 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/lexicoder/TextLexicoder.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/lexicoder/TextLexicoder.java
@@ -27,7 +27,7 @@ import org.apache.hadoop.io.Text;
* @since 1.6.0
*/
-public class TextLexicoder extends AbstractLexicoder<Text> implements Lexicoder<Text> {
+public class TextLexicoder extends AbstractLexicoder<Text> {
@Override
public byte[] encode(Text data) {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/core/src/main/java/org/apache/accumulo/core/client/lexicoder/UIntegerLexicoder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/lexicoder/UIntegerLexicoder.java b/core/src/main/java/org/apache/accumulo/core/client/lexicoder/UIntegerLexicoder.java
index bd41ab6..c156d4c 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/lexicoder/UIntegerLexicoder.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/lexicoder/UIntegerLexicoder.java
@@ -24,7 +24,7 @@ import org.apache.accumulo.core.client.lexicoder.impl.AbstractLexicoder;
*
* @since 1.6.0
*/
-public class UIntegerLexicoder extends AbstractLexicoder<Integer> implements Lexicoder<Integer> {
+public class UIntegerLexicoder extends AbstractLexicoder<Integer> {
@Override
public byte[] encode(Integer i) {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/core/src/main/java/org/apache/accumulo/core/client/lexicoder/ULongLexicoder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/lexicoder/ULongLexicoder.java b/core/src/main/java/org/apache/accumulo/core/client/lexicoder/ULongLexicoder.java
index 0176043..8ebd0b9 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/lexicoder/ULongLexicoder.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/lexicoder/ULongLexicoder.java
@@ -24,7 +24,7 @@ import org.apache.accumulo.core.client.lexicoder.impl.AbstractLexicoder;
*
* @since 1.6.0
*/
-public class ULongLexicoder extends AbstractLexicoder<Long> implements Lexicoder<Long> {
+public class ULongLexicoder extends AbstractLexicoder<Long> {
@Override
public byte[] encode(Long l) {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/core/src/main/java/org/apache/accumulo/core/client/lexicoder/UUIDLexicoder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/lexicoder/UUIDLexicoder.java b/core/src/main/java/org/apache/accumulo/core/client/lexicoder/UUIDLexicoder.java
index 70405f5..2d5b811 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/lexicoder/UUIDLexicoder.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/lexicoder/UUIDLexicoder.java
@@ -31,7 +31,7 @@ import org.apache.accumulo.core.iterators.ValueFormatException;
*
* @since 1.6.0
*/
-public class UUIDLexicoder extends AbstractLexicoder<UUID> implements Lexicoder<UUID> {
+public class UUIDLexicoder extends AbstractLexicoder<UUID> {
/**
* {@inheritDoc}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/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/b102e760/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 dd92ae3..6165346 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
@@ -662,7 +662,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();
@@ -696,12 +696,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()) {
@@ -740,9 +740,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);
@@ -755,7 +755,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));
@@ -779,7 +779,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/b102e760/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 461bdc0..5feadb8 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,12 +543,12 @@ 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()) {
String tableId = ke.getKey().getTableId().toString();
Set<SecurityErrorCode> secCodes = tables.get(tableId);
if (secCodes == null) {
- secCodes = new HashSet<SecurityErrorCode>();
+ secCodes = new HashSet<>();
tables.put(tableId, secCodes);
}
secCodes.addAll(ke.getValue());
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/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 067fde8..5049ef7 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/b102e760/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 e7cb8ec..9ccf78a 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
@@ -708,7 +708,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()) {
@@ -743,12 +743,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()) {
@@ -790,9 +790,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);
@@ -805,7 +805,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});
@@ -828,7 +828,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/b102e760/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 fa926b6..1e06ca3 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
@@ -428,7 +428,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);
@@ -542,12 +542,12 @@ 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()) {
String tableId = ke.getKey().getTableId().toString();
Set<SecurityErrorCode> secCodes = tables.get(tableId);
if (secCodes == null) {
- secCodes = new HashSet<SecurityErrorCode>();
+ secCodes = new HashSet<>();
tables.put(tableId, secCodes);
}
secCodes.addAll(ke.getValue());
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b102e760/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 7dcb35b..043f88a 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/b102e760/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 df0aa65..a8724c2 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
@@ -305,13 +305,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);
@@ -320,7 +320,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();
@@ -330,7 +330,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/b102e760/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 1786eb3..1e89500 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
@@ -160,7 +160,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());
}
@@ -209,7 +209,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));
}
@@ -475,7 +475,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/b102e760/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);