@Override
 public void destroy() throws Exception {
   if (executor instanceof DisposableBean) {
     DisposableBean bean = (DisposableBean) executor;
     bean.destroy();
   }
 }
  /**
   * {@inheritDoc}
   *
   * <p>Cleanup the configuration items.
   */
  public void destroy() {

    synchronized (lock) {
      if (isMulticasterManagedInternally) {
        eventMulticaster.removeAllListeners();
        eventMulticaster = null;
      }

      if (extenderConfiguration != null) {
        extenderConfiguration.close();
        extenderConfiguration = null;
      }

      // postpone the task executor shutdown
      if (forceThreadShutdown) {

        if (isTaskExecutorManagedInternally) {
          log.warn("Forcing the (internally created) taskExecutor to stop...");
          ThreadGroup th = ((SimpleAsyncTaskExecutor) taskExecutor).getThreadGroup();
          if (!th.isDestroyed()) {
            // ask the threads nicely to stop
            th.interrupt();
          }
        }
        taskExecutor = null;
      }

      if (isShutdownTaskExecutorManagedInternally) {
        try {
          ((DisposableBean) shutdownTaskExecutor).destroy();
        } catch (Exception ex) {
          log.debug("Received exception while shutting down shutdown task executor", ex);
        }
        shutdownTaskExecutor = null;
      }
    }
  }
示例#3
0
 @Override
 public void destroy() throws Exception {
   disposableBean.destroy();
 }