docs: @Override
      public final synchronized void destroy() {
          final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
          if (isTraceOn && tc.isEntryEnabled()) // d144064
              Tr.entry(tc, "destroy - bean=" + this.toString()); // d161864
  
          if (state == DESTROYED) {
              if (isTraceOn && tc.isEntryEnabled())
                  Tr.exit(tc, "destroy");
              return;
          }
  
          if (ivSfFailoverClient != null) //LIDB2018-1
          {
              ivSfFailoverClient.removeEntry(beanId); //LIDB2018-1
          }
  
          if (isZOS) {
              removeServantRoutingAffinity(); // d646413.2
          }
          setState(DESTROYED);
  
          if (pmiBean != null) {
              pmiBean.beanDestroyed();
          }
  
          String lifeCycle = null; // d367572.4
          CallbackContextHelper contextHelper = null; // d399469, d630940
          try {
              // If the bean has already been removed, or failed to activate, then
              // there is nothing to invoke callbacks on... exit now.         d681978
              if (removed || ivEjbInstance == null) {
                  if (isTraceOn && tc.isDebugEnabled())
                      Tr.debug(tc, "destroy : already removed or failed to activate");
              } else {
                  if (ivCallbackKind != CallbackKind.None) {
                      BeanMetaData bmd = home.beanMetaData;
                      contextHelper = new CallbackContextHelper(this); // d399469, d630940
                      beginLifecycleCallback(LifecycleInterceptorWrapper.MID_PRE_DESTROY,
                                             contextHelper, CallbackContextHelper.Contexts.All);
                      destroying = true;
  
                      // d367572.1 start
                      // Invoke the PreDestroy callback if any needs to be called.
                      if (ivCallbackKind == CallbackKind.SessionBean) {
                          if (isTraceOn && // d527372
                              TEBeanLifeCycleInfo.isTraceEnabled()) // d367572.4
                          {
                              lifeCycle = "ejbRemove";
                              TEBeanLifeCycleInfo.traceEJBCallEntry(lifeCycle); // d161864
                          }
                          sessionBean.ejbRemove();
                      } else if (ivCallbackKind == CallbackKind.InvocationContext) {
                          // Invoke the PreDestroy interceptor methods.
                          InterceptorMetaData imd = home.beanMetaData.ivInterceptorMetaData;
                          InterceptorProxy[] proxies = imd.ivPreDestroyInterceptors;
                          if (proxies != null) {
                              if (isTraceOn && // d527372
                                  TEBeanLifeCycleInfo.isTraceEnabled()) // d367572.4
                              {
                                  lifeCycle = "PreDestroy";
                                  TEBeanLifeCycleInfo.traceEJBCallEntry(lifeCycle);
                              }
                              InvocationContextImpl<?> inv = getInvocationContext();
                              inv.doLifeCycle(proxies, bmd._moduleMetaData); //d450431, F743-14982
                          }
                      } // d367572.1 end
                  }
  
                  if (pmiBean != null) {
                      pmiBean.beanRemoved();
                  }
              }
          } catch (Exception ex) {
              FFDCFilter.processException(ex, CLASS_NAME + ".destroy", "176", this);
  
              // Just trace this event and continue so that BeanO is transitioned
              // to the DESTROYED state.  No other lifecycle callbacks on this bean
              // instance will occur once in the DESTROYED state, which is the same
              // affect as if bean was discarded as result of this exception.
              if (isTraceOn && tc.isEventEnabled()) // d144064
              {
                  Tr.event(tc, "destroy caught exception:", new Object[] { this, ex }); // d367572.4 // d402681
              }
          } finally {
              if (isTraceOn && // d527372
                  TEBeanLifeCycleInfo.isTraceEnabled()) {
                  if (lifeCycle != null) // d367572.4
                  {
                      TEBeanLifeCycleInfo.traceEJBCallExit(lifeCycle);
                  }
              }
  
              if (contextHelper != null) {
                  try {
                      contextHelper.complete(true);
                  } catch (Throwable t) {
                      FFDCFilter.processException(t, CLASS_NAME + ".destroy", "585", this);
  
                      // Just trace this event and continue so that BeanO is transitioned
                      // to the DESTROYED state.  No other lifecycle callbacks on this bean
                      // instance will occur once in the DESTROYED state, which is the same
                      // affect as if bean was discarded as result of this exception.
                      if (isTraceOn && tc.isEventEnabled()) {
                          Tr.event(tc, "destroy caught exception: ", new Object[] { this, t });
                      }
                  }
              }
  
              destroying = false;
  
              disconnectWrapper(); // F61004.6
              destroyHandleList();
  
              // Release any JCDI creational contexts that may exist.      F743-29174
              releaseManagedObjectContext();
  
              if (isTraceOn && tc.isEntryEnabled())
                  Tr.exit(tc, "destroy");
          }
      }