private void installMemoryModeListener() {
    IndexStorage<Key, Value> storage = getStorage();
    if (storage instanceof TransientChangesIndexStorage) {
      ((TransientChangesIndexStorage<Key, Value>)storage).addBufferingStateListener(
        new TransientChangesIndexStorage.BufferingStateListener() {
          @Override
          public void bufferingStateChanged(boolean newState) {
            myInMemoryMode.set(newState);
          }

          @Override
          public void memoryStorageCleared() {
            if (FileBasedIndexEx.doTraceStubUpdates(myIndexId)) {
              LOG.info("memoryStorageCleared,index=" + myIndexId);
            }
            myInMemoryKeysAndValues.clear();
          }
        });
    }
  }
private void installMemoryModeListener()