@Override
  public void dispose() {
    getThreadingSupport().removeReadActionListener(this);
    getThreadingSupport().removeWriteActionListener(this);

    //noinspection deprecation
    myDispatcher.getMulticaster().applicationExiting();

    IComponentStore componentStore = getServiceIfCreated(IComponentStore.class);
    super.dispose();
    if (componentStore != null) {
      try {
        componentStore.release();
      }
      catch (Exception e) {
        getLogger().error(e);
      }
    }

    // Remove IW lock from EDT as EDT might be re-created, which might lead to deadlock if anybody uses this disposed app
    if (!StartupUtil.isImplicitReadOnEDTDisabled() || isUnitTestMode()) {
      invokeLater(() -> releaseWriteIntentLock(), ModalityState.nonModal());
    }

    // FileBasedIndexImpl can schedule some more activities to execute, so, shutdown executor only after service disposing
    AppExecutorUtil.shutdownApplicationScheduledExecutorService();

    if (myLastDisposable == null) {
      ApplicationManager.setApplication(null);
    }
    else {
      Disposer.dispose(myLastDisposable);
    }

    otelMonitor.get().close();
  }
@Override
  public void dispose()