test_class.declarator: store
test_class.modifier: private
test_class.original_string: private FileStore store;
test_class.type: FileStore
test_class.var_name: store
test_class.declarator: revisions
test_class.modifier: private
test_class.original_string: private TarRevisions revisions;
test_class.type: TarRevisions
test_class.var_name: revisions
test_class.declarator: reader
test_class.modifier: private
test_class.original_string: private SegmentReader reader;
test_class.type: SegmentReader
test_class.var_name: reader
test_class.declarator: folder = new TemporaryFolder(new File("target"))
test_class.modifier: @Rule
      public
test_class.original_string: @Rule
      public TemporaryFolder folder = new TemporaryFolder(new File("target"));
test_class.type: TemporaryFolder
test_class.var_name: folder
test_class.file: oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/TarRevisionsTest.java
test_class.identifier: TarRevisionsTest
test_case.body: @Test
      public void setFromFunctionBlocks()
      throws ExecutionException, InterruptedException, TimeoutException {
          ListeningExecutorService executor = listeningDecorator(newFixedThreadPool(2));
          try {
              final CountDownLatch latch = new CountDownLatch(1);
  
              ListenableFuture<Boolean> t1 = executor.submit(new Callable<Boolean>() {
                  @Override
                  public Boolean call() throws Exception {
                      latch.await();
                      return null != revisions.setHead(Functions.<RecordId>identity());
                  }
              });
  
              try {
                  t1.get(500, MILLISECONDS);
                  fail("SetHead from function should block");
              } catch (TimeoutException expected) {}
  
              ListenableFuture<Boolean> t2 = executor.submit(new Callable<Boolean>() {
                  @Override
                  public Boolean call() throws Exception {
                      latch.countDown();
                      return null != revisions.setHead(Functions.<RecordId>identity());
                  }
              });
  
              assertTrue(t2.get(500, MILLISECONDS));
              assertTrue(t1.get(500, MILLISECONDS));
          } finally {
              executor.shutdown();
          }
      }
test_case.class_method_signature: TarRevisionsTest.setFromFunctionBlocks()
test_case.full_signature: @Test public void setFromFunctionBlocks()
test_case.identifier: setFromFunctionBlocks
test_case.invocations: listeningDecorator newFixedThreadPool submit await setHead identity get fail submit countDown setHead identity assertTrue get assertTrue get shutdown
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void setFromFunctionBlocks()
focal_class.declarator: LOG = LoggerFactory.getLogger(TarRevisions.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOG = LoggerFactory.getLogger(TarRevisions.class);
focal_class.type: Logger
focal_class.var_name: LOG
focal_class.declarator: journalFileLock = new ReentrantLock()
focal_class.modifier: private final
focal_class.original_string: private final Lock journalFileLock = new ReentrantLock();
focal_class.type: Lock
focal_class.var_name: journalFileLock
focal_class.declarator: head
focal_class.modifier: @NotNull
      private final
focal_class.original_string: @NotNull
      private final AtomicReference<RecordId> head;
focal_class.type: AtomicReference<RecordId>
focal_class.var_name: head
focal_class.declarator: persistence
focal_class.modifier: private final
focal_class.original_string: private final SegmentNodeStorePersistence persistence;
focal_class.type: SegmentNodeStorePersistence
focal_class.var_name: persistence
focal_class.declarator: journalFile
focal_class.modifier: private final
focal_class.original_string: private final JournalFile journalFile;
focal_class.type: JournalFile
focal_class.var_name: journalFile
focal_class.declarator: journalFileWriter
focal_class.modifier: private volatile
focal_class.original_string: private volatile JournalFileWriter journalFileWriter;
focal_class.type: JournalFileWriter
focal_class.var_name: journalFileWriter
focal_class.declarator: persistedHead
focal_class.modifier: @NotNull
      private final
focal_class.original_string: @NotNull
      private final AtomicReference<RecordId> persistedHead;
focal_class.type: AtomicReference<RecordId>
focal_class.var_name: persistedHead
focal_class.declarator: rwLock = new ReentrantReadWriteLock(true)
focal_class.modifier: @NotNull
      private final
focal_class.original_string: @NotNull
      private final ReadWriteLock rwLock = new ReentrantReadWriteLock(true);
focal_class.type: ReadWriteLock
focal_class.var_name: rwLock
focal_class.declarator: EXPEDITE_OPTION = new Option() {
          @Override
          public String toString() {
              return "Expedite Option";
          }
      }
focal_class.modifier: public static final
focal_class.original_string: public static final Option EXPEDITE_OPTION = new Option() {
          @Override
          public String toString() {
              return "Expedite Option";
          }
      };
focal_class.type: Option
focal_class.var_name: EXPEDITE_OPTION
focal_class.declarator: INFINITY = new TimeOutOption(MAX_VALUE, DAYS)
focal_class.modifier: public static final
focal_class.original_string: public static final Option INFINITY = new TimeOutOption(MAX_VALUE, DAYS);
focal_class.type: Option
focal_class.var_name: INFINITY
focal_class.file: oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/TarRevisions.java
focal_class.identifier: TarRevisions
focal_class.interfaces: implements Revisions, Closeable
focal_class.class_method_signature: TarRevisions.timeout(long time, TimeUnit unit)
focal_class.full_signature: public static Option timeout(long time, TimeUnit unit)
focal_class.identifier: timeout
focal_class.modifiers: public static
focal_class.parameters: (long time, TimeUnit unit)
focal_class.return: Option
focal_class.signature: Option timeout(long time, TimeUnit unit)
focal_class.class_method_signature: TarRevisions.TarRevisions(SegmentNodeStorePersistence persistence)
focal_class.full_signature: public  TarRevisions(SegmentNodeStorePersistence persistence)
focal_class.identifier: TarRevisions
focal_class.modifiers: public
focal_class.parameters: (SegmentNodeStorePersistence persistence)
focal_class.signature:  TarRevisions(SegmentNodeStorePersistence persistence)
focal_class.class_method_signature: TarRevisions.bind(@NotNull SegmentStore store,
                             @NotNull SegmentIdProvider idProvider,
                             @NotNull Supplier<RecordId> writeInitialNode)
focal_class.full_signature: synchronized void bind(@NotNull SegmentStore store,
                             @NotNull SegmentIdProvider idProvider,
                             @NotNull Supplier<RecordId> writeInitialNode)
focal_class.identifier: bind
focal_class.modifiers: synchronized
focal_class.parameters: (@NotNull SegmentStore store,
                             @NotNull SegmentIdProvider idProvider,
                             @NotNull Supplier<RecordId> writeInitialNode)
focal_class.return: void
focal_class.signature: void bind(@NotNull SegmentStore store,
                             @NotNull SegmentIdProvider idProvider,
                             @NotNull Supplier<RecordId> writeInitialNode)
focal_class.class_method_signature: TarRevisions.checkBound()
focal_class.full_signature: private void checkBound()
focal_class.identifier: checkBound
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void checkBound()
focal_class.class_method_signature: TarRevisions.flush(Flusher flusher)
focal_class.full_signature:  void flush(Flusher flusher)
focal_class.identifier: flush
focal_class.parameters: (Flusher flusher)
focal_class.return: void
focal_class.signature: void flush(Flusher flusher)
focal_class.class_method_signature: TarRevisions.tryFlush(Flusher flusher)
focal_class.full_signature:  void tryFlush(Flusher flusher)
focal_class.identifier: tryFlush
focal_class.parameters: (Flusher flusher)
focal_class.return: void
focal_class.signature: void tryFlush(Flusher flusher)
focal_class.class_method_signature: TarRevisions.doFlush(Flusher flusher)
focal_class.full_signature: private void doFlush(Flusher flusher)
focal_class.identifier: doFlush
focal_class.modifiers: private
focal_class.parameters: (Flusher flusher)
focal_class.return: void
focal_class.signature: void doFlush(Flusher flusher)
focal_class.class_method_signature: TarRevisions.getHead()
focal_class.full_signature: @NotNull @Override public RecordId getHead()
focal_class.identifier: getHead
focal_class.modifiers: @NotNull @Override public
focal_class.parameters: ()
focal_class.return: RecordId
focal_class.signature: RecordId getHead()
focal_class.class_method_signature: TarRevisions.getPersistedHead()
focal_class.full_signature: @NotNull @Override public RecordId getPersistedHead()
focal_class.identifier: getPersistedHead
focal_class.modifiers: @NotNull @Override public
focal_class.parameters: ()
focal_class.return: RecordId
focal_class.signature: RecordId getPersistedHead()
focal_class.class_method_signature: TarRevisions.setHead(
              @NotNull RecordId expected,
              @NotNull RecordId head,
              @NotNull Option... options)
focal_class.full_signature: @Override public boolean setHead(
              @NotNull RecordId expected,
              @NotNull RecordId head,
              @NotNull Option... options)
focal_class.identifier: setHead
focal_class.modifiers: @Override public
focal_class.parameters: (
              @NotNull RecordId expected,
              @NotNull RecordId head,
              @NotNull Option... options)
focal_class.return: boolean
focal_class.signature: boolean setHead(
              @NotNull RecordId expected,
              @NotNull RecordId head,
              @NotNull Option... options)
focal_class.class_method_signature: TarRevisions.setHead(
              @NotNull Function<RecordId, RecordId> newHead,
              @NotNull Option... options)
focal_class.full_signature: @Override public RecordId setHead(
              @NotNull Function<RecordId, RecordId> newHead,
              @NotNull Option... options)
focal_class.identifier: setHead
focal_class.modifiers: @Override public
focal_class.parameters: (
              @NotNull Function<RecordId, RecordId> newHead,
              @NotNull Option... options)
focal_class.return: RecordId
focal_class.signature: RecordId setHead(
              @NotNull Function<RecordId, RecordId> newHead,
              @NotNull Option... options)
focal_class.class_method_signature: TarRevisions.isExpedited(Option[] options)
focal_class.full_signature: private static boolean isExpedited(Option[] options)
focal_class.identifier: isExpedited
focal_class.modifiers: private static
focal_class.parameters: (Option[] options)
focal_class.return: boolean
focal_class.signature: boolean isExpedited(Option[] options)
focal_class.class_method_signature: TarRevisions.getTimeout(@NotNull Option[] options)
focal_class.full_signature: @NotNull private static TimeOutOption getTimeout(@NotNull Option[] options)
focal_class.identifier: getTimeout
focal_class.modifiers: @NotNull private static
focal_class.parameters: (@NotNull Option[] options)
focal_class.return: TimeOutOption
focal_class.signature: TimeOutOption getTimeout(@NotNull Option[] options)
focal_class.class_method_signature: TarRevisions.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_method.body: @Override
      public boolean setHead(
              @NotNull RecordId expected,
              @NotNull RecordId head,
              @NotNull Option... options) {
          checkBound();
  
          // If the expedite option was specified we acquire the write lock instead of the read lock.
          // This will cause this thread to get the lock before all threads currently waiting to
          // enter the read lock. See also the class comment of ReadWriteLock.
          Lock lock = isExpedited(options)
              ? rwLock.writeLock()
              : rwLock.readLock();
          lock.lock();
          try {
              RecordId id = this.head.get();
              return id.equals(expected) && this.head.compareAndSet(id, head);
          } finally {
              lock.unlock();
          }
      }
focal_method.class_method_signature: TarRevisions.setHead(
              @NotNull RecordId expected,
              @NotNull RecordId head,
              @NotNull Option... options)
focal_method.full_signature: @Override public boolean setHead(
              @NotNull RecordId expected,
              @NotNull RecordId head,
              @NotNull Option... options)
focal_method.identifier: setHead
focal_method.invocations: checkBound isExpedited writeLock readLock lock get equals compareAndSet unlock
focal_method.modifiers: @Override public
focal_method.parameters: (
              @NotNull RecordId expected,
              @NotNull RecordId head,
              @NotNull Option... options)
focal_method.return: boolean
focal_method.signature: boolean setHead(
              @NotNull RecordId expected,
              @NotNull RecordId head,
              @NotNull Option... options)