public void shutdown() { for (DataQueue q : topology.getAllDataQueue()) { for (DataBolt bolt : q.bolts) { bolt.shutdown(); } } workPool.shutdownNow(); }
/** 等待所有的Spout结束,用在分析单个文件的时候。等待所有日志处理完成。 */ public void waitAllSpoutDone() { while (fileSpout != null && !fileSpout.isClosed()) { synchronized (fileSpout) { try { fileSpout.wait(1000); } catch (InterruptedException e) { } } } for (DataQueue q : topology.getAllDataQueue()) { while (q.status == DataQueue.RUNNING) { synchronized (q) { try { q.wait(1000); } catch (InterruptedException e) { } } } } }