public static synchronized void remove(final Task task) { checkNotNull(task); // ignore if not enabled or hook never installed if (!enabled || hook == null) { return; } // Drop the task tasks.remove(task); // If there are no more tasks, then remove the hook thread if (tasks.isEmpty()) { removeHook(hook); hook = null; } }
public void restore() throws Exception { TerminalFactory.resetIf(this); if (shutdownTask != null) { ShutdownHooks.remove(shutdownTask); shutdownTask = null; } }
ShutdownHooks.add(historyFlusher);
public static synchronized <T extends Task> T add(final T task) { checkNotNull(task); // If not enabled ignore if (!enabled) { Log.debug("Shutdown-hook is disabled; not installing: ", task); return task; } // Install the hook thread if needed if (hook == null) { hook = addHook(new Thread("JLine Shutdown Hook") { @Override public void run() { runTasks(); } }); } // Track the task Log.debug("Adding shutdown-hook task: ", task); tasks.add(task); return task; }
public void restore() throws Exception { TerminalFactory.resetIf(this); if (shutdownTask != null) { ShutdownHooks.remove(shutdownTask); shutdownTask = null; } }
public static synchronized <T extends Task> T add(final T task) { checkNotNull(task); // If not enabled ignore if (!enabled) { Log.debug("Shutdown-hook is disabled; not installing: ", task); return task; } // Install the hook thread if needed if (hook == null) { hook = addHook(new Thread("JLine Shutdown Hook") { @Override public void run() { runTasks(); } }); } // Track the task Log.debug("Adding shutdown-hook task: ", task); tasks.add(task); return task; }
originalStdOut.flush(); if (historyFlusher != null) { ShutdownHooks.remove(historyFlusher); history.flush();
public static synchronized void remove(final Task task) { checkNotNull(task); // ignore if not enabled or hook never installed if (!enabled || hook == null) { return; } // Drop the task tasks.remove(task); // If there are no more tasks, then remove the hook thread if (tasks.isEmpty()) { removeHook(hook); hook = null; } }