Exemplo n.º 1
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;
 }