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


Java ObsoleteVersionException类代码示例

本文整理汇总了Java中org.sdnplatform.sync.error.ObsoleteVersionException的典型用法代码示例。如果您正苦于以下问题:Java ObsoleteVersionException类的具体用法?Java ObsoleteVersionException怎么用?Java ObsoleteVersionException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ObsoleteVersionException类属于org.sdnplatform.sync.error包,在下文中一共展示了ObsoleteVersionException类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateSeeds

import org.sdnplatform.sync.error.ObsoleteVersionException; //导入依赖的package包/类
private void updateSeeds(ClusterConfig config) throws SyncException {
    List<String> hosts = new ArrayList<String>();
    for (Node n : config.getNodes()) {
        if (!config.getNode().equals(n)) {
            HostAndPort h = 
                    HostAndPort.fromParts(n.getHostname(), n.getPort());
            hosts.add(h.toString());
        }
    }
    Collections.sort(hosts);
    String seeds = Joiner.on(',').join(hosts);
    while (true) {
        try {
            Versioned<String> sv = unsyncStoreClient.get(SEEDS);
            if (sv.getValue() == null || !sv.getValue().equals(seeds)) {
                if (logger.isDebugEnabled()) {
                    logger.debug("[{}] Updating seeds to \"{}\" from \"{}\"", 
                                 new Object[]{config.getNode().getNodeId(),
                                              seeds, sv.getValue()});
                }
                unsyncStoreClient.put(SEEDS, seeds);
            }
            break;
        } catch (ObsoleteVersionException e) { }
    }
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:27,代码来源:SyncStoreCCProvider.java

示例2: updateSeeds

import org.sdnplatform.sync.error.ObsoleteVersionException; //导入依赖的package包/类
private void updateSeeds(ClusterConfig config) throws SyncException {
    List<String> hosts = new ArrayList<String>();
    for (Node n : config.getNodes()) {
        if (!config.getNode().equals(n)) {
            HostAndPort h =
                    HostAndPort.fromParts(n.getHostname(), n.getPort());
            hosts.add(h.toString());
        }
    }
    Collections.sort(hosts);
    String seeds = Joiner.on(',').join(hosts);
    while (true) {
        try {
            Versioned<String> sv = unsyncStoreClient.get(SEEDS);
            if (sv.getValue() == null || !sv.getValue().equals(seeds)) {
                if (logger.isDebugEnabled()) {
                    logger.debug("[{}] Updating seeds to \"{}\" from \"{}\"",
                                 new Object[]{config.getNode().getNodeId(),
                                              seeds, sv.getValue()});
                }
                unsyncStoreClient.put(SEEDS, seeds);
            }
            break;
        } catch (ObsoleteVersionException e) { }
    }
}
 
开发者ID:zhenshengcai,项目名称:floodlight-hardware,代码行数:27,代码来源:SyncStoreCCProvider.java

示例3: putIfNotObsolete

import org.sdnplatform.sync.error.ObsoleteVersionException; //导入依赖的package包/类
@Override
public boolean putIfNotObsolete(K key, Versioned<V> versioned)
        throws SyncException {
    try {
        put(key, versioned);
        return true;
    } catch (ObsoleteVersionException e) {
        return false;
    }
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:11,代码来源:AbstractStoreClient.java

示例4: testBasicOneNode

import org.sdnplatform.sync.error.ObsoleteVersionException; //导入依赖的package包/类
@Test
public void testBasicOneNode() throws Exception {
    AbstractSyncManager sync = syncManagers[0];
    IStoreClient<Key, TBean> testClient =
            sync.getStoreClient("global", Key.class, TBean.class);
    Key k = new Key("com.bigswitch.bigsync.internal", "test");
    TBean tb = new TBean("hello", 42);
    TBean tb2 = new TBean("hello", 84);
    TBean tb3 = new TBean("hello", 126);
    
    assertNotNull(testClient.get(k));
    assertNull(testClient.get(k).getValue());
    
    testClient.put(k, tb);
    Versioned<TBean> result = testClient.get(k);
    assertEquals(result.getValue(), tb);

    result.setValue(tb2);
    testClient.put(k, result);

    try {
        result.setValue(tb3);
        testClient.put(k, result);
        fail("Should get ObsoleteVersionException");
    } catch (ObsoleteVersionException e) {
        // happy town
    }

    result = testClient.get(k);
    assertEquals(tb2, result.getValue());
    
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:33,代码来源:SyncManagerTest.java

示例5: testObsoletePutFails

import org.sdnplatform.sync.error.ObsoleteVersionException; //导入依赖的package包/类
private void testObsoletePutFails(String message,
                                  IStore<K, V> store,
                                  K key,
                                  Versioned<V> versioned) throws SyncException {
    VectorClock clock = (VectorClock) versioned.getVersion();
    clock = clock.clone();
    try {
        store.put(key, versioned);
        fail(message);
    } catch(ObsoleteVersionException e) {
        // this is good, but check that we didn't fuck with the version
        assertEquals(clock, versioned.getVersion());
    }
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:15,代码来源:AbstractStoreT.java


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