public void stop() throws InterruptedException { if (running) { running = false; if (thread != null) { thread.interrupt(); Logs.logThreadJoin(thread); thread.join(); thread = null; } } }
public synchronized void shutdown() throws InterruptedException { if (thread == null || !thread.isAlive()) { return; } stop = true; thread.interrupt(); Logs.logThreadJoin(thread); thread.join(); thread = null; }
public synchronized void shutdown(boolean interrupt) throws InterruptedException { stop = true; eventQueue.clear(); if (!thread.isAlive()) { return; } if (interrupt) { thread.interrupt(); } Logs.logThreadJoin(thread); thread.join(); thread = null; }
public synchronized void start() throws InterruptedException { if (thread != null) { log.warn("EventWorker start was requested, but old thread was still there. Stopping it now."); thread.interrupt(); Logs.logThreadJoin(thread); thread.join(); } eventQueue.clear(); stop = false; thread = new Thread(this, "RepositoryMasterEventWorker"); thread.start(); }
public synchronized void stopMonitoring() { if (monitorThread != null) { monitorThread.shutdown(); try { if (monitorThread.isAlive()) { Logs.logThreadJoin(monitorThread); monitorThread.join(); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); } monitorThread = null; } }