test_class.declarator: log = LoggerFactory.getLogger(AwsRepositoryLockTest.class)
test_class.modifier: private static final
test_class.original_string: private static final Logger log = LoggerFactory.getLogger(AwsRepositoryLockTest.class);
test_class.type: Logger
test_class.var_name: log
test_class.declarator: lockName = "repo.lock"
test_class.modifier: private static final
test_class.original_string: private static final String lockName = "repo.lock";
test_class.type: String
test_class.var_name: lockName
test_class.declarator: dynamoDBClient
test_class.modifier: private
test_class.original_string: private DynamoDBClient dynamoDBClient;
test_class.type: DynamoDBClient
test_class.var_name: dynamoDBClient
test_class.file: oak-segment-aws/src/test/java/org/apache/jackrabbit/oak/segment/aws/AwsRepositoryLockTest.java
test_class.identifier: AwsRepositoryLockTest
test_case.body: @Test
      public void testFailingLock() throws IOException {
          new AwsRepositoryLock(dynamoDBClient, lockName, 0).lock();
          try {
              new AwsRepositoryLock(dynamoDBClient, lockName, 0).lock();
              fail("The second lock should fail.");
          } catch (IOException e) {
              // it's fine
          }
      }
test_case.class_method_signature: AwsRepositoryLockTest.testFailingLock()
test_case.full_signature: @Test public void testFailingLock()
test_case.identifier: testFailingLock
test_case.invocations: lock lock fail
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testFailingLock()
focal_class.declarator: log = LoggerFactory.getLogger(AwsRepositoryLock.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger log = LoggerFactory.getLogger(AwsRepositoryLock.class);
focal_class.type: Logger
focal_class.var_name: log
focal_class.declarator: TIMEOUT_SEC = Integer.getInteger("oak.segment.aws.lock.timeout", 0)
focal_class.modifier: private static final
focal_class.original_string: private static final int TIMEOUT_SEC = Integer.getInteger("oak.segment.aws.lock.timeout", 0);
focal_class.type: int
focal_class.var_name: TIMEOUT_SEC
focal_class.declarator: INTERVAL = 60
focal_class.modifier: private static final
focal_class.original_string: private static final long INTERVAL = 60;
focal_class.type: long
focal_class.var_name: INTERVAL
focal_class.declarator: lockClient
focal_class.modifier: private final
focal_class.original_string: private final AmazonDynamoDBLockClient lockClient;
focal_class.type: AmazonDynamoDBLockClient
focal_class.var_name: lockClient
focal_class.declarator: lockName
focal_class.modifier: private final
focal_class.original_string: private final String lockName;
focal_class.type: String
focal_class.var_name: lockName
focal_class.declarator: timeoutSec
focal_class.modifier: private final
focal_class.original_string: private final long timeoutSec;
focal_class.type: long
focal_class.var_name: timeoutSec
focal_class.declarator: lockItem
focal_class.modifier: private
focal_class.original_string: private LockItem lockItem;
focal_class.type: LockItem
focal_class.var_name: lockItem
focal_class.file: oak-segment-aws/src/main/java/org/apache/jackrabbit/oak/segment/aws/AwsRepositoryLock.java
focal_class.identifier: AwsRepositoryLock
focal_class.interfaces: implements RepositoryLock
focal_class.class_method_signature: AwsRepositoryLock.AwsRepositoryLock(DynamoDBClient dynamoDBClient, String lockName)
focal_class.full_signature: public  AwsRepositoryLock(DynamoDBClient dynamoDBClient, String lockName)
focal_class.identifier: AwsRepositoryLock
focal_class.modifiers: public
focal_class.parameters: (DynamoDBClient dynamoDBClient, String lockName)
focal_class.signature:  AwsRepositoryLock(DynamoDBClient dynamoDBClient, String lockName)
focal_class.class_method_signature: AwsRepositoryLock.AwsRepositoryLock(DynamoDBClient dynamoDBClient, String lockName, int timeoutSec)
focal_class.full_signature: public  AwsRepositoryLock(DynamoDBClient dynamoDBClient, String lockName, int timeoutSec)
focal_class.identifier: AwsRepositoryLock
focal_class.modifiers: public
focal_class.parameters: (DynamoDBClient dynamoDBClient, String lockName, int timeoutSec)
focal_class.signature:  AwsRepositoryLock(DynamoDBClient dynamoDBClient, String lockName, int timeoutSec)
focal_class.class_method_signature: AwsRepositoryLock.lock()
focal_class.full_signature: public AwsRepositoryLock lock()
focal_class.identifier: lock
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: AwsRepositoryLock
focal_class.signature: AwsRepositoryLock lock()
focal_class.class_method_signature: AwsRepositoryLock.unlock()
focal_class.full_signature: @Override public void unlock()
focal_class.identifier: unlock
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void unlock()
focal_method.body: public AwsRepositoryLock lock() throws IOException {
          try {
              Optional<LockItem> lockItemOptional = lockClient.tryAcquireLock(AcquireLockOptions.builder(lockName)
                      .withTimeUnit(TimeUnit.SECONDS).withAdditionalTimeToWaitForLock(timeoutSec)
                      .build());
              if (lockItemOptional.isPresent()) {
                  lockItem = lockItemOptional.get();
                  return this;
              } else {
                  log.error("Can't acquire the lease in {}s.", timeoutSec);
                  throw new IOException("Can't acquire the lease in " + timeoutSec + "s.");
              }
          } catch (InterruptedException e) {
              throw new IOException(e);
          }
      }
focal_method.class_method_signature: AwsRepositoryLock.lock()
focal_method.full_signature: public AwsRepositoryLock lock()
focal_method.identifier: lock
focal_method.invocations: tryAcquireLock build withAdditionalTimeToWaitForLock withTimeUnit builder isPresent get error
focal_method.modifiers: public
focal_method.parameters: ()
focal_method.return: AwsRepositoryLock
focal_method.signature: AwsRepositoryLock lock()