Exemplo n.º 1
0
 private KeyColumnValueStore getLockStore(KeyColumnValueStore store) throws StorageException {
   if (!storeFeatures.supportsLocking()) {
     if (storeFeatures.isTransactional()) {
       store = new TransactionalLockStore(store);
     } else if (storeFeatures.supportsConsistentKeyOperations()) {
       store =
           new ConsistentKeyLockStore(
               store, getStore(store.getName() + LOCK_STORE_SUFFIX), lockConfiguration);
     } else throw new IllegalArgumentException("Store needs to support some form of locking");
   }
   return store;
 }
Exemplo n.º 2
0
 private KeyColumnValueStore getLockStore(KeyColumnValueStore store, boolean lockEnabled)
     throws StorageException {
   if (!storeFeatures.supportsLocking()) {
     if (storeFeatures.supportsTransactions()) {
       store = new TransactionalLockStore(store);
     } else if (storeFeatures.supportsConsistentKeyOperations()) {
       if (lockEnabled) {
         final String lockerName = store.getName() + LOCK_STORE_SUFFIX;
         store = new ExpectedValueCheckingStore(store, getLocker(lockerName));
       } else {
         store = new ExpectedValueCheckingStore(store, null);
       }
     } else throw new IllegalArgumentException("Store needs to support some form of locking");
   }
   return store;
 }