You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ec...@apache.org on 2015/07/17 20:53:10 UTC
[6/6] accumulo git commit: ACCUMULO-2346 update all sleeps to a
specific time unit
ACCUMULO-2346 update all sleeps to a specific time unit
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/7ec6291a
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/7ec6291a
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/7ec6291a
Branch: refs/heads/master
Commit: 7ec6291a31bd154a08ecd2994cee30b60317a38d
Parents: 5dbb768
Author: Eric C. Newton <er...@gmail.com>
Authored: Fri Jul 17 12:58:58 2015 -0400
Committer: Eric C. Newton <er...@gmail.com>
Committed: Fri Jul 17 12:58:58 2015 -0400
----------------------------------------------------------------------
.../accumulo/core/client/IsolatedScanner.java | 5 ++--
.../core/client/impl/ConditionalWriterImpl.java | 4 +--
.../accumulo/core/client/impl/MasterClient.java | 9 +++---
.../core/client/impl/OfflineIterator.java | 8 ++++--
.../client/impl/ReplicationOperationsImpl.java | 6 ++--
.../core/client/impl/RootTabletLocator.java | 6 ++--
.../accumulo/core/client/impl/ServerClient.java | 8 ++++--
.../core/client/impl/TableOperationsImpl.java | 24 ++++++++--------
.../core/client/impl/TabletLocatorImpl.java | 6 ++--
.../accumulo/core/client/impl/Writer.java | 8 ++++--
.../core/client/mapred/AbstractInputFormat.java | 10 +++++--
.../client/mapreduce/AbstractInputFormat.java | 10 +++++--
.../accumulo/core/client/TestThrift1474.java | 5 ++--
.../impl/MiniAccumuloClusterImpl.java | 4 +--
.../org/apache/accumulo/server/Accumulo.java | 8 ++++--
.../accumulo/server/client/BulkImporter.java | 4 +--
.../accumulo/server/rpc/TServerUtils.java | 5 ++--
.../org/apache/accumulo/server/util/Halt.java | 7 +++--
.../server/util/MasterMetadataUtil.java | 8 ++++--
.../accumulo/server/util/MetadataTableUtil.java | 8 +++---
.../server/util/ReplicationTableUtil.java | 6 ++--
.../accumulo/server/util/TabletIterator.java | 9 +++---
.../accumulo/gc/SimpleGarbageCollector.java | 4 +--
.../java/org/apache/accumulo/master/Master.java | 17 ++++++------
.../master/MasterClientServiceHandler.java | 5 ++--
.../accumulo/master/TabletGroupWatcher.java | 7 +++--
.../DistributedWorkQueueWorkAssigner.java | 5 ++--
.../replication/UnorderedWorkAssigner.java | 6 ++--
.../accumulo/master/replication/WorkDriver.java | 7 +++--
.../accumulo/master/tableOps/BulkImport.java | 5 ++--
.../accumulo/master/tableOps/LoadFiles.java | 8 ++++--
.../org/apache/accumulo/monitor/Monitor.java | 11 ++++----
.../accumulo/monitor/ZooKeeperStatus.java | 5 ++--
.../org/apache/accumulo/tracer/TraceServer.java | 5 ++--
.../apache/accumulo/tserver/InMemoryMap.java | 8 ++++--
.../apache/accumulo/tserver/TabletServer.java | 12 ++++----
.../tserver/TabletServerResourceManager.java | 4 +--
.../tserver/log/TabletServerLogger.java | 4 +--
.../replication/AccumuloReplicaSystem.java | 5 ++--
.../tserver/tablet/DatafileManager.java | 8 ++++--
.../accumulo/tserver/tablet/MinorCompactor.java | 6 ++--
.../apache/accumulo/tserver/tablet/Tablet.java | 6 ++--
.../accumulo/shell/commands/TraceCommand.java | 6 ++--
.../accumulo/test/AssignmentThreadsIT.java | 7 +++--
.../test/BadDeleteMarkersCreatedIT.java | 6 ++--
.../apache/accumulo/test/BalanceFasterIT.java | 7 +++--
.../org/apache/accumulo/test/CleanWalIT.java | 5 ++--
.../accumulo/test/ConditionalWriterIT.java | 8 +++---
.../org/apache/accumulo/test/ExistingMacIT.java | 6 ++--
.../apache/accumulo/test/IMMLGBenchmark.java | 5 ++--
.../apache/accumulo/test/MetaGetsReadersIT.java | 5 ++--
.../accumulo/test/MultiTableRecoveryIT.java | 5 ++--
.../org/apache/accumulo/test/NamespacesIT.java | 16 ++++++-----
.../accumulo/test/NativeMapPerformanceTest.java | 6 ++--
.../org/apache/accumulo/test/ShellServerIT.java | 19 +++++++------
.../accumulo/test/SplitCancelsMajCIT.java | 6 ++--
.../apache/accumulo/test/SplitRecoveryIT.java | 5 ++--
.../apache/accumulo/test/TableOperationsIT.java | 5 ++--
.../accumulo/test/TabletServerGivesUpIT.java | 6 ++--
.../org/apache/accumulo/test/TotalQueuedIT.java | 6 ++--
.../test/TracerRecoversAfterOfflineTableIT.java | 9 ++++--
.../test/continuous/ContinuousBatchWalker.java | 6 ++--
.../test/continuous/ContinuousScanner.java | 5 ++--
.../test/functional/AccumuloInputFormatIT.java | 6 ++--
.../accumulo/test/functional/AddSplitIT.java | 8 ++++--
.../test/functional/BadIteratorMincIT.java | 11 ++++----
.../test/functional/BatchScanSplitIT.java | 6 ++--
.../test/functional/BatchWriterFlushIT.java | 6 ++--
.../functional/BulkSplitOptimizationIT.java | 9 ++++--
.../test/functional/CacheTestReader.java | 6 ++--
.../test/functional/CacheTestWriter.java | 6 ++--
.../accumulo/test/functional/ClassLoaderIT.java | 10 ++++---
.../accumulo/test/functional/ConcurrencyIT.java | 7 +++--
.../accumulo/test/functional/ConstraintIT.java | 10 ++++---
.../test/functional/DeleteEverythingIT.java | 5 ++--
.../test/functional/DeleteRowsSplitIT.java | 6 ++--
.../test/functional/DynamicThreadPoolsIT.java | 8 ++++--
.../accumulo/test/functional/ExamplesIT.java | 9 +++---
.../test/functional/GarbageCollectorIT.java | 13 +++++----
.../test/functional/HalfDeadTServerIT.java | 14 ++++++----
.../accumulo/test/functional/LargeRowIT.java | 8 ++++--
.../accumulo/test/functional/MetadataIT.java | 5 ++--
.../test/functional/MetadataMaxFilesIT.java | 8 ++++--
.../test/functional/MetadataSplitIT.java | 6 ++--
.../accumulo/test/functional/RestartIT.java | 4 +--
.../test/functional/RestartStressIT.java | 4 +--
.../accumulo/test/functional/ScanIdIT.java | 10 ++++---
.../test/functional/ScanSessionTimeOutIT.java | 6 ++--
.../test/functional/ServerSideErrorIT.java | 6 ++--
.../accumulo/test/functional/ShutdownIT.java | 12 ++++----
.../functional/SimpleBalancerFairnessIT.java | 5 ++--
.../test/functional/SlowConstraint.java | 6 ++--
.../accumulo/test/functional/SlowIterator.java | 8 ++++--
.../accumulo/test/functional/SplitIT.java | 11 ++++----
.../accumulo/test/functional/TimeoutIT.java | 5 ++--
.../accumulo/test/functional/WALSunnyDayIT.java | 11 ++++----
.../accumulo/test/functional/ZombieTServer.java | 5 ++--
.../test/functional/ZookeeperRestartIT.java | 6 ++--
.../test/performance/thrift/NullTserver.java | 5 ++--
.../accumulo/test/proxy/ProxyDurabilityIT.java | 5 ++--
.../accumulo/test/proxy/SimpleProxyBase.java | 21 +++++++-------
.../randomwalk/concurrent/OfflineTable.java | 6 ++--
.../test/randomwalk/concurrent/Replication.java | 10 ++++---
.../test/randomwalk/concurrent/Shutdown.java | 10 ++++---
.../test/randomwalk/concurrent/StartAll.java | 6 ++--
.../test/randomwalk/shard/BulkInsert.java | 6 ++--
.../replication/MultiInstanceReplicationIT.java | 4 +--
.../test/replication/ReplicationIT.java | 29 ++++++++++----------
.../UnorderedWorkAssignerReplicationIT.java | 10 +++----
109 files changed, 492 insertions(+), 341 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/7ec6291a/core/src/main/java/org/apache/accumulo/core/client/IsolatedScanner.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/IsolatedScanner.java b/core/src/main/java/org/apache/accumulo/core/client/IsolatedScanner.java
index 2e9f1d5..0479f3b 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/IsolatedScanner.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/IsolatedScanner.java
@@ -28,9 +28,10 @@ import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.PartialKey;
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.Value;
-import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.hadoop.io.Text;
+import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
+
/**
* A scanner that presents a row isolated view of an accumulo table. Rows are buffered in memory on the client side. If you think your rows may not fit into
* memory, then you can provide an alternative row buffer factory to the constructor. This would allow rows to be buffered to disk for example.
@@ -111,7 +112,7 @@ public class IsolatedScanner extends ScannerOptions implements Scanner {
}
// wait a moment before retrying
- UtilWaitThread.sleep(100);
+ sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
source = newIterator(seekRange);
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/7ec6291a/core/src/main/java/org/apache/accumulo/core/client/impl/ConditionalWriterImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/ConditionalWriterImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/ConditionalWriterImpl.java
index 24040e6..6c6a551 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/ConditionalWriterImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ConditionalWriterImpl.java
@@ -74,7 +74,6 @@ import org.apache.accumulo.core.trace.Tracer;
import org.apache.accumulo.core.trace.thrift.TInfo;
import org.apache.accumulo.core.util.BadArgumentException;
import org.apache.accumulo.core.util.ByteBufferUtil;
-import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.accumulo.core.zookeeper.ZooUtil;
import org.apache.accumulo.fate.util.LoggingRunnable;
import org.apache.accumulo.fate.zookeeper.ZooCacheFactory;
@@ -91,6 +90,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.net.HostAndPort;
+import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
class ConditionalWriterImpl implements ConditionalWriter {
@@ -696,7 +696,7 @@ class ConditionalWriterImpl implements ConditionalWriter {
if ((System.currentTimeMillis() - startTime) + sleepTime > timeout)
throw new TimedOutException(Collections.singleton(location.toString()));
- UtilWaitThread.sleep(sleepTime);
+ sleepUninterruptibly(sleepTime, TimeUnit.MILLISECONDS);
sleepTime = Math.min(2 * sleepTime, MAX_SLEEP);
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/7ec6291a/core/src/main/java/org/apache/accumulo/core/client/impl/MasterClient.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/MasterClient.java b/core/src/main/java/org/apache/accumulo/core/client/impl/MasterClient.java
index 32a71bc..73e7f10 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/MasterClient.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/MasterClient.java
@@ -20,6 +20,7 @@ import static com.google.common.base.Preconditions.checkArgument;
import java.net.UnknownHostException;
import java.util.List;
+import java.util.concurrent.TimeUnit;
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
@@ -29,13 +30,13 @@ import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException;
import org.apache.accumulo.core.client.impl.thrift.ThriftTableOperationException;
import org.apache.accumulo.core.master.thrift.MasterClientService;
import org.apache.accumulo.core.rpc.ThriftUtil;
-import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.thrift.TServiceClient;
import org.apache.thrift.transport.TTransportException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.net.HostAndPort;
+import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
public class MasterClient {
private static final Logger log = LoggerFactory.getLogger(MasterClient.class);
@@ -46,7 +47,7 @@ public class MasterClient {
MasterClientService.Client result = getConnection(context);
if (result != null)
return result;
- UtilWaitThread.sleep(250);
+ sleepUninterruptibly(250, TimeUnit.MILLISECONDS);
}
}
@@ -97,7 +98,7 @@ public class MasterClient {
return exec.execute(client);
} catch (TTransportException tte) {
log.debug("MasterClient request failed, retrying ... ", tte);
- UtilWaitThread.sleep(100);
+ sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
} catch (ThriftSecurityException e) {
throw new AccumuloSecurityException(e.user, e.code, e);
} catch (AccumuloException e) {
@@ -130,7 +131,7 @@ public class MasterClient {
break;
} catch (TTransportException tte) {
log.debug("MasterClient request failed, retrying ... ", tte);
- UtilWaitThread.sleep(100);
+ sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
} catch (ThriftSecurityException e) {
throw new AccumuloSecurityException(e.user, e.code, e);
} catch (AccumuloException e) {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/7ec6291a/core/src/main/java/org/apache/accumulo/core/client/impl/OfflineIterator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/OfflineIterator.java b/core/src/main/java/org/apache/accumulo/core/client/impl/OfflineIterator.java
index 69ad41e..793b044 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/OfflineIterator.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/OfflineIterator.java
@@ -23,6 +23,7 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
+import java.util.concurrent.TimeUnit;
import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.client.AccumuloException;
@@ -45,8 +46,8 @@ import org.apache.accumulo.core.file.FileOperations;
import org.apache.accumulo.core.file.FileSKVIterator;
import org.apache.accumulo.core.iterators.IteratorEnvironment;
import org.apache.accumulo.core.iterators.IteratorUtil;
-import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope;
+import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
import org.apache.accumulo.core.iterators.system.ColumnFamilySkippingIterator;
import org.apache.accumulo.core.iterators.system.ColumnQualifierFilter;
import org.apache.accumulo.core.iterators.system.DeletingIterator;
@@ -61,13 +62,14 @@ import org.apache.accumulo.core.security.ColumnVisibility;
import org.apache.accumulo.core.util.CachedConfiguration;
import org.apache.accumulo.core.util.LocalityGroupUtil;
import org.apache.accumulo.core.util.Pair;
-import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.accumulo.core.volume.VolumeConfiguration;
import org.apache.commons.lang.NotImplementedException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.io.Text;
+import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
+
class OfflineIterator implements Iterator<Entry<Key,Value>> {
static class OfflineIteratorEnvironment implements IteratorEnvironment {
@@ -219,7 +221,7 @@ class OfflineIterator implements Iterator<Entry<Key,Value>> {
}
}
- UtilWaitThread.sleep(250);
+ sleepUninterruptibly(250, TimeUnit.MILLISECONDS);
eloc = getTabletFiles(nextRange, relFiles);
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/7ec6291a/core/src/main/java/org/apache/accumulo/core/client/impl/ReplicationOperationsImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/ReplicationOperationsImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/ReplicationOperationsImpl.java
index 009479e..5aed623 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/ReplicationOperationsImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ReplicationOperationsImpl.java
@@ -22,6 +22,7 @@ import java.util.Collections;
import java.util.HashSet;
import java.util.Map.Entry;
import java.util.Set;
+import java.util.concurrent.TimeUnit;
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
@@ -45,12 +46,13 @@ import org.apache.accumulo.core.security.thrift.TCredentials;
import org.apache.accumulo.core.tabletserver.log.LogEntry;
import org.apache.accumulo.core.trace.Tracer;
import org.apache.accumulo.core.trace.thrift.TInfo;
-import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.Text;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
+
public class ReplicationOperationsImpl implements ReplicationOperations {
private static final Logger log = LoggerFactory.getLogger(ReplicationOperationsImpl.class);
@@ -127,7 +129,7 @@ public class ReplicationOperationsImpl implements ReplicationOperations {
while (null == strTableId) {
strTableId = tops.tableIdMap().get(tableName);
if (null == strTableId) {
- UtilWaitThread.sleep(200);
+ sleepUninterruptibly(200, TimeUnit.MILLISECONDS);
}
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/7ec6291a/core/src/main/java/org/apache/accumulo/core/client/impl/RootTabletLocator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/RootTabletLocator.java b/core/src/main/java/org/apache/accumulo/core/client/impl/RootTabletLocator.java
index 3a0c0d7..0992517 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/RootTabletLocator.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/RootTabletLocator.java
@@ -20,6 +20,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.TimeUnit;
import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.client.AccumuloException;
@@ -32,7 +33,6 @@ import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.impl.KeyExtent;
import org.apache.accumulo.core.metadata.RootTable;
import org.apache.accumulo.core.util.OpTimer;
-import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.accumulo.core.zookeeper.ZooUtil;
import org.apache.accumulo.fate.zookeeper.ZooCache;
import org.apache.accumulo.fate.zookeeper.ZooCacheFactory;
@@ -40,6 +40,8 @@ import org.apache.hadoop.io.Text;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
+import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
+
public class RootTabletLocator extends TabletLocator {
private final TabletServerLockChecker lockChecker;
@@ -126,7 +128,7 @@ public class RootTabletLocator extends TabletLocator {
TabletLocation location = getRootTabletLocation(context);
// Always retry when finding the root tablet
while (retry && location == null) {
- UtilWaitThread.sleep(500);
+ sleepUninterruptibly(500, TimeUnit.MILLISECONDS);
location = getRootTabletLocation(context);
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/7ec6291a/core/src/main/java/org/apache/accumulo/core/client/impl/ServerClient.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/ServerClient.java b/core/src/main/java/org/apache/accumulo/core/client/impl/ServerClient.java
index 9ceb880..680d23a 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/ServerClient.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ServerClient.java
@@ -20,6 +20,7 @@ import static com.google.common.base.Preconditions.checkArgument;
import static java.nio.charset.StandardCharsets.UTF_8;
import java.util.ArrayList;
+import java.util.concurrent.TimeUnit;
import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.client.AccumuloException;
@@ -32,7 +33,6 @@ import org.apache.accumulo.core.rpc.ThriftUtil;
import org.apache.accumulo.core.util.Pair;
import org.apache.accumulo.core.util.ServerServices;
import org.apache.accumulo.core.util.ServerServices.Service;
-import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.accumulo.core.zookeeper.ZooUtil;
import org.apache.accumulo.fate.zookeeper.ZooCache;
import org.apache.accumulo.fate.zookeeper.ZooCacheFactory;
@@ -41,6 +41,8 @@ import org.apache.thrift.transport.TTransportException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
+
public class ServerClient {
private static final Logger log = LoggerFactory.getLogger(ServerClient.class);
@@ -79,7 +81,7 @@ public class ServerClient {
return exec.execute(client);
} catch (TTransportException tte) {
log.debug("ClientService request failed " + server + ", retrying ... ", tte);
- UtilWaitThread.sleep(100);
+ sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
} finally {
if (client != null)
ServerClient.close(client);
@@ -99,7 +101,7 @@ public class ServerClient {
break;
} catch (TTransportException tte) {
log.debug("ClientService request failed " + server + ", retrying ... ", tte);
- UtilWaitThread.sleep(100);
+ sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
} finally {
if (client != null)
ServerClient.close(client);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/7ec6291a/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..e6aecf2 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
@@ -104,7 +104,6 @@ import org.apache.accumulo.core.util.NamingThreadFactory;
import org.apache.accumulo.core.util.OpTimer;
import org.apache.accumulo.core.util.Pair;
import org.apache.accumulo.core.util.TextUtil;
-import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.accumulo.core.volume.VolumeConfiguration;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
@@ -118,6 +117,7 @@ import org.apache.thrift.transport.TTransportException;
import com.google.common.base.Joiner;
import com.google.common.net.HostAndPort;
+import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
public class TableOperationsImpl extends TableOperationsHelper {
@@ -200,7 +200,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
return client.beginFateOperation(Tracer.traceInfo(), context.rpcCreds());
} catch (TTransportException tte) {
log.debug("Failed to call beginFateOperation(), retrying ... ", tte);
- UtilWaitThread.sleep(100);
+ sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
} finally {
MasterClient.close(client);
}
@@ -218,7 +218,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
break;
} catch (TTransportException tte) {
log.debug("Failed to call executeFateOperation(), retrying ... ", tte);
- UtilWaitThread.sleep(100);
+ sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
} finally {
MasterClient.close(client);
}
@@ -233,7 +233,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
return client.waitForFateOperation(Tracer.traceInfo(), context.rpcCreds(), opid);
} catch (TTransportException tte) {
log.debug("Failed to call waitForFateOperation(), retrying ... ", tte);
- UtilWaitThread.sleep(100);
+ sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
} finally {
MasterClient.close(client);
}
@@ -249,7 +249,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
break;
} catch (TTransportException tte) {
log.debug("Failed to call finishFateOperation(), retrying ... ", tte);
- UtilWaitThread.sleep(100);
+ sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
} finally {
MasterClient.close(client);
}
@@ -420,7 +420,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
while (!successful) {
if (attempt > 0)
- UtilWaitThread.sleep(100);
+ sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
attempt++;
@@ -543,7 +543,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
}
log.info(e.getMessage() + " ... retrying ...");
- UtilWaitThread.sleep(3000);
+ sleepUninterruptibly(3, TimeUnit.SECONDS);
}
}
@@ -769,7 +769,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
break;
} catch (TTransportException tte) {
log.debug("Failed to call initiateFlush, retrying ... ", tte);
- UtilWaitThread.sleep(100);
+ sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
} finally {
MasterClient.close(client);
}
@@ -784,7 +784,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
break;
} catch (TTransportException tte) {
log.debug("Failed to call initiateFlush, retrying ... ", tte);
- UtilWaitThread.sleep(100);
+ sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
} finally {
MasterClient.close(client);
}
@@ -957,7 +957,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
log.warn("Unable to locate bins for specified range. Retrying.");
// sleep randomly between 100 and 200ms
- UtilWaitThread.sleep(100 + random.nextInt(100));
+ sleepUninterruptibly(100 + random.nextInt(100), TimeUnit.MILLISECONDS);
binnedRanges.clear();
tl.invalidateCache();
}
@@ -1156,7 +1156,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
waitTime = Math.min(5000, waitTime);
log.trace("Waiting for " + waitFor + "(" + maxPerServer + ") tablets, startRow = " + startRow + " lastRow = " + lastRow + ", holes=" + holes
+ " sleeping:" + waitTime + "ms");
- UtilWaitThread.sleep(waitTime);
+ sleepUninterruptibly(waitTime, TimeUnit.MILLISECONDS);
} else {
break;
}
@@ -1273,7 +1273,7 @@ public class TableOperationsImpl extends TableOperationsHelper {
} else {
log.debug("Disk usage request failed " + pair.getFirst() + ", retrying ... ", e);
}
- UtilWaitThread.sleep(100);
+ sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
} catch (TException e) {
// may be a TApplicationException which indicates error on the server side
throw new AccumuloException(e);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/7ec6291a/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..b2db827 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
@@ -30,6 +30,7 @@ import java.util.Map.Entry;
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.TreeSet;
+import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
@@ -45,12 +46,13 @@ import org.apache.accumulo.core.data.impl.KeyExtent;
import org.apache.accumulo.core.util.OpTimer;
import org.apache.accumulo.core.util.Pair;
import org.apache.accumulo.core.util.TextUtil;
-import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.io.WritableComparator;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
+import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
+
public class TabletLocatorImpl extends TabletLocator {
private static final Logger log = Logger.getLogger(TabletLocatorImpl.class);
@@ -439,7 +441,7 @@ public class TabletLocatorImpl extends TabletLocator {
TabletLocation tl = _locateTablet(context, row, skipRow, retry, true, lcSession);
if (retry && tl == null) {
- UtilWaitThread.sleep(100);
+ sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
if (log.isTraceEnabled())
log.trace("Failed to locate tablet containing row " + TextUtil.truncate(row) + " in table " + tableId + ", will retry...");
continue;
http://git-wip-us.apache.org/repos/asf/accumulo/blob/7ec6291a/core/src/main/java/org/apache/accumulo/core/client/impl/Writer.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/Writer.java b/core/src/main/java/org/apache/accumulo/core/client/impl/Writer.java
index cf2d642..b8ce516 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/Writer.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/Writer.java
@@ -19,6 +19,8 @@ package org.apache.accumulo.core.client.impl;
import static com.google.common.base.Preconditions.checkArgument;
import static java.nio.charset.StandardCharsets.UTF_8;
+import java.util.concurrent.TimeUnit;
+
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.TableNotFoundException;
@@ -32,7 +34,6 @@ import org.apache.accumulo.core.tabletserver.thrift.NotServingTabletException;
import org.apache.accumulo.core.tabletserver.thrift.TDurability;
import org.apache.accumulo.core.tabletserver.thrift.TabletClientService;
import org.apache.accumulo.core.trace.Tracer;
-import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.hadoop.io.Text;
import org.apache.thrift.TException;
import org.apache.thrift.TServiceClient;
@@ -40,6 +41,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.net.HostAndPort;
+import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
public class Writer {
@@ -89,7 +91,7 @@ public class Writer {
if (tabLoc == null) {
log.trace("No tablet location found for row " + new String(m.getRow(), UTF_8));
- UtilWaitThread.sleep(500);
+ sleepUninterruptibly(500, TimeUnit.MILLISECONDS);
continue;
}
@@ -110,7 +112,7 @@ public class Writer {
TabletLocator.getLocator(context, table).invalidateCache(tabLoc.tablet_extent);
}
- UtilWaitThread.sleep(500);
+ sleepUninterruptibly(500, TimeUnit.MILLISECONDS);
}
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/7ec6291a/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..2a25dd5 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
@@ -26,6 +26,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Random;
+import java.util.concurrent.TimeUnit;
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
@@ -68,7 +69,6 @@ import org.apache.accumulo.core.data.impl.KeyExtent;
import org.apache.accumulo.core.master.state.tables.TableState;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.util.Pair;
-import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapred.InputFormat;
import org.apache.hadoop.mapred.InputSplit;
@@ -78,6 +78,8 @@ import org.apache.hadoop.security.token.Token;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
+import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
+
/**
* An abstract input format to provide shared methods common to all other input format classes. At the very least, any classes inheriting from this class will
* need to define their own {@link RecordReader}.
@@ -667,7 +669,8 @@ public abstract class AbstractInputFormat<K,V> implements InputFormat<K,V> {
binnedRanges = binOfflineTable(job, tableId, ranges);
while (binnedRanges == null) {
// Some tablets were still online, try again
- UtilWaitThread.sleep(100 + random.nextInt(100)); // sleep randomly between 100 and 200 ms
+ // sleep randomly between 100 and 200 ms
+ sleepUninterruptibly(100 + random.nextInt(100), TimeUnit.MILLISECONDS);
binnedRanges = binOfflineTable(job, tableId, ranges);
}
} else {
@@ -686,7 +689,8 @@ public abstract class AbstractInputFormat<K,V> implements InputFormat<K,V> {
}
binnedRanges.clear();
log.warn("Unable to locate bins for specified ranges. Retrying.");
- UtilWaitThread.sleep(100 + random.nextInt(100)); // sleep randomly between 100 and 200 ms
+ // sleep randomly between 100 and 200 ms
+ sleepUninterruptibly(100 + random.nextInt(100), TimeUnit.MILLISECONDS);
tl.invalidateCache();
}
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/7ec6291a/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..76f3f20 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
@@ -26,6 +26,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Random;
+import java.util.concurrent.TimeUnit;
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
@@ -67,7 +68,6 @@ import org.apache.accumulo.core.data.impl.KeyExtent;
import org.apache.accumulo.core.master.state.tables.TableState;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.util.Pair;
-import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.InputFormat;
@@ -80,6 +80,8 @@ import org.apache.hadoop.security.token.Token;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
+import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
+
/**
* An abstract input format to provide shared methods common to all other input format classes. At the very least, any classes inheriting from this class will
* need to define their own {@link RecordReader}.
@@ -714,7 +716,8 @@ public abstract class AbstractInputFormat<K,V> extends InputFormat<K,V> {
binnedRanges = binOfflineTable(context, tableId, ranges);
while (binnedRanges == null) {
// Some tablets were still online, try again
- UtilWaitThread.sleep(100 + random.nextInt(100)); // sleep randomly between 100 and 200 ms
+ // sleep randomly between 100 and 200 ms
+ sleepUninterruptibly(100 + random.nextInt(100), TimeUnit.MILLISECONDS);
binnedRanges = binOfflineTable(context, tableId, ranges);
}
@@ -734,7 +737,8 @@ public abstract class AbstractInputFormat<K,V> extends InputFormat<K,V> {
}
binnedRanges.clear();
log.warn("Unable to locate bins for specified ranges. Retrying.");
- UtilWaitThread.sleep(100 + random.nextInt(100)); // sleep randomly between 100 and 200 ms
+ // sleep randomly between 100 and 200 ms
+ sleepUninterruptibly(100 + random.nextInt(100), TimeUnit.MILLISECONDS);
tl.invalidateCache();
}
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/7ec6291a/core/src/test/java/org/apache/accumulo/core/client/TestThrift1474.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/TestThrift1474.java b/core/src/test/java/org/apache/accumulo/core/client/TestThrift1474.java
index a99f415..845439e 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/TestThrift1474.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/TestThrift1474.java
@@ -25,7 +25,6 @@ import java.util.concurrent.TimeUnit;
import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException;
import org.apache.accumulo.core.client.impl.thrift.ThriftTest;
-import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.thrift.TException;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.protocol.TProtocol;
@@ -36,6 +35,8 @@ import org.apache.thrift.transport.TSocket;
import org.apache.thrift.transport.TTransport;
import org.junit.Test;
+import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
+
public class TestThrift1474 {
static class TestServer implements ThriftTest.Iface {
@@ -77,7 +78,7 @@ public class TestThrift1474 {
};
thread.start();
while (!server.isServing()) {
- UtilWaitThread.sleep(10);
+ sleepUninterruptibly(10, TimeUnit.MILLISECONDS);
}
TTransport transport = new TSocket("localhost", port);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/7ec6291a/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImpl.java
----------------------------------------------------------------------
diff --git a/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImpl.java b/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImpl.java
index 4c3d6f6..0cb14c7 100644
--- a/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImpl.java
+++ b/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImpl.java
@@ -75,7 +75,6 @@ import org.apache.accumulo.core.trace.Tracer;
import org.apache.accumulo.core.util.CachedConfiguration;
import org.apache.accumulo.core.util.Daemon;
import org.apache.accumulo.core.util.Pair;
-import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.accumulo.core.zookeeper.ZooUtil;
import org.apache.accumulo.fate.zookeeper.IZooReaderWriter;
import org.apache.accumulo.master.state.SetGoalState;
@@ -111,6 +110,7 @@ import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Joiner;
import com.google.common.base.Predicate;
import com.google.common.collect.Maps;
+import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
/**
* A utility class that will create Zookeeper and Accumulo processes that write all of their data to a single local directory. This class makes it easy to test
@@ -621,7 +621,7 @@ public class MiniAccumuloClusterImpl implements AccumuloCluster {
ret = exec(Main.class, SetGoalState.class.getName(), MasterGoalState.NORMAL.toString()).waitFor();
if (ret == 0)
break;
- UtilWaitThread.sleep(1000);
+ sleepUninterruptibly(1, TimeUnit.SECONDS);
}
if (ret != 0) {
throw new RuntimeException("Could not set master goal state, process returned " + ret + ". Check the logs in " + config.getLogDir() + " for errors.");
http://git-wip-us.apache.org/repos/asf/accumulo/blob/7ec6291a/server/base/src/main/java/org/apache/accumulo/server/Accumulo.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/Accumulo.java b/server/base/src/main/java/org/apache/accumulo/server/Accumulo.java
index c888be5..f55199f 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/Accumulo.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/Accumulo.java
@@ -27,6 +27,7 @@ import java.net.UnknownHostException;
import java.util.Arrays;
import java.util.Map.Entry;
import java.util.TreeMap;
+import java.util.concurrent.TimeUnit;
import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.client.AccumuloException;
@@ -34,7 +35,6 @@ import org.apache.accumulo.core.client.Instance;
import org.apache.accumulo.core.conf.AccumuloConfiguration;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.util.AddressUtil;
-import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.accumulo.core.util.Version;
import org.apache.accumulo.core.volume.Volume;
import org.apache.accumulo.core.zookeeper.ZooUtil;
@@ -55,6 +55,8 @@ import org.apache.log4j.Logger;
import org.apache.log4j.helpers.LogLog;
import org.apache.zookeeper.KeeperException;
+import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
+
public class Accumulo {
private static final Logger log = Logger.getLogger(Accumulo.class);
@@ -261,7 +263,7 @@ public class Accumulo {
// ignored
} catch (KeeperException ex) {
log.info("Waiting for accumulo to be initialized");
- UtilWaitThread.sleep(1000);
+ sleepUninterruptibly(1, TimeUnit.SECONDS);
}
}
log.info("ZooKeeper connected and initialized, attempting to talk to HDFS");
@@ -291,7 +293,7 @@ public class Accumulo {
}
}
log.info("Backing off due to failure; current sleep period is " + sleep / 1000. + " seconds");
- UtilWaitThread.sleep(sleep);
+ sleepUninterruptibly(sleep, TimeUnit.MILLISECONDS);
/* Back off to give transient failures more time to clear. */
sleep = Math.min(60 * 1000, sleep * 2);
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/7ec6291a/server/base/src/main/java/org/apache/accumulo/server/client/BulkImporter.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/client/BulkImporter.java b/server/base/src/main/java/org/apache/accumulo/server/client/BulkImporter.java
index 283d304..6e0583e 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/client/BulkImporter.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/client/BulkImporter.java
@@ -58,7 +58,6 @@ import org.apache.accumulo.core.trace.Tracer;
import org.apache.accumulo.core.util.CachedConfiguration;
import org.apache.accumulo.core.util.NamingThreadFactory;
import org.apache.accumulo.core.util.StopWatch;
-import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.accumulo.fate.util.LoggingRunnable;
import org.apache.accumulo.server.fs.VolumeManager;
import org.apache.accumulo.server.fs.VolumeManagerImpl;
@@ -73,6 +72,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.net.HostAndPort;
+import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
public class BulkImporter {
@@ -187,7 +187,7 @@ public class BulkImporter {
// same key range and are contiguous (no holes, no overlap)
timer.start(Timers.SLEEP);
- UtilWaitThread.sleep(sleepTime);
+ sleepUninterruptibly(sleepTime, TimeUnit.MILLISECONDS);
timer.stop(Timers.SLEEP);
log.debug("Trying to assign " + assignmentFailures.size() + " map files that previously failed on some key extents");
http://git-wip-us.apache.org/repos/asf/accumulo/blob/7ec6291a/server/base/src/main/java/org/apache/accumulo/server/rpc/TServerUtils.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/rpc/TServerUtils.java b/server/base/src/main/java/org/apache/accumulo/server/rpc/TServerUtils.java
index aaccc34..eb8095f 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/rpc/TServerUtils.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/rpc/TServerUtils.java
@@ -29,6 +29,7 @@ import java.util.Random;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
import javax.net.ssl.SSLServerSocket;
@@ -39,7 +40,6 @@ import org.apache.accumulo.core.rpc.ThriftUtil;
import org.apache.accumulo.core.rpc.UGIAssumingTransportFactory;
import org.apache.accumulo.core.util.Daemon;
import org.apache.accumulo.core.util.SimpleThreadPool;
-import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.accumulo.fate.util.LoggingRunnable;
import org.apache.accumulo.server.AccumuloServerContext;
import org.apache.accumulo.server.util.Halt;
@@ -62,6 +62,7 @@ import org.slf4j.LoggerFactory;
import com.google.common.base.Preconditions;
import com.google.common.net.HostAndPort;
+import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
/**
* Factory methods for creating Thrift server objects
@@ -157,7 +158,7 @@ public class TServerUtils {
// TTransportException, and with a TSocket created by TSSLTransportFactory, it
// comes through as caused by a BindException.
log.info("Unable to use port {}, retrying. (Thread Name = {})", port, threadName);
- UtilWaitThread.sleep(250);
+ sleepUninterruptibly(250, TimeUnit.MILLISECONDS);
} else {
// thrift is passing up a nested exception that isn't a BindException,
// so no reason to believe retrying on a different port would help.
http://git-wip-us.apache.org/repos/asf/accumulo/blob/7ec6291a/server/base/src/main/java/org/apache/accumulo/server/util/Halt.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/Halt.java b/server/base/src/main/java/org/apache/accumulo/server/util/Halt.java
index 7f57687..cbd8510 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/util/Halt.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/Halt.java
@@ -16,11 +16,14 @@
*/
package org.apache.accumulo.server.util;
+import java.util.concurrent.TimeUnit;
+
import org.apache.accumulo.core.util.Daemon;
-import org.apache.accumulo.core.util.UtilWaitThread;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
+
public class Halt {
static private final Logger log = LoggerFactory.getLogger(Halt.class);
@@ -49,7 +52,7 @@ public class Halt {
new Daemon() {
@Override
public void run() {
- UtilWaitThread.sleep(100);
+ sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
Runtime.getRuntime().halt(status);
}
}.start();
http://git-wip-us.apache.org/repos/asf/accumulo/blob/7ec6291a/server/base/src/main/java/org/apache/accumulo/server/util/MasterMetadataUtil.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/MasterMetadataUtil.java b/server/base/src/main/java/org/apache/accumulo/server/util/MasterMetadataUtil.java
index bac70b2..5d84ee4 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/util/MasterMetadataUtil.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/MasterMetadataUtil.java
@@ -28,6 +28,7 @@ import java.util.Map.Entry;
import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;
+import java.util.concurrent.TimeUnit;
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.Scanner;
@@ -47,7 +48,6 @@ import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.Lo
import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.ScanFileColumnFamily;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.util.ColumnFQ;
-import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.accumulo.fate.zookeeper.IZooReaderWriter;
import org.apache.accumulo.fate.zookeeper.ZooUtil.NodeMissingPolicy;
import org.apache.accumulo.server.fs.FileRef;
@@ -61,6 +61,8 @@ import org.apache.zookeeper.KeeperException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
+
/**
*
*/
@@ -196,7 +198,7 @@ public class MasterMetadataUtil {
} catch (InterruptedException e) {
log.error("{}", e.getMessage(), e);
}
- UtilWaitThread.sleep(1000);
+ sleepUninterruptibly(1, TimeUnit.SECONDS);
}
}
@@ -279,7 +281,7 @@ public class MasterMetadataUtil {
} catch (InterruptedException e) {
log.error("{}", e.getMessage(), e);
}
- UtilWaitThread.sleep(1000);
+ sleepUninterruptibly(1, TimeUnit.SECONDS);
}
}
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/7ec6291a/server/base/src/main/java/org/apache/accumulo/server/util/MetadataTableUtil.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/MetadataTableUtil.java b/server/base/src/main/java/org/apache/accumulo/server/util/MetadataTableUtil.java
index 4a85a88..bcfbbc8 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/util/MetadataTableUtil.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/MetadataTableUtil.java
@@ -74,7 +74,6 @@ import org.apache.accumulo.core.tabletserver.thrift.ConstraintViolationException
import org.apache.accumulo.core.util.ColumnFQ;
import org.apache.accumulo.core.util.FastFormat;
import org.apache.accumulo.core.util.Pair;
-import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.accumulo.core.zookeeper.ZooUtil;
import org.apache.accumulo.fate.zookeeper.IZooReaderWriter;
import org.apache.accumulo.fate.zookeeper.ZooUtil.NodeExistsPolicy;
@@ -96,6 +95,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.Optional;
+import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
/**
* provides a reference to the metadata table for updates by tablet servers
@@ -162,7 +162,7 @@ public class MetadataTableUtil {
} catch (TableNotFoundException e) {
log.error("{}", e.getMessage(), e);
}
- UtilWaitThread.sleep(1000);
+ sleepUninterruptibly(1, TimeUnit.SECONDS);
}
}
@@ -262,7 +262,7 @@ public class MetadataTableUtil {
} catch (Exception e) {
log.error("Unexpected exception {}", e.getMessage(), e);
}
- UtilWaitThread.sleep(1000);
+ sleepUninterruptibly(1, TimeUnit.SECONDS);
}
}
@@ -854,7 +854,7 @@ public class MetadataTableUtil {
log.debug("Tablets merged in table " + srcTableId + " while attempting to clone, trying again");
- UtilWaitThread.sleep(100);
+ sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
}
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/7ec6291a/server/base/src/main/java/org/apache/accumulo/server/util/ReplicationTableUtil.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/ReplicationTableUtil.java b/server/base/src/main/java/org/apache/accumulo/server/util/ReplicationTableUtil.java
index c6d5ce4..b57affe 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/util/ReplicationTableUtil.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/ReplicationTableUtil.java
@@ -21,6 +21,7 @@ import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
+import java.util.concurrent.TimeUnit;
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
@@ -43,7 +44,6 @@ import org.apache.accumulo.core.metadata.schema.MetadataSchema;
import org.apache.accumulo.core.metadata.schema.MetadataSchema.ReplicationSection;
import org.apache.accumulo.core.protobuf.ProtobufUtil;
import org.apache.accumulo.core.tabletserver.thrift.ConstraintViolationException;
-import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.accumulo.server.replication.StatusCombiner;
import org.apache.accumulo.server.replication.StatusFormatter;
import org.apache.accumulo.server.replication.proto.Replication.Status;
@@ -52,6 +52,8 @@ import org.apache.hadoop.io.Text;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
+
/**
* provides a reference to the replication table for updates by tablet servers
*/
@@ -168,7 +170,7 @@ public class ReplicationTableUtil {
} catch (TableNotFoundException e) {
log.error(e.toString(), e);
}
- UtilWaitThread.sleep(1000);
+ sleepUninterruptibly(1, TimeUnit.SECONDS);
}
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/7ec6291a/server/base/src/main/java/org/apache/accumulo/server/util/TabletIterator.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/TabletIterator.java b/server/base/src/main/java/org/apache/accumulo/server/util/TabletIterator.java
index 2137999..d6864c1 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/util/TabletIterator.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/TabletIterator.java
@@ -23,6 +23,7 @@ import java.util.NoSuchElementException;
import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;
+import java.util.concurrent.TimeUnit;
import org.apache.accumulo.core.client.Scanner;
import org.apache.accumulo.core.data.Key;
@@ -32,12 +33,12 @@ import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.data.impl.KeyExtent;
import org.apache.accumulo.core.metadata.MetadataTable;
import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection;
-import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.hadoop.io.Text;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.collect.Iterators;
+import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
/**
* This class iterates over the metadata table returning all key values for a tablet in one chunk. As it scans the metadata table it checks the correctness of
@@ -126,7 +127,7 @@ public class TabletIterator implements Iterator<Map<Key,Value>> {
currentTabletKeys = null;
resetScanner();
- UtilWaitThread.sleep(250);
+ sleepUninterruptibly(250, TimeUnit.MILLISECONDS);
continue;
}
@@ -141,7 +142,7 @@ public class TabletIterator implements Iterator<Map<Key,Value>> {
currentTabletKeys = null;
resetScanner();
- UtilWaitThread.sleep(250);
+ sleepUninterruptibly(250, TimeUnit.MILLISECONDS);
continue;
@@ -218,7 +219,7 @@ public class TabletIterator implements Iterator<Map<Key,Value>> {
resetScanner();
curMetaDataRow = null;
tm.clear();
- UtilWaitThread.sleep(250);
+ sleepUninterruptibly(250, TimeUnit.MILLISECONDS);
} else {
break;
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/7ec6291a/server/gc/src/main/java/org/apache/accumulo/gc/SimpleGarbageCollector.java
----------------------------------------------------------------------
diff --git a/server/gc/src/main/java/org/apache/accumulo/gc/SimpleGarbageCollector.java b/server/gc/src/main/java/org/apache/accumulo/gc/SimpleGarbageCollector.java
index 4f64c15..2c894f8 100644
--- a/server/gc/src/main/java/org/apache/accumulo/gc/SimpleGarbageCollector.java
+++ b/server/gc/src/main/java/org/apache/accumulo/gc/SimpleGarbageCollector.java
@@ -73,7 +73,6 @@ import org.apache.accumulo.core.util.NamingThreadFactory;
import org.apache.accumulo.core.util.Pair;
import org.apache.accumulo.core.util.ServerServices;
import org.apache.accumulo.core.util.ServerServices.Service;
-import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.accumulo.core.volume.Volume;
import org.apache.accumulo.core.zookeeper.ZooUtil;
import org.apache.accumulo.fate.zookeeper.ZooLock.LockLossReason;
@@ -111,6 +110,7 @@ import com.google.common.base.Function;
import com.google.common.collect.Iterators;
import com.google.common.collect.Maps;
import com.google.common.net.HostAndPort;
+import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
import com.google.protobuf.InvalidProtocolBufferException;
public class SimpleGarbageCollector extends AccumuloServerContext implements Iface {
@@ -705,7 +705,7 @@ public class SimpleGarbageCollector extends AccumuloServerContext implements Ifa
return;
}
log.debug("Failed to get GC ZooKeeper lock, will retry");
- UtilWaitThread.sleep(1000);
+ sleepUninterruptibly(1, TimeUnit.SECONDS);
}
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/7ec6291a/server/master/src/main/java/org/apache/accumulo/master/Master.java
----------------------------------------------------------------------
diff --git a/server/master/src/main/java/org/apache/accumulo/master/Master.java b/server/master/src/main/java/org/apache/accumulo/master/Master.java
index c698b45..6f8bc55 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/Master.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/Master.java
@@ -32,6 +32,7 @@ import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
@@ -73,7 +74,6 @@ import org.apache.accumulo.core.trace.DistributedTrace;
import org.apache.accumulo.core.trace.thrift.TInfo;
import org.apache.accumulo.core.util.Daemon;
import org.apache.accumulo.core.util.Pair;
-import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.accumulo.core.zookeeper.ZooUtil;
import org.apache.accumulo.fate.AgeOffStore;
import org.apache.accumulo.fate.Fate;
@@ -158,6 +158,7 @@ import org.slf4j.LoggerFactory;
import com.google.common.base.Optional;
import com.google.common.collect.Iterables;
+import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
/**
* The Master is responsible for assigning and balancing tablets to tablet servers.
@@ -697,7 +698,7 @@ public class Master extends AccumuloServerContext implements LiveTServerSet.List
return MasterGoalState.valueOf(new String(data));
} catch (Exception e) {
log.error("Problem getting real goal state from zookeeper: " + e);
- UtilWaitThread.sleep(1000);
+ sleepUninterruptibly(1, TimeUnit.SECONDS);
}
}
@@ -827,7 +828,7 @@ public class Master extends AccumuloServerContext implements LiveTServerSet.List
log.error("Error cleaning up migrations", ex);
}
}
- UtilWaitThread.sleep(TIME_BETWEEN_MIGRATION_CLEANUPS);
+ sleepUninterruptibly(TIME_BETWEEN_MIGRATION_CLEANUPS, TimeUnit.MILLISECONDS);
}
}
@@ -965,7 +966,7 @@ public class Master extends AccumuloServerContext implements LiveTServerSet.List
eventListener.waitForEvents(wait);
} catch (Throwable t) {
log.error("Error balancing tablets, will wait for " + WAIT_BETWEEN_ERRORS / ONE_SECOND + " (seconds) and then retry", t);
- UtilWaitThread.sleep(WAIT_BETWEEN_ERRORS);
+ sleepUninterruptibly(WAIT_BETWEEN_ERRORS, TimeUnit.MILLISECONDS);
}
}
}
@@ -1167,7 +1168,7 @@ public class Master extends AccumuloServerContext implements LiveTServerSet.List
log.info("Waiting for AuthenticationTokenKeyManager to be initialized");
logged = true;
}
- UtilWaitThread.sleep(200);
+ sleepUninterruptibly(200, TimeUnit.MILLISECONDS);
}
// And log when we are initialized
log.info("AuthenticationTokenSecretManager is initialized");
@@ -1190,7 +1191,7 @@ public class Master extends AccumuloServerContext implements LiveTServerSet.List
masterLock.replaceLockData(address.getBytes());
while (!clientService.isServing()) {
- UtilWaitThread.sleep(100);
+ sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
}
// Start the daemon to scan the replication table and make units of work
@@ -1229,7 +1230,7 @@ public class Master extends AccumuloServerContext implements LiveTServerSet.List
}
while (clientService.isServing()) {
- UtilWaitThread.sleep(500);
+ sleepUninterruptibly(500, TimeUnit.MILLISECONDS);
}
log.info("Shutting down fate.");
fate.shutdown();
@@ -1345,7 +1346,7 @@ public class Master extends AccumuloServerContext implements LiveTServerSet.List
masterLock.tryToCancelAsyncLockOrUnlock();
- UtilWaitThread.sleep(TIME_TO_WAIT_BETWEEN_LOCK_CHECKS);
+ sleepUninterruptibly(TIME_TO_WAIT_BETWEEN_LOCK_CHECKS, TimeUnit.MILLISECONDS);
}
setMasterState(MasterState.HAVE_LOCK);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/7ec6291a/server/master/src/main/java/org/apache/accumulo/master/MasterClientServiceHandler.java
----------------------------------------------------------------------
diff --git a/server/master/src/main/java/org/apache/accumulo/master/MasterClientServiceHandler.java b/server/master/src/main/java/org/apache/accumulo/master/MasterClientServiceHandler.java
index 0cb1272..7f23ad5 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/MasterClientServiceHandler.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/MasterClientServiceHandler.java
@@ -24,6 +24,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
+import java.util.concurrent.TimeUnit;
import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.client.AccumuloException;
@@ -71,7 +72,6 @@ import org.apache.accumulo.core.security.thrift.TDelegationToken;
import org.apache.accumulo.core.security.thrift.TDelegationTokenConfig;
import org.apache.accumulo.core.trace.thrift.TInfo;
import org.apache.accumulo.core.util.ByteBufferUtil;
-import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.accumulo.fate.zookeeper.IZooReaderWriter;
import org.apache.accumulo.fate.zookeeper.IZooReaderWriter.Mutator;
import org.apache.accumulo.master.tableOps.TraceRepo;
@@ -96,6 +96,7 @@ import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.KeeperException.NoNodeException;
import org.slf4j.Logger;
+import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
import com.google.protobuf.InvalidProtocolBufferException;
class MasterClientServiceHandler extends FateServiceHandler implements MasterClientService.Iface {
@@ -161,7 +162,7 @@ class MasterClientServiceHandler extends FateServiceHandler implements MasterCli
if (l == maxLoops - 1)
break;
- UtilWaitThread.sleep(50);
+ sleepUninterruptibly(50, TimeUnit.MILLISECONDS);
serversToFlush.clear();
http://git-wip-us.apache.org/repos/asf/accumulo/blob/7ec6291a/server/master/src/main/java/org/apache/accumulo/master/TabletGroupWatcher.java
----------------------------------------------------------------------
diff --git a/server/master/src/main/java/org/apache/accumulo/master/TabletGroupWatcher.java b/server/master/src/main/java/org/apache/accumulo/master/TabletGroupWatcher.java
index d2cbf62..d1272e8 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/TabletGroupWatcher.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/TabletGroupWatcher.java
@@ -30,6 +30,7 @@ import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.TreeSet;
+import java.util.concurrent.TimeUnit;
import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.client.AccumuloException;
@@ -60,7 +61,6 @@ import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.Fu
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.tabletserver.thrift.NotServingTabletException;
import org.apache.accumulo.core.util.Daemon;
-import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.accumulo.master.Master.TabletGoalState;
import org.apache.accumulo.master.state.MergeStats;
import org.apache.accumulo.master.state.TableCounts;
@@ -91,6 +91,7 @@ import org.apache.thrift.TException;
import com.google.common.base.Optional;
import com.google.common.collect.Iterators;
+import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
class TabletGroupWatcher extends Daemon {
// Constants used to make sure assignment logging isn't excessive in quantity or size
@@ -134,7 +135,7 @@ class TabletGroupWatcher extends Daemon {
while (this.master.stillMaster()) {
// slow things down a little, otherwise we spam the logs when there are many wake-up events
- UtilWaitThread.sleep(100);
+ sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
masterState = master.getMasterState();
int totalUnloaded = 0;
@@ -336,7 +337,7 @@ class TabletGroupWatcher extends Daemon {
if (ex.getCause() != null && ex.getCause() instanceof BadLocationStateException) {
repairMetadata(((BadLocationStateException) ex.getCause()).getEncodedEndRow());
} else {
- UtilWaitThread.sleep(Master.WAIT_BETWEEN_ERRORS);
+ sleepUninterruptibly(Master.WAIT_BETWEEN_ERRORS, TimeUnit.MILLISECONDS);
}
} finally {
if (iter != null) {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/7ec6291a/server/master/src/main/java/org/apache/accumulo/master/replication/DistributedWorkQueueWorkAssigner.java
----------------------------------------------------------------------
diff --git a/server/master/src/main/java/org/apache/accumulo/master/replication/DistributedWorkQueueWorkAssigner.java b/server/master/src/main/java/org/apache/accumulo/master/replication/DistributedWorkQueueWorkAssigner.java
index 4e3a079..a10c90d 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/replication/DistributedWorkQueueWorkAssigner.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/replication/DistributedWorkQueueWorkAssigner.java
@@ -19,6 +19,7 @@ package org.apache.accumulo.master.replication;
import java.util.Collection;
import java.util.Map.Entry;
import java.util.Set;
+import java.util.concurrent.TimeUnit;
import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.client.Scanner;
@@ -34,7 +35,6 @@ import org.apache.accumulo.core.replication.ReplicationSchema.WorkSection;
import org.apache.accumulo.core.replication.ReplicationTable;
import org.apache.accumulo.core.replication.ReplicationTableOfflineException;
import org.apache.accumulo.core.replication.ReplicationTarget;
-import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.accumulo.core.zookeeper.ZooUtil;
import org.apache.accumulo.server.replication.DistributedWorkQueueWorkAssignerHelper;
import org.apache.accumulo.server.replication.StatusUtil;
@@ -47,6 +47,7 @@ import org.apache.hadoop.io.Text;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
import com.google.protobuf.InvalidProtocolBufferException;
/**
@@ -178,7 +179,7 @@ public abstract class DistributedWorkQueueWorkAssigner implements WorkAssigner {
workScanner = ReplicationTable.getScanner(conn);
} catch (ReplicationTableOfflineException e) {
log.warn("Replication table is offline. Will retry...");
- UtilWaitThread.sleep(5000);
+ sleepUninterruptibly(5, TimeUnit.SECONDS);
return;
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/7ec6291a/server/master/src/main/java/org/apache/accumulo/master/replication/UnorderedWorkAssigner.java
----------------------------------------------------------------------
diff --git a/server/master/src/main/java/org/apache/accumulo/master/replication/UnorderedWorkAssigner.java b/server/master/src/main/java/org/apache/accumulo/master/replication/UnorderedWorkAssigner.java
index 9a28dd4..ab5b041 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/replication/UnorderedWorkAssigner.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/replication/UnorderedWorkAssigner.java
@@ -19,12 +19,12 @@ package org.apache.accumulo.master.replication;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
+import java.util.concurrent.TimeUnit;
import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.conf.AccumuloConfiguration;
import org.apache.accumulo.core.replication.ReplicationConstants;
import org.apache.accumulo.core.replication.ReplicationTarget;
-import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.accumulo.core.zookeeper.ZooUtil;
import org.apache.accumulo.server.replication.DistributedWorkQueueWorkAssignerHelper;
import org.apache.hadoop.fs.Path;
@@ -32,6 +32,8 @@ import org.apache.zookeeper.KeeperException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
+
/**
* Read work records from the replication table, create work entries for other nodes to complete.
* <p>
@@ -84,7 +86,7 @@ public class UnorderedWorkAssigner extends DistributedWorkQueueWorkAssigner {
} catch (KeeperException e) {
if (KeeperException.Code.NONODE.equals(e.code())) {
log.warn("Could not find ZK root for replication work queue, will retry", e);
- UtilWaitThread.sleep(500);
+ sleepUninterruptibly(500, TimeUnit.MILLISECONDS);
continue;
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/7ec6291a/server/master/src/main/java/org/apache/accumulo/master/replication/WorkDriver.java
----------------------------------------------------------------------
diff --git a/server/master/src/main/java/org/apache/accumulo/master/replication/WorkDriver.java b/server/master/src/main/java/org/apache/accumulo/master/replication/WorkDriver.java
index 3558d2d..f0c368a 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/replication/WorkDriver.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/replication/WorkDriver.java
@@ -16,18 +16,21 @@
*/
package org.apache.accumulo.master.replication;
+import java.util.concurrent.TimeUnit;
+
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.conf.AccumuloConfiguration;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.util.Daemon;
-import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.accumulo.master.Master;
import org.apache.accumulo.server.replication.WorkAssigner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
+
/**
* Driver for a {@link WorkAssigner}
*/
@@ -103,7 +106,7 @@ public class WorkDriver extends Daemon {
long sleepTime = conf.getTimeInMillis(Property.REPLICATION_WORK_ASSIGNMENT_SLEEP);
log.debug("Sleeping {} ms before next work assignment", sleepTime);
- UtilWaitThread.sleep(sleepTime);
+ sleepUninterruptibly(sleepTime, TimeUnit.MILLISECONDS);
// After each loop, make sure that the WorkAssigner implementation didn't change
configureWorkAssigner();
http://git-wip-us.apache.org/repos/asf/accumulo/blob/7ec6291a/server/master/src/main/java/org/apache/accumulo/master/tableOps/BulkImport.java
----------------------------------------------------------------------
diff --git a/server/master/src/main/java/org/apache/accumulo/master/tableOps/BulkImport.java b/server/master/src/main/java/org/apache/accumulo/master/tableOps/BulkImport.java
index eb19706..5313964 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/tableOps/BulkImport.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/tableOps/BulkImport.java
@@ -33,7 +33,6 @@ import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.file.FileOperations;
import org.apache.accumulo.core.master.state.tables.TableState;
import org.apache.accumulo.core.util.SimpleThreadPool;
-import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.accumulo.fate.Repo;
import org.apache.accumulo.master.Master;
import org.apache.accumulo.server.ServerConstants;
@@ -47,6 +46,8 @@ import org.apache.hadoop.io.MapFile;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
+
/*
* Bulk import makes requests of tablet servers, and those requests can take a
* long time. Our communications to the tablet server may fail, so we won't know
@@ -170,7 +171,7 @@ public class BulkImport extends MasterRepo {
return newBulkDir;
log.warn("Failed to create " + newBulkDir + " for unknown reason");
- UtilWaitThread.sleep(3000);
+ sleepUninterruptibly(3, TimeUnit.SECONDS);
}
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/7ec6291a/server/master/src/main/java/org/apache/accumulo/master/tableOps/LoadFiles.java
----------------------------------------------------------------------
diff --git a/server/master/src/main/java/org/apache/accumulo/master/tableOps/LoadFiles.java b/server/master/src/main/java/org/apache/accumulo/master/tableOps/LoadFiles.java
index 9e72eab..0c0aad6 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/tableOps/LoadFiles.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/tableOps/LoadFiles.java
@@ -30,6 +30,7 @@ import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
import org.apache.accumulo.core.client.impl.AcceptableThriftTableOperationException;
import org.apache.accumulo.core.client.impl.ServerClient;
@@ -42,7 +43,6 @@ import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.trace.Tracer;
import org.apache.accumulo.core.util.Pair;
import org.apache.accumulo.core.util.SimpleThreadPool;
-import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.accumulo.fate.Repo;
import org.apache.accumulo.master.Master;
import org.apache.accumulo.server.fs.VolumeManager;
@@ -53,6 +53,8 @@ import org.apache.htrace.wrappers.TraceExecutorService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
+
class LoadFiles extends MasterRepo {
private static final long serialVersionUID = 1L;
@@ -124,7 +126,7 @@ class LoadFiles extends MasterRepo {
log.warn("There are no tablet server to process bulk import, waiting (tid = " + tid + ")");
while (master.onlineTabletServers().size() == 0) {
- UtilWaitThread.sleep(500);
+ sleepUninterruptibly(500, TimeUnit.MILLISECONDS);
}
// Use the threadpool to assign files one-at-a-time to the server
@@ -167,7 +169,7 @@ class LoadFiles extends MasterRepo {
filesToLoad.removeAll(loaded);
if (filesToLoad.size() > 0) {
log.debug("tid " + tid + " attempt " + (attempt + 1) + " " + sampleList(filesToLoad, 10) + " failed");
- UtilWaitThread.sleep(100);
+ sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
}
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/7ec6291a/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java
----------------------------------------------------------------------
diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java
index 6e00863..9e44e70 100644
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java
+++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java
@@ -30,6 +30,7 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.TimerTask;
+import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;
@@ -54,7 +55,6 @@ import org.apache.accumulo.core.util.Daemon;
import org.apache.accumulo.core.util.Pair;
import org.apache.accumulo.core.util.ServerServices;
import org.apache.accumulo.core.util.ServerServices.Service;
-import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.accumulo.core.zookeeper.ZooUtil;
import org.apache.accumulo.fate.util.LoggingRunnable;
import org.apache.accumulo.fate.zookeeper.ZooLock.LockLossReason;
@@ -98,6 +98,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.net.HostAndPort;
+import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
/**
* Serve master statistics with an embedded web server.
@@ -289,7 +290,7 @@ public class Monitor {
}
}
if (mmi == null)
- UtilWaitThread.sleep(1000);
+ sleepUninterruptibly(1, TimeUnit.SECONDS);
}
if (mmi != null) {
int majorCompactions = 0;
@@ -511,7 +512,7 @@ public class Monitor {
log.warn("{}", e.getMessage(), e);
}
- UtilWaitThread.sleep(333);
+ sleepUninterruptibly(333, TimeUnit.MILLISECONDS);
}
}
@@ -526,7 +527,7 @@ public class Monitor {
} catch (Exception e) {
log.warn("{}", e.getMessage(), e);
}
- UtilWaitThread.sleep(5000);
+ sleepUninterruptibly(5, TimeUnit.SECONDS);
}
}
}), "Scan scanner").start();
@@ -637,7 +638,7 @@ public class Monitor {
monitorLock.tryToCancelAsyncLockOrUnlock();
- UtilWaitThread.sleep(getContext().getConfiguration().getTimeInMillis(Property.MONITOR_LOCK_CHECK_INTERVAL));
+ sleepUninterruptibly(getContext().getConfiguration().getTimeInMillis(Property.MONITOR_LOCK_CHECK_INTERVAL), TimeUnit.MILLISECONDS);
}
log.info("Got Monitor lock.");
http://git-wip-us.apache.org/repos/asf/accumulo/blob/7ec6291a/server/monitor/src/main/java/org/apache/accumulo/monitor/ZooKeeperStatus.java
----------------------------------------------------------------------
diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/ZooKeeperStatus.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/ZooKeeperStatus.java
index 2e89344..7e992e0 100644
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/ZooKeeperStatus.java
+++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/ZooKeeperStatus.java
@@ -22,17 +22,18 @@ import java.util.Collection;
import java.util.Objects;
import java.util.SortedSet;
import java.util.TreeSet;
+import java.util.concurrent.TimeUnit;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.conf.SiteConfiguration;
import org.apache.accumulo.core.rpc.TTimeoutTransport;
-import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.thrift.transport.TTransport;
import org.apache.thrift.transport.TTransportException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.net.HostAndPort;
+import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
public class ZooKeeperStatus implements Runnable {
@@ -142,7 +143,7 @@ public class ZooKeeperStatus implements Runnable {
}
}
status = update;
- UtilWaitThread.sleep(5 * 1000);
+ sleepUninterruptibly(5, TimeUnit.SECONDS);
}
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/7ec6291a/server/tracer/src/main/java/org/apache/accumulo/tracer/TraceServer.java
----------------------------------------------------------------------
diff --git a/server/tracer/src/main/java/org/apache/accumulo/tracer/TraceServer.java b/server/tracer/src/main/java/org/apache/accumulo/tracer/TraceServer.java
index 7511f3c..d200e7b 100644
--- a/server/tracer/src/main/java/org/apache/accumulo/tracer/TraceServer.java
+++ b/server/tracer/src/main/java/org/apache/accumulo/tracer/TraceServer.java
@@ -42,7 +42,6 @@ import org.apache.accumulo.core.conf.SiteConfiguration;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.iterators.user.AgeOffFilter;
-import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.accumulo.fate.zookeeper.IZooReaderWriter;
import org.apache.accumulo.fate.zookeeper.ZooUtil.NodeExistsPolicy;
import org.apache.accumulo.server.Accumulo;
@@ -77,6 +76,8 @@ import org.apache.zookeeper.Watcher.Event.KeeperState;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
+
public class TraceServer implements Watcher {
final private static Logger log = LoggerFactory.getLogger(TraceServer.class);
@@ -220,7 +221,7 @@ public class TraceServer implements Watcher {
break;
} catch (RuntimeException ex) {
log.info("Waiting to checking/create the trace table.", ex);
- UtilWaitThread.sleep(1000);
+ sleepUninterruptibly(1, TimeUnit.SECONDS);
}
}
this.connector = connector;
http://git-wip-us.apache.org/repos/asf/accumulo/blob/7ec6291a/server/tserver/src/main/java/org/apache/accumulo/tserver/InMemoryMap.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/InMemoryMap.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/InMemoryMap.java
index 2d3a0a1..2274eea 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/InMemoryMap.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/InMemoryMap.java
@@ -29,6 +29,7 @@ import java.util.Set;
import java.util.SortedMap;
import java.util.UUID;
import java.util.concurrent.ConcurrentSkipListMap;
+import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
@@ -60,7 +61,6 @@ import org.apache.accumulo.core.util.LocalityGroupUtil;
import org.apache.accumulo.core.util.LocalityGroupUtil.LocalityGroupConfigurationError;
import org.apache.accumulo.core.util.LocalityGroupUtil.Partitioner;
import org.apache.accumulo.core.util.PreAllocatedArray;
-import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.commons.lang.mutable.MutableLong;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
@@ -68,6 +68,8 @@ import org.apache.hadoop.fs.Path;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
+
public class InMemoryMap {
private SimpleMap map = null;
@@ -599,7 +601,7 @@ public class InMemoryMap {
long t1 = System.currentTimeMillis();
while (activeIters.size() > 0 && System.currentTimeMillis() - t1 < waitTime) {
- UtilWaitThread.sleep(50);
+ sleepUninterruptibly(50, TimeUnit.MILLISECONDS);
}
if (activeIters.size() > 0) {
@@ -651,7 +653,7 @@ public class InMemoryMap {
log.error("Failed to create mem dump file ", ioe);
while (activeIters.size() > 0) {
- UtilWaitThread.sleep(100);
+ sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
}
}