예제 #1
0
 @Override
 public void fireLifecycle(String phase) throws LifecycleException {
   // Implicitly call stop if necessary when disposing
   if (Disposable.PHASE_NAME.equals(phase) && lifecycleManager.getState().isStarted()) {
     getLifecycleManager().fireLifecycle(Stoppable.PHASE_NAME);
   }
   getLifecycleManager().fireLifecycle(phase);
 }
예제 #2
0
  @Override
  public final synchronized void dispose() {
    if (lifecycleManager.getState().isStarted()) {
      try {
        getLifecycleManager().fireLifecycle(Stoppable.PHASE_NAME);
      } catch (LifecycleException e) {
        logger.error("Failed to shut down registry cleanly: " + getRegistryId(), e);
      }
    }
    // Fire dispose lifecycle before calling doDispose() that that registries can clear any object
    // caches once all objects
    // are disposed
    try {
      getLifecycleManager().fireLifecycle(Disposable.PHASE_NAME);
    } catch (LifecycleException e) {
      logger.error("Failed to shut down registry cleanly: " + getRegistryId(), e);
    }

    try {
      doDispose();
    } catch (Exception e) {
      logger.error("Failed to cleanly dispose: " + e.getMessage(), e);
    }
  }