Пример #1
0
  public void terminate() {
    if (_statsThread != null) {
      synchronized (_statsThread) {
        // Somebody might have cleared the thread
        if ((_statsThread != null) && _statsThread.isAlive()) {
          _statsThread.interrupt();
          _statsThread = null;
        }
      }
    }

    // Now terminate all of the running flows.
    synchronized (_flowFutures) {
      Iterator<FlowFuture> iter = _flowFutures.iterator();
      while (iter.hasNext()) {
        FlowFuture ff = iter.next();
        if (ff.isDone()) {
          iter.remove();
        } else {
          ff.cancel(true);
        }
      }
    }
  }