示例#1
0
  public final synchronized void dispose() {
    // TODO lifecycleManager.checkPhase(Disposable.PHASE_NAME);

    if (isDisposed()) {
      return;
    }

    try {
      doDispose();
      lifecycleManager.firePhase(getManagementContext(), Disposable.PHASE_NAME);
      if (getParent() != null) {
        parent.dispose();
      } else {
        // remove this referenceonce there is no one else left to dispose
        RegistryContext.setRegistry(null);
      }
    } catch (UMOException e) {
      // TO-DO
      logger.error("Failed to cleanly dispose: " + e.getMessage(), e);
    }
  }
示例#2
0
  public final void initialise() throws InitialisationException {
    lifecycleManager.checkPhase(Initialisable.PHASE_NAME);

    if (getParent() != null) {
      parent.initialise();
    }

    fireSystemEvent(new RegistryNotification(this, RegistryNotification.REGISTRY_INITIALISING));
    if (id == null) {
      logger.warn("No unique id has been set on this registry");
      id = UUID.getUUID();
    }
    try {
      doInitialise();
      lifecycleManager.firePhase(getManagementContext(), Initialisable.PHASE_NAME);
    } catch (InitialisationException e) {
      throw e;
    } catch (Exception e) {
      throw new InitialisationException(e, this);
    }
  }