test_class.declarator: temporaryFolder = new TemporaryFolder(new File("target"))
test_class.modifier: @Rule
      public
test_class.original_string: @Rule
      public TemporaryFolder temporaryFolder = new TemporaryFolder(new File("target"));
test_class.type: TemporaryFolder
test_class.var_name: temporaryFolder
test_class.file: oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/directory/CopyOnReadDirectoryTest.java
test_class.identifier: CopyOnReadDirectoryTest
test_case.body: @Test
      public void multipleCloseCalls() throws Exception{
          AtomicInteger executionCount = new AtomicInteger();
          Executor e = r -> {executionCount.incrementAndGet(); r.run();};
          IndexCopier c = new IndexCopier(sameThreadExecutor(), temporaryFolder.newFolder(), true);
          Directory dir = new CopyOnReadDirectory(c, new RAMDirectory(), new RAMDirectory(), false, "foo", e);
  
          dir.close();
          dir.close();
          assertEquals(1, executionCount.get());
      }
test_case.class_method_signature: CopyOnReadDirectoryTest.multipleCloseCalls()
test_case.full_signature: @Test public void multipleCloseCalls()
test_case.identifier: multipleCloseCalls
test_case.invocations: incrementAndGet run sameThreadExecutor newFolder close close assertEquals get
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void multipleCloseCalls()
focal_class.declarator: log = LoggerFactory.getLogger(CopyOnReadDirectory.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger log = LoggerFactory.getLogger(CopyOnReadDirectory.class);
focal_class.type: Logger
focal_class.var_name: log
focal_class.declarator: PERF_LOGGER = new PerfLogger(LoggerFactory.getLogger(log.getName() + ".perf"))
focal_class.modifier: private static final
focal_class.original_string: private static final PerfLogger PERF_LOGGER = new PerfLogger(LoggerFactory.getLogger(log.getName() + ".perf"));
focal_class.type: PerfLogger
focal_class.var_name: PERF_LOGGER
focal_class.declarator: DELETE_MARGIN_MILLIS_NAME = "oak.lucene.delete.margin"
focal_class.modifier: public static final
focal_class.original_string: public static final String DELETE_MARGIN_MILLIS_NAME = "oak.lucene.delete.margin";
focal_class.type: String
focal_class.var_name: DELETE_MARGIN_MILLIS_NAME
focal_class.declarator: DELETE_MARGIN_MILLIS = Long.getLong(DELETE_MARGIN_MILLIS_NAME, TimeUnit.MINUTES.toMillis(5))
focal_class.modifier: public final
focal_class.original_string: public final long DELETE_MARGIN_MILLIS = Long.getLong(DELETE_MARGIN_MILLIS_NAME, TimeUnit.MINUTES.toMillis(5));
focal_class.type: long
focal_class.var_name: DELETE_MARGIN_MILLIS
focal_class.declarator: indexCopier
focal_class.modifier: private final
focal_class.original_string: private final IndexCopier indexCopier;
focal_class.type: IndexCopier
focal_class.var_name: indexCopier
focal_class.declarator: remote
focal_class.modifier: private final
focal_class.original_string: private final Directory remote;
focal_class.type: Directory
focal_class.var_name: remote
focal_class.declarator: local
focal_class.modifier: private final
focal_class.original_string: private final Directory local;
focal_class.type: Directory
focal_class.var_name: local
focal_class.declarator: prefetch
focal_class.modifier: private final
focal_class.original_string: private final boolean prefetch;
focal_class.type: boolean
focal_class.var_name: prefetch
focal_class.declarator: indexPath
focal_class.modifier: private final
focal_class.original_string: private final String indexPath;
focal_class.type: String
focal_class.var_name: indexPath
focal_class.declarator: executor
focal_class.modifier: private final
focal_class.original_string: private final Executor executor;
focal_class.type: Executor
focal_class.var_name: executor
focal_class.declarator: closed = new AtomicBoolean()
focal_class.modifier: private final
focal_class.original_string: private final AtomicBoolean closed = new AtomicBoolean();
focal_class.type: AtomicBoolean
focal_class.var_name: closed
focal_class.declarator: WAIT_OTHER_COPY_SYSPROP_NAME = "cor.waitCopyMillis"
focal_class.modifier: static final
focal_class.original_string: static final String WAIT_OTHER_COPY_SYSPROP_NAME = "cor.waitCopyMillis";
focal_class.type: String
focal_class.var_name: WAIT_OTHER_COPY_SYSPROP_NAME
focal_class.declarator: waitOtherCopyTimeoutMillis = Long.getLong(WAIT_OTHER_COPY_SYSPROP_NAME, TimeUnit.SECONDS.toMillis(30))
focal_class.original_string: long waitOtherCopyTimeoutMillis = Long.getLong(WAIT_OTHER_COPY_SYSPROP_NAME, TimeUnit.SECONDS.toMillis(30));
focal_class.type: long
focal_class.var_name: waitOtherCopyTimeoutMillis
focal_class.declarator: files = newConcurrentMap()
focal_class.modifier: private final
focal_class.original_string: private final ConcurrentMap<String, CORFileReference> files = newConcurrentMap();
focal_class.type: ConcurrentMap<String, CORFileReference>
focal_class.var_name: files
focal_class.file: oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/directory/CopyOnReadDirectory.java
focal_class.identifier: CopyOnReadDirectory
focal_class.class_method_signature: CopyOnReadDirectory.CopyOnReadDirectory(IndexCopier indexCopier, Directory remote, Directory local, boolean prefetch,
                                 String indexPath, Executor executor)
focal_class.full_signature: public  CopyOnReadDirectory(IndexCopier indexCopier, Directory remote, Directory local, boolean prefetch,
                                 String indexPath, Executor executor)
focal_class.identifier: CopyOnReadDirectory
focal_class.modifiers: public
focal_class.parameters: (IndexCopier indexCopier, Directory remote, Directory local, boolean prefetch,
                                 String indexPath, Executor executor)
focal_class.signature:  CopyOnReadDirectory(IndexCopier indexCopier, Directory remote, Directory local, boolean prefetch,
                                 String indexPath, Executor executor)
focal_class.class_method_signature: CopyOnReadDirectory.deleteFile(String name)
focal_class.full_signature: @Override public void deleteFile(String name)
focal_class.identifier: deleteFile
focal_class.modifiers: @Override public
focal_class.parameters: (String name)
focal_class.return: void
focal_class.signature: void deleteFile(String name)
focal_class.class_method_signature: CopyOnReadDirectory.createOutput(String name, IOContext context)
focal_class.full_signature: @Override public IndexOutput createOutput(String name, IOContext context)
focal_class.identifier: createOutput
focal_class.modifiers: @Override public
focal_class.parameters: (String name, IOContext context)
focal_class.return: IndexOutput
focal_class.signature: IndexOutput createOutput(String name, IOContext context)
focal_class.class_method_signature: CopyOnReadDirectory.openInput(String name, IOContext context)
focal_class.full_signature: @Override public IndexInput openInput(String name, IOContext context)
focal_class.identifier: openInput
focal_class.modifiers: @Override public
focal_class.parameters: (String name, IOContext context)
focal_class.return: IndexInput
focal_class.signature: IndexInput openInput(String name, IOContext context)
focal_class.class_method_signature: CopyOnReadDirectory.getLocal()
focal_class.full_signature: public Directory getLocal()
focal_class.identifier: getLocal
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: Directory
focal_class.signature: Directory getLocal()
focal_class.class_method_signature: CopyOnReadDirectory.copy(final CORFileReference reference)
focal_class.full_signature: private void copy(final CORFileReference reference)
focal_class.identifier: copy
focal_class.modifiers: private
focal_class.parameters: (final CORFileReference reference)
focal_class.return: void
focal_class.signature: void copy(final CORFileReference reference)
focal_class.class_method_signature: CopyOnReadDirectory.prefetchIndexFiles()
focal_class.full_signature: private void prefetchIndexFiles()
focal_class.identifier: prefetchIndexFiles
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void prefetchIndexFiles()
focal_class.class_method_signature: CopyOnReadDirectory.copyFilesToLocal(CORFileReference reference, boolean sync, boolean logDuration)
focal_class.full_signature: private long copyFilesToLocal(CORFileReference reference, boolean sync, boolean logDuration)
focal_class.identifier: copyFilesToLocal
focal_class.modifiers: private
focal_class.parameters: (CORFileReference reference, boolean sync, boolean logDuration)
focal_class.return: long
focal_class.signature: long copyFilesToLocal(CORFileReference reference, boolean sync, boolean logDuration)
focal_class.class_method_signature: CopyOnReadDirectory.close()
focal_class.full_signature: @Override public void close()
focal_class.identifier: close
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void close()
focal_class.class_method_signature: CopyOnReadDirectory.toString()
focal_class.full_signature: @Override public String toString()
focal_class.identifier: toString
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String toString()
focal_class.class_method_signature: CopyOnReadDirectory.removeDeletedFiles()
focal_class.full_signature: private void removeDeletedFiles()
focal_class.identifier: removeDeletedFiles
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void removeDeletedFiles()
focal_class.class_method_signature: CopyOnReadDirectory.logRemoteAccess(String format, Object o1, Object o2)
focal_class.full_signature: private void logRemoteAccess(String format, Object o1, Object o2)
focal_class.identifier: logRemoteAccess
focal_class.modifiers: private
focal_class.parameters: (String format, Object o1, Object o2)
focal_class.return: void
focal_class.signature: void logRemoteAccess(String format, Object o1, Object o2)
focal_class.superclass: extends FilterDirectory
focal_method.body: @Override
      public void close() throws IOException {
          if (!closed.compareAndSet(false, true)){
              return;
          }
          //Always remove old index file on close as it ensures that
          //no other IndexSearcher are opened with previous revision of Index due to
          //way IndexTracker closes LuceneIndexNode. At max there would be only two LuceneIndexNode
          //opened pinned to different revision of same Lucene index
          executor.execute(new Runnable() {
              @Override
              public void run() {
                  try{
                      removeDeletedFiles();
                  } catch (IOException e) {
                      log.warn(
                              "[{}] Error occurred while removing deleted files from Local {}, Remote {}",
                              indexPath, local, remote, e);
                  }
  
                  try {
                      //This would also remove old index files if current
                      //directory was based on newerRevision as local would
                      //be of type DeleteOldDirOnClose
                      local.close();
                      remote.close();
                  } catch (IOException e) {
                      log.warn(
                              "[{}] Error occurred while closing directory ",
                              indexPath, e);
                  }
              }
          });
      }
focal_method.class_method_signature: CopyOnReadDirectory.close()
focal_method.full_signature: @Override public void close()
focal_method.identifier: close
focal_method.invocations: compareAndSet execute removeDeletedFiles warn close close warn
focal_method.modifiers: @Override public
focal_method.parameters: ()
focal_method.return: void
focal_method.signature: void close()