本文整理匯總了Java中com.redhat.lightblue.extensions.synch.Locking類的典型用法代碼示例。如果您正苦於以下問題:Java Locking類的具體用法?Java Locking怎麽用?Java Locking使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Locking類屬於com.redhat.lightblue.extensions.synch包,在下文中一共展示了Locking類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getLockingInstance
import com.redhat.lightblue.extensions.synch.Locking; //導入依賴的package包/類
@Override
public Locking getLockingInstance(String domain) {
ObjectNode domainNode = findDomainNode(domain);
if (domainNode == null) {
throw Error.get(MongoCrudConstants.ERR_INVALID_LOCKING_DOMAIN, domain);
}
JsonNode datasourceName = domainNode.get("datasource");
if (datasourceName == null) {
throw Error.get(MongoCrudConstants.ERR_CONFIGURATION_ERROR, "locking." + domain + ".datasource");
}
MongoDataStore store = new MongoDataStore();
store.setDatasourceName(datasourceName.asText());
DB db = controller.getDbResolver().get(store);
if (db == null) {
throw Error.get(MongoCrudConstants.ERR_CONFIGURATION_ERROR, "locking." + domain + ".datasource");
}
JsonNode collection = domainNode.get("collection");
if (collection == null) {
throw Error.get(MongoCrudConstants.ERR_CONFIGURATION_ERROR, "locking." + domain + ".collection");
}
return new MongoLocking(db.getCollection(collection.asText()));
}
示例2: testGetLocking
import com.redhat.lightblue.extensions.synch.Locking; //導入依賴的package包/類
@Test
public void testGetLocking() throws Exception {
try {
lbfactory.getLocking("blah");
Assert.fail();
} catch (Exception e) {
}
Locking locking = lbfactory.getLocking("test");
Assert.assertTrue(locking instanceof MongoLocking);
}
示例3: getLocking
import com.redhat.lightblue.extensions.synch.Locking; //導入依賴的package包/類
public Locking getLocking(String domain)
throws ClassNotFoundException, IllegalAccessException, InvocationTargetException, IOException, NoSuchMethodException, InstantiationException {
if (lockingMap == null) {
initializeLockingMap();
}
LockingSupport ls = lockingMap.get(domain);
if (ls != null) {
return ls.getLockingInstance(domain);
} else {
throw new RuntimeException("Unrecognized locking domain");
}
}
示例4: runLockCommand
import com.redhat.lightblue.extensions.synch.Locking; //導入依賴的package包/類
@Override
protected JsonNode runLockCommand(Locking locking) {
boolean ret = locking.release(caller, resource);
return NODE_FACTORY.booleanNode(ret);
}
示例5: runLockCommand
import com.redhat.lightblue.extensions.synch.Locking; //導入依賴的package包/類
@Override
protected JsonNode runLockCommand(Locking locking) {
locking.ping(caller, resource);
return NODE_FACTORY.booleanNode(true);
}
示例6: runLockCommand
import com.redhat.lightblue.extensions.synch.Locking; //導入依賴的package包/類
@Override
protected JsonNode runLockCommand(Locking locking) {
boolean ret = locking.acquire(caller, resource, ttl);
return NODE_FACTORY.booleanNode(ret);
}
示例7: runLockCommand
import com.redhat.lightblue.extensions.synch.Locking; //導入依賴的package包/類
@Override
protected JsonNode runLockCommand(Locking locking) {
int ret = locking.getLockCount(caller, resource);
return NODE_FACTORY.numberNode(ret);
}
示例8: runLockCommand
import com.redhat.lightblue.extensions.synch.Locking; //導入依賴的package包/類
protected abstract JsonNode runLockCommand(Locking locking);