/** * Shutdown passed thread using isAlive and join. * @param t Thread to shutdown */ public static void shutdown(final Thread t) { shutdown(t, 0); }
void join() { for (FlushHandler flushHander : flushHandlers) { if (flushHander != null) { Threads.shutdown(flushHander.getThread()); } } }
private void terminate(String reason, Exception cause) { if (cause == null) { LOG.info("Closing worker for wal group {} because: {}", this.walGroupId, reason); } else { LOG.error( "Closing worker for wal group " + this.walGroupId + " because an error occurred: " + reason, cause); } entryReader.interrupt(); Threads.shutdown(entryReader, sleepForRetries); this.interrupt(); Threads.shutdown(this, sleepForRetries); LOG.info("ReplicationSourceWorker {} terminated", this.getName()); } }
@Override public void run() { boolean b = this.conf.getBoolean(RUN_SHUTDOWN_HOOK, true); LOG.info("Shutdown hook starting; " + RUN_SHUTDOWN_HOOK + "=" + b + "; fsShutdownHook=" + this.fsShutdownHook); if (b) { this.stop.stop("Shutdown hook"); Threads.shutdown(this.threadToJoin); if (this.fsShutdownHook != null) { synchronized (fsShutdownHooks) { int refs = fsShutdownHooks.get(fsShutdownHook); if (refs == 1) { LOG.info("Starting fs shutdown hook thread."); Thread fsShutdownHookThread = (fsShutdownHook instanceof Thread) ? (Thread)fsShutdownHook : new Thread(fsShutdownHook, fsShutdownHook.getClass().getSimpleName() + "-shutdown-hook"); fsShutdownHookThread.start(); Threads.shutdown(fsShutdownHookThread, this.conf.getLong(FS_SHUTDOWN_HOOK_WAIT, 30000)); } if (refs > 0) { fsShutdownHooks.put(fsShutdownHook, refs - 1); } } } } LOG.info("Shutdown hook finished."); } }
@Override public void run() { try { this.user.runAs(new PrivilegedAction<Object>() { @Override public Object run() { runRegionServer(); return null; } }); } catch (Throwable t) { LOG.error("Exception in run", t); } finally { // Run this on the way out. if (this.shutdownThread != null) { this.shutdownThread.start(); Threads.shutdown(this.shutdownThread, 30000); } } }
@Override public void accept(HRegion hRegion) { if (hRegion.getRegionInfo().containsRow(key3)) { Threads.shutdown(ealierBulkload);/// wait util the other bulkload finished } } } ;
@After public void tearDown() throws Exception { server.stop("Test complete"); Threads.shutdown(serverThread); TEST_UTIL.shutdownMiniZKCluster(); }
public void unlock() throws IOException { Threads.shutdown(worker.shutdown()); try { stub.lockHeartbeat(null, LockHeartbeatRequest.newBuilder().setProcId(procId).setKeepAlive(false).build()); } catch (Exception e) { throw ProtobufUtil.handleRemoteException(e); } }
for (int i = 0; i < threads.length; ++i) Threads.shutdown(threads[i]); ProcedureTestingUtility.waitNoProcedureRunning(procExecutor); assertEquals(null, t1Exception.get());
/** * Shutdown passed thread using isAlive and join. * @param t Thread to shutdown */ public static void shutdown(final Thread t) { shutdown(t, 0); }
/** * Shutdown passed thread using isAlive and join. * @param t Thread to shutdown */ public static void shutdown(final Thread t) { shutdown(t, 0); }
/** * Shutdown passed thread using isAlive and join. * @param t Thread to shutdown */ public static void shutdown(final Thread t) { shutdown(t, 0); }
/** * Shutdown passed thread using isAlive and join. * @param t Thread to shutdown */ public static void shutdown(final Thread t) { shutdown(t, 0); }
public void terminate(String reason, Exception cause) { if (cause == null) { LOG.info("Closing source " + this.peerClusterZnode + " because: " + reason); } else { LOG.error("Closing source " + this.peerClusterZnode + " because an error occurred: " + reason, cause); } this.running = false; // Only wait for the thread to die if it's not us if (!Thread.currentThread().equals(this)) { Threads.shutdown(this, this.sleepForRetries); } }
void join() { for (FlushHandler flushHander : flushHandlers) { if (flushHander != null) { Threads.shutdown(flushHander.getThread()); } } }
@Override public void accept(HRegion hRegion) { if (hRegion.getRegionInfo().containsRow(key3)) { Threads.shutdown(ealierBulkload);/// wait util the other bulkload finished } } } ;
private void terminate(String reason, Exception cause) { if (cause == null) { LOG.info("Closing worker for wal group " + this.walGroupId + " because: " + reason); } else { LOG.error("Closing worker for wal group " + this.walGroupId + " because an error occurred: " + reason, cause); } this.interrupt(); Threads.shutdown(this, sleepForRetries); LOG.info("ReplicationSourceWorker " + this.getName() + " terminated"); }
@After public void tearDown() throws Exception { server.stop("Test complete"); Threads.shutdown(serverThread); TEST_UTIL.shutdownMiniZKCluster(); }