本文整理汇总了Java中com.thinkaurelius.titan.diskstorage.locking.TemporaryLockingException类的典型用法代码示例。如果您正苦于以下问题:Java TemporaryLockingException类的具体用法?Java TemporaryLockingException怎么用?Java TemporaryLockingException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TemporaryLockingException类属于com.thinkaurelius.titan.diskstorage.locking包,在下文中一共展示了TemporaryLockingException类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: tryLocks
import com.thinkaurelius.titan.diskstorage.locking.TemporaryLockingException; //导入依赖的package包/类
private void tryLocks(KeyColumnValueStore s1,
StoreTransaction tx1, KeyColumnValueStore s2,
StoreTransaction tx2, boolean detectLocally) throws BackendException, InterruptedException {
s1.acquireLock(k, k, null, tx1);
// Require local lock contention, if requested by our caller
// Remote lock contention is checked by separate cases
if (detectLocally) {
try {
s2.acquireLock(k, k, null, tx2);
Assert.fail("Expected lock contention between transactions did not occur");
} catch (BackendException e) {
Assert.assertTrue(e instanceof PermanentLockingException || e instanceof TemporaryLockingException);
}
}
// Let the original lock expire
Thread.sleep(EXPIRE_MS + 100L);
// This should succeed now that the original lock is expired
s2.acquireLock(k, k, null, tx2);
// Mutate to check for remote contention
s2.mutate(k, Arrays.<Entry>asList(StaticArrayEntry.of(c2, v2)), NO_DELETIONS, tx2);
}
示例2: run
import com.thinkaurelius.titan.diskstorage.locking.TemporaryLockingException; //导入依赖的package包/类
@Override
public void run() {
// Catch & log exceptions
for (int opIndex = 0; opIndex < opCount; opIndex++) {
StoreTransaction tx = null;
try {
tx = newTransaction(manager);
store.acquireLock(toLock, toLock, null, tx);
store.mutate(toLock, ImmutableList.<Entry>of(), Arrays.asList(toLock), tx);
tx.commit();
succeeded++;
} catch (TemporaryLockingException e) {
temporaryFailures++;
} catch (Throwable t) {
log.error("Unexpected locking-related exception on iteration " + (opIndex + 1) + "/" + opCount, t);
}
}
/*
* This latch is the only thing guaranteeing that succeeded's true
* value is observable by other threads once we're done with run()
* and the latch's await() method returns.
*/
doneLatch.countDown();
}
示例3: writeLock
import com.thinkaurelius.titan.diskstorage.locking.TemporaryLockingException; //导入依赖的package包/类
@Override
public void writeLock(KeyColumn lockID, StoreTransaction tx) throws TemporaryLockingException, PermanentLockingException {
if (errorOnLock)
throw new UnsupportedOperationException("Locking is not supported!");
}
示例4: checkLocks
import com.thinkaurelius.titan.diskstorage.locking.TemporaryLockingException; //导入依赖的package包/类
@Override
public void checkLocks(StoreTransaction tx) throws TemporaryLockingException, PermanentLockingException {
//Do nothing since no locks where written
}
示例5: deleteLocks
import com.thinkaurelius.titan.diskstorage.locking.TemporaryLockingException; //导入依赖的package包/类
@Override
public void deleteLocks(StoreTransaction tx) throws TemporaryLockingException, PermanentLockingException {
//Do nothing since no locks where written
}