/** * Utility method that sets name, daemon status and starts passed thread. * @param t thread to frob * @param name new name * @return Returns the passed Thread <code>t</code>. */ public static <T extends Thread> T setDaemonThreadRunning(T t, String name) { return setDaemonThreadRunning(t, name, null); }
/** * Utility method that sets name, daemon status and starts passed thread. * @param t thread to run * @return Returns the passed Thread <code>t</code>. */ public static <T extends Thread> T setDaemonThreadRunning(T t) { return setDaemonThreadRunning(t, t.getName()); }
@Override public void startup() { // mark we are running now this.sourceRunning = true; initThread = new Thread(this::initialize); Threads.setDaemonThreadRunning(initThread, Thread.currentThread().getName() + ".replicationSource," + this.queueId, this::uncaughtException); }
public void startup(UncaughtExceptionHandler handler) { String name = Thread.currentThread().getName(); Threads.setDaemonThreadRunning(this, name + ".replicationSource.shipper" + walGroupId + "," + source.getQueueId(), handler); }
@Override protected void initCache() { // concurrent cache maxCacheSize = resultSize2CacheSize(maxScannerResultSize); cache = new LinkedBlockingQueue<>(); cacheSizeInBytes = new AtomicLong(0); exceptionsQueue = new ConcurrentLinkedQueue<>(); prefetcher = new Thread(new PrefetchRunnable()); Threads.setDaemonThreadRunning(prefetcher, tableName + ".asyncPrefetcher"); }
TaskMonitor(Configuration conf) { maxTasks = conf.getInt(MAX_TASKS_KEY, DEFAULT_MAX_TASKS); expirationTime = conf.getLong(EXPIRATION_TIME_KEY, DEFAULT_EXPIRATION_TIME); rpcWarnTime = conf.getLong(RPC_WARN_TIME_KEY, DEFAULT_RPC_WARN_TIME); tasks = new CircularFifoQueue(maxTasks); rpcTasks = Lists.newArrayList(); monitorInterval = conf.getLong(MONITOR_INTERVAL_KEY, DEFAULT_MONITOR_INTERVAL); monitorThread = new Thread(new MonitorRunnable()); Threads.setDaemonThreadRunning(monitorThread, "Monitor thread for TaskMonitor"); }
public ReadOnlyZKClient(Configuration conf) { // We might use a different ZK for client access String clientZkQuorumServers = ZKConfig.getClientZKQuorumServersString(conf); if (clientZkQuorumServers != null) { this.connectString = clientZkQuorumServers; } else { this.connectString = ZKConfig.getZKQuorumServersString(conf); } this.sessionTimeoutMs = conf.getInt(ZK_SESSION_TIMEOUT, DEFAULT_ZK_SESSION_TIMEOUT); this.maxRetries = conf.getInt(RECOVERY_RETRY, DEFAULT_RECOVERY_RETRY); this.retryIntervalMs = conf.getInt(RECOVERY_RETRY_INTERVAL_MILLIS, DEFAULT_RECOVERY_RETRY_INTERVAL_MILLIS); this.keepAliveTimeMs = conf.getInt(KEEPALIVE_MILLIS, DEFAULT_KEEPALIVE_MILLIS); LOG.debug( "Connect {} to {} with session timeout={}ms, retries {}, " + "retry interval {}ms, keepAlive={}ms", getId(), connectString, sessionTimeoutMs, maxRetries, retryIntervalMs, keepAliveTimeMs); Threads.setDaemonThreadRunning(new Thread(this::run), "ReadOnlyZKClient-" + connectString + "@" + getId()); }
private void tryStartNewShipper(String walGroupId, PriorityBlockingQueue<Path> queue) { ReplicationSourceShipper worker = createNewShipper(walGroupId, queue); ReplicationSourceShipper extant = workerThreads.putIfAbsent(walGroupId, worker); if (extant != null) { LOG.debug("Someone has beat us to start a worker thread for wal group {}", walGroupId); } else { LOG.debug("Starting up worker for wal group {}", walGroupId); ReplicationSourceWALReader walReader = createNewWALReader(walGroupId, queue, worker.getStartPosition()); Threads.setDaemonThreadRunning(walReader, Thread.currentThread().getName() + ".replicationSource.wal-reader." + walGroupId + "," + queueId, this::uncaughtException); worker.setWALReader(walReader); worker.startup(this::uncaughtException); } }
public Thread start() { Thread t = new Thread(this); t = Threads.setDaemonThreadRunning(t); try { startedLatch.await(); } catch (InterruptedException e) { fail("Unexpected"); } return t; }
try { if (!conf.getBoolean("hbase.testing.nocluster", false)) { Threads.setDaemonThreadRunning(new Thread(() -> { try { int infoPort = putUpJettyServer();
conf.getInt("hbase.regionserver.executor.switch.rpc.throttle.threads", 1)); Threads.setDaemonThreadRunning(this.walRoller.getThread(), getName() + ".logRoller", uncaughtExceptionHandler); this.cacheFlusher.start(uncaughtExceptionHandler); Threads.setDaemonThreadRunning(this.procedureResultReporter, getName() + ".procedureResultReporter", uncaughtExceptionHandler); Threads.setDaemonThreadRunning(this.leases.getThread(), getName() + ".leaseChecker", uncaughtExceptionHandler);
Threads.setDaemonThreadRunning(new Thread(r));
server = new TokenServer(conf, TEST_UTIL); serverThread = new Thread(server); Threads.setDaemonThreadRunning(serverThread, "TokenServer:"+server.getServerName().toString());
final MockRegionServerServices mockServices = new MockRegionServerServices(getConf()); final LogRoller roller = new LogRoller(mockServices, mockServices); Threads.setDaemonThreadRunning(roller.getThread(), "WALPerfEval.logRoller");
@Override protected void initCache() { // concurrent cache maxCacheSize = resultSize2CacheSize(maxScannerResultSize); cache = new LinkedBlockingQueue<>(); cacheSizeInBytes = new AtomicLong(0); exceptionsQueue = new ConcurrentLinkedQueue<>(); prefetcher = new Thread(new PrefetchRunnable()); Threads.setDaemonThreadRunning(prefetcher, tableName + ".asyncPrefetcher"); }
public ReadOnlyZKClient(Configuration conf) { // We might use a different ZK for client access String clientZkQuorumServers = ZKConfig.getClientZKQuorumServersString(conf); if (clientZkQuorumServers != null) { this.connectString = clientZkQuorumServers; } else { this.connectString = ZKConfig.getZKQuorumServersString(conf); } this.sessionTimeoutMs = conf.getInt(ZK_SESSION_TIMEOUT, DEFAULT_ZK_SESSION_TIMEOUT); this.maxRetries = conf.getInt(RECOVERY_RETRY, DEFAULT_RECOVERY_RETRY); this.retryIntervalMs = conf.getInt(RECOVERY_RETRY_INTERVAL_MILLIS, DEFAULT_RECOVERY_RETRY_INTERVAL_MILLIS); this.keepAliveTimeMs = conf.getInt(KEEPALIVE_MILLIS, DEFAULT_KEEPALIVE_MILLIS); LOG.debug( "Connect {} to {} with session timeout={}ms, retries {}, " + "retry interval {}ms, keepAlive={}ms", getId(), connectString, sessionTimeoutMs, maxRetries, retryIntervalMs, keepAliveTimeMs); Threads.setDaemonThreadRunning(new Thread(this::run), "ReadOnlyZKClient-" + connectString + "@" + getId()); }
/** * Utility method that sets name, daemon status and starts passed thread. * @param t thread to frob * @param name new name * @return Returns the passed Thread <code>t</code>. */ public static <T extends Thread> T setDaemonThreadRunning(T t, String name) { return setDaemonThreadRunning(t, name, null); }
/** * Utility method that sets name, daemon status and starts passed thread. * @param t thread to frob * @param name new name * @return Returns the passed Thread <code>t</code>. */ public static <T extends Thread> T setDaemonThreadRunning(T t, String name) { return setDaemonThreadRunning(t, name, null); }
/** * Utility method that sets name, daemon status and starts passed thread. * @param t thread to run * @return Returns the passed Thread <code>t</code>. */ public static Thread setDaemonThreadRunning(final Thread t) { return setDaemonThreadRunning(t, t.getName()); }
private static Thread getAndStartBalancerChore(final FMaster master) { // Start up the load balancer chore Chore chore = new BalancerChore(master); return Threads.setDaemonThreadRunning(chore.getThread()); }