本文整理汇总了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);