當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。