protected void lockedStart() throws Exception {
    super.lockedStart();
    this.registerWithAopDispatcher();

    // Obtain registrar
    JndiSessionRegistrarBase registrar = this.getJndiRegistrar();

    // Bind all appropriate references/factories to Global JNDI for Client access, if a JNDI
    // Registrar is present
    if (registrar != null) {
      String guid = Ejb3Registry.guid(this);
      registrar.bindEjb(
          this.getInitialContext(),
          this.getMetaData(),
          this.getClassloader(),
          this.getObjectName().getCanonicalName(),
          guid,
          this.getAdvisor());
    } else {
      log.warn(
          "No "
              + JndiSessionRegistrarBase.class.getSimpleName()
              + " was found; byassing binding of Proxies to "
              + this.getName()
              + " in Global JNDI.");
    }
  }
  protected void lockedStop() throws Exception {

    try {
      Dispatcher.singleton.unregisterTarget(getObjectName().getCanonicalName());
    } catch (Exception ignore) {
      log.debug("Dispatcher unregister target failed", ignore);
    }

    // Deregister with Remoting
    Dispatcher.singleton.unregisterTarget(this.getName());

    // Unbind applicable JNDI Entries
    JndiSessionRegistrarBase jndiRegistrar = this.getJndiRegistrar();
    if (jndiRegistrar != null) {
      jndiRegistrar.unbindEjb(this.getInitialContext(), this.getMetaData());
    }

    super.lockedStop();
  }