Package com.splunk.shuttl.archiver.bucketlock

Examples of com.splunk.shuttl.archiver.bucketlock.BucketLock


   * com.splunk.shuttl.archiver.bucketlock.BucketLocker#getLockForBucket(com
   * .splunk.shuttl.archiver.model.Bucket)
   */
  @Override
  public BucketLock getLockForBucket(Bucket bucket) {
    return new BucketLock(bucket,
        localFileSystemPaths.getThawLocksDirectory(bucket));
  }
View Full Code Here


    return bucketFactory.createWithIndexDirectoryAndFormat(index,
        new File(path), BucketFormat.SPLUNK_BUCKET);
  }

  private List<BucketLock> createBucketLocks(LocalBucket bucket) {
    BucketLock bucketLock = bucketLocker.getLockForBucket(bucket);
    if (!bucketLock.tryLockShared())
      throw new IllegalStateException("We must ensure that the"
          + " bucket archiver has a " + "lock to the bucket it will transfer");

    BucketLock transferLock = new BucketTransferLocker(
        LocalFileSystemPaths.create()).getLockForBucket(bucket);
    if (!transferLock.tryLockExclusive())
      throw new RuntimeException("Could not transfer bucket: " + bucket
          + ", because transfer lock was not accquired");

    return asList(bucketLock, transferLock);
  }
View Full Code Here

    this.fileSystemPaths = fileSystemPaths;
  }

  @Override
  public BucketLock getLockForBucket(Bucket bucket) {
    return new BucketLock(bucket,
        fileSystemPaths.getTransferLocksDirectory(bucket));
  }
View Full Code Here

    this.fileSystemPaths = fileSystemPaths;
  }

  @Override
  public BucketLock getLockForBucket(Bucket bucket) {
    return new BucketLock(bucket, fileSystemPaths.getCopyLocksDirectory(bucket));
  }
View Full Code Here

    assertEquals(bucket, bucketThawer.getFailedBuckets().get(0).bucket);
    verifyZeroInteractions(getsBucketsFromArchive);
  }

  public void thawBuckets_bucketIsAlreadyLocked_doesNotThaw() {
    BucketLock bucketLock = thawBucketLocker.getLockForBucket(bucket);
    assertTrue(bucketLock.tryLockExclusive());
    when(
        listsBucketsFiltered.listFilteredBucketsAtIndex(index, earliestTime,
            latestTime)).thenReturn(asList(bucket));

    bucketThawer.thawBuckets(index, earliestTime, latestTime);
View Full Code Here

        asList(bucketLock));
  }

  @Test(expectedExceptions = { NotLockedException.class })
  public void constructor_bucketLockIsNotLocked_throwNotLockedException() {
    BucketLock bucketLock = mock(BucketLock.class);
    when(bucketLock.isLocked()).thenReturn(false);
    new BucketShuttlerRunner(bucketShuttler, bucket, asList(bucketLock));
  }
View Full Code Here

    bucketMover = IndexPreservingBucketMover.create(safeBucketDirectory);
    bucketLocker = new BucketLocker() {

      @Override
      public BucketLock getLockForBucket(Bucket bucket) {
        return new BucketLock(bucket, createDirectory());
      }
    };
    FailedBucketsArchiver failedBucketsArchiver = new FailedBucketsArchiver(
        bucketMover, bucketLocker);
View Full Code Here

  public void getLockForBucket_givenThawLocksDirectory_lockIsInThatDirectory() {
    Bucket bucket = TUtilsBucket.createBucket();
    File thawLocksDirectory = localFileSystemPaths
        .getThawLocksDirectory(bucket);
    BucketLock lockForBucket = thawBucketLocker.getLockForBucket(bucket);
    assertEquals(thawLocksDirectory.getAbsolutePath(), lockForBucket
        .getLockFile().getParentFile().getAbsolutePath());
  }
View Full Code Here

TOP

Related Classes of com.splunk.shuttl.archiver.bucketlock.BucketLock

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.