当前位置: 首页>>代码示例>>Java>>正文


Java Locking类代码示例

本文整理汇总了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()));
}
 
开发者ID:lightblue-platform,项目名称:lightblue-mongo,代码行数:23,代码来源:MongoLockingSupport.java

示例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);
}
 
开发者ID:lightblue-platform,项目名称:lightblue-mongo,代码行数:11,代码来源:LockingSupportTest.java

示例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");
    }
}
 
开发者ID:lightblue-platform,项目名称:lightblue-core,代码行数:13,代码来源:LightblueFactory.java

示例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);
}
 
开发者ID:lightblue-platform,项目名称:lightblue-rest,代码行数:6,代码来源:ReleaseCommand.java

示例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);
}
 
开发者ID:lightblue-platform,项目名称:lightblue-rest,代码行数:6,代码来源:LockPingCommand.java

示例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);
}
 
开发者ID:lightblue-platform,项目名称:lightblue-rest,代码行数:6,代码来源:AcquireCommand.java

示例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);
}
 
开发者ID:lightblue-platform,项目名称:lightblue-rest,代码行数:6,代码来源:GetLockCountCommand.java

示例8: runLockCommand

import com.redhat.lightblue.extensions.synch.Locking; //导入依赖的package包/类
protected abstract JsonNode runLockCommand(Locking locking); 
开发者ID:lightblue-platform,项目名称:lightblue-rest,代码行数:2,代码来源:AbstractLockCommand.java


注:本文中的com.redhat.lightblue.extensions.synch.Locking类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。