@Override public void destroy(){
  UiThreadUtil.assertOnUiThread();
  if (mDestroyed) {
    return;
  }
  mDestroyed=true;
  mHybridData.resetNative();
  mJavaRegistry.notifyCatalystInstanceDestroy();
  boolean wasIdle=(mPendingJSCalls.getAndSet(0) == 0);
  if (!wasIdle && !mBridgeIdleListeners.isEmpty()) {
    for (    NotThreadSafeBridgeIdleDebugListener listener : mBridgeIdleListeners) {
      listener.onTransitionToBridgeIdle();
    }
  }
  Systrace.unregisterListener(mTraceListener);
}

@ Override public void destroy ( ) { UiThreadUtil . assertOnUiThread ( ) ; if ( mDestroyed ) { return ; } mDestroyed = true ; mHybridData . resetNative ( ) ; mJavaRegistry . notifyCatalystInstanceDestroy ( ) ; boolean wasIdle = ( mPendingJSCalls . getAndSet ( 0 ) == 0 ) ; if ( ! wasIdle && ! mBridgeIdleListeners . isEmpty ( ) ) { for ( NotThreadSafeBridgeIdleDebugListener listener : mBridgeIdleListeners ) { listener . onTransitionToBridgeIdle ( ) ; } } Systrace . unregisterListener ( mTraceListener ) ; }
destroys this catalyst instance , waiting for any other threads in reactqueueconfiguration ( besides the ui thread ) to finish running . must be called from the ui thread so that we can fully shut down other threads .
