/** * Method invoked when the given thread terminates due to the * given uncaught exception. * <p>Any exception thrown by this method will be ignored by the * Java Virtual Machine. * * @param t the thread * @param e the exception */ @Override public void uncaughtException(Thread t, Throwable e) { String msg = String.format("Uncaught exception in thread %s.", t.getName()); LOGGER.error(msg, e); System.err.println(msg); e.printStackTrace(System.err); try { Util.logThreadDump("Thread dump from uncaught exception handler."); runnable.run(); } catch (Throwable throwable) { // Ignore to avoid further exception propagation } } }
/** * Method invoked when the given thread terminates due to the * given uncaught exception. * <p>Any exception thrown by this method will be ignored by the * Java Virtual Machine. * * @param t the thread * @param e the exception */ @Override public void uncaughtException(Thread t, Throwable e) { String msg = String.format("Uncaught exception in thread %s.", t.getName()); LOGGER.error(msg, e); System.err.println(msg); e.printStackTrace(System.err); try { Util.logThreadDump("Thread dump from uncaught exception handler."); runnable.run(); } catch (Throwable throwable) { // Ignore to avoid further exception propagation } } }
/** * Method invoked when the given thread terminates due to the * given uncaught exception. * <p>Any exception thrown by this method will be ignored by the * Java Virtual Machine. * * @param t the thread * @param e the exception */ @Override public void uncaughtException(Thread t, Throwable e) { String msg = String.format("Uncaught exception in thread %s.", t.getName()); LOGGER.error(msg, e); System.err.println(msg); e.printStackTrace(System.err); try { Util.logThreadDump("Thread dump from uncaught exception handler."); runnable.run(); } catch (Throwable throwable) { // Ignore to avoid further exception propagation } } }
/** * Method invoked when the given thread terminates due to the * given uncaught exception. * <p>Any exception thrown by this method will be ignored by the * Java Virtual Machine. * * @param t the thread * @param e the exception */ @Override public void uncaughtException(Thread t, Throwable e) { String msg = String.format("Uncaught exception in thread %s.", t.getName()); LOGGER.error(msg, e); System.err.println(msg); e.printStackTrace(System.err); try { Util.logThreadDump("Thread dump from uncaught exception handler."); runnable.run(); } catch (Throwable throwable) { // Ignore to avoid further exception propagation } } }
} else { LOG.error("Shutdown function for {} remains unfinished after timeout({}ms) or interruption", message, timeoutMs); Util.logThreadDump(message); shutdownExecutorService.shutdownNow(); return false;
} else { LOG.error("Shutdown function for {} remains unfinished after timeout({}ms) or interruption", message, timeoutMs); Util.logThreadDump(message); shutdownExecutorService.shutdownNow(); return false;
public void start() { if (started) { LOG.warn("Skipping attempt to start an already started ContainerHeartbeatMonitor."); return; } LOG.info("Starting ContainerHeartbeatMonitor"); scheduler.scheduleAtFixedRate(() -> { ContainerHeartbeatResponse response = containerHeartbeatClient.requestHeartbeat(); if (!response.isAlive()) { scheduler.schedule(() -> { // On timeout of container shutting down, force exit. LOG.error("Graceful shutdown timeout expired. Force exiting."); Util.logThreadDump("Thread dump at heartbeat monitor shutdown timeout."); System.exit(1); }, SHUTDOWN_TIMOUT_MS, TimeUnit.MILLISECONDS); onContainerExpired.run(); } }, 0, SCHEDULE_MS, TimeUnit.MILLISECONDS); started = true; }
public void start() { if (started) { LOG.warn("Skipping attempt to start an already started ContainerHeartbeatMonitor."); return; } LOG.info("Starting ContainerHeartbeatMonitor"); scheduler.scheduleAtFixedRate(() -> { ContainerHeartbeatResponse response = containerHeartbeatClient.requestHeartbeat(); if (!response.isAlive()) { scheduler.schedule(() -> { // On timeout of container shutting down, force exit. LOG.error("Graceful shutdown timeout expired. Force exiting."); Util.logThreadDump("Thread dump at heartbeat monitor shutdown timeout."); System.exit(1); }, SHUTDOWN_TIMOUT_MS, TimeUnit.MILLISECONDS); onContainerExpired.run(); } }, 0, SCHEDULE_MS, TimeUnit.MILLISECONDS); started = true; }
public void start() { if (started) { LOG.warn("Skipping attempt to start an already started ContainerHeartbeatMonitor."); return; } LOG.info("Starting ContainerHeartbeatMonitor"); scheduler.scheduleAtFixedRate(() -> { ContainerHeartbeatResponse response = containerHeartbeatClient.requestHeartbeat(); if (!response.isAlive()) { scheduler.schedule(() -> { // On timeout of container shutting down, force exit. LOG.error("Graceful shutdown timeout expired. Force exiting."); Util.logThreadDump("Thread dump at heartbeat monitor shutdown timeout."); System.exit(1); }, SHUTDOWN_TIMOUT_MS, TimeUnit.MILLISECONDS); onContainerExpired.run(); } }, 0, SCHEDULE_MS, TimeUnit.MILLISECONDS); started = true; }
public void start() { if (started) { LOG.warn("Skipping attempt to start an already started ContainerHeartbeatMonitor."); return; } LOG.info("Starting ContainerHeartbeatMonitor"); scheduler.scheduleAtFixedRate(() -> { ContainerHeartbeatResponse response = containerHeartbeatClient.requestHeartbeat(); if (!response.isAlive()) { scheduler.schedule(() -> { // On timeout of container shutting down, force exit. LOG.error("Graceful shutdown timeout expired. Force exiting."); Util.logThreadDump("Thread dump at heartbeat monitor shutdown timeout."); System.exit(1); }, SHUTDOWN_TIMOUT_MS, TimeUnit.MILLISECONDS); onContainerExpired.run(); } }, 0, SCHEDULE_MS, TimeUnit.MILLISECONDS); started = true; }
} else { LOG.error("Shutdown function for {} remains unfinished after timeout({}ms) or interruption", message, timeoutMs); Util.logThreadDump(message); shutdownExecutorService.shutdownNow(); return false;
} else { LOG.error("Shutdown function for {} remains unfinished after timeout({}ms) or interruption", message, timeoutMs); Util.logThreadDump(message); shutdownExecutorService.shutdownNow(); return false;
@Override public void run() { Util.logThreadDump("Thread dump at task callback timeout"); String msg = "Callback for task {} " + callback.taskName + " timed out after " + timeout + " ms."; callback.failure(new SamzaException(msg)); } };
@Override public void run() { Util.logThreadDump("Thread dump at task callback timeout"); String msg = "Callback for task {} " + callback.taskName + " timed out after " + timeout + " ms."; callback.failure(new SamzaException(msg)); } };
@Override public void run() { Util.logThreadDump("Thread dump at task callback timeout"); String msg = "Callback for task {} " + callback.taskName + " timed out after " + timeout + " ms."; callback.failure(new SamzaException(msg)); } };
@Override public void run() { Util.logThreadDump("Thread dump at task callback timeout"); String msg = "Callback for task {} " + callback.taskName + " timed out after " + timeout + " ms."; callback.failure(new SamzaException(msg)); } };