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


Java SyncManager类代码示例

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


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

示例1: init

import org.sdnplatform.sync.internal.SyncManager; //导入依赖的package包/类
@Override
public void init(SyncManager syncManager, FloodlightModuleContext context) 
        throws SyncException {
    this.syncManager = syncManager;
    threadPool = context.getServiceImpl(IThreadPoolService.class);
    syncManager.registerPersistentStore(SYSTEM_NODE_STORE, Scope.GLOBAL);
    syncManager.registerPersistentStore(SYSTEM_UNSYNC_STORE, 
                                        Scope.UNSYNCHRONIZED);
    this.nodeStoreClient = 
            syncManager.getStoreClient(SYSTEM_NODE_STORE, 
                                       Short.class, Node.class);
    this.nodeStoreClient.addStoreListener(new ShortListener());
    this.unsyncStoreClient = 
            syncManager.getStoreClient(SYSTEM_UNSYNC_STORE, 
                                       String.class, String.class);
    this.unsyncStoreClient.addStoreListener(new StringListener());
    
    config = context.getConfigParams(syncManager);
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:20,代码来源:SyncStoreCCProvider.java

示例2: init

import org.sdnplatform.sync.internal.SyncManager; //导入依赖的package包/类
@Override
public void init(SyncManager syncManager,
                 FloodlightModuleContext context) {
    storageSource = context.getServiceImpl(IStorageSourceService.class);

    // storageSource.addListener(CONTROLLER_TABLE_NAME, this);

    Map<String, String> config =
            context.getConfigParams(FloodlightProvider.class);
    thisControllerID = config.get("controllerid");

    config = context.getConfigParams(SyncManager.class);
    keyStorePath = config.get("keyStorePath");
    keyStorePassword = config.get("keyStorePassword");
    authScheme = AuthScheme.NO_AUTH;
    try {
        authScheme = AuthScheme.valueOf(config.get("authScheme"));
    } catch (Exception e) {}
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:20,代码来源:StorageCCProvider.java

示例3: setupSyncManager

import org.sdnplatform.sync.internal.SyncManager; //导入依赖的package包/类
protected void setupSyncManager(FloodlightModuleContext fmc,
                                SyncManager syncManager, Node thisNode)
        throws Exception {        
    fmc.addService(IThreadPoolService.class, tp);
    fmc.addService(IDebugCounterService.class, new MockDebugCounterService());
    fmc.addService(IDebugEventService.class, new MockDebugEventService());
    fmc.addConfigParam(syncManager, "configProviders", 
                       PropertyCCProvider.class.getName());
    fmc.addConfigParam(syncManager, "nodes", nodeString);
    fmc.addConfigParam(syncManager, "thisNode", ""+thisNode.getNodeId());
    fmc.addConfigParam(syncManager, "persistenceEnabled", "false");
    fmc.addConfigParam(syncManager, "authScheme", "CHALLENGE_RESPONSE");
    fmc.addConfigParam(syncManager, "keyStorePath", 
                       keyStoreFile.getAbsolutePath());
    fmc.addConfigParam(syncManager, "keyStorePassword", keyStorePassword);
    tp.init(fmc);
    syncManager.init(fmc);

    tp.startUp(fmc);
    syncManager.startUp(fmc);

    syncManager.registerStore("global", Scope.GLOBAL);
    syncManager.registerStore("local", Scope.LOCAL);
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:25,代码来源:SyncManagerTest.java

示例4: setUp

import org.sdnplatform.sync.internal.SyncManager; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    keyStoreFile = new File(keyStoreFolder.getRoot(), 
            "keystore.jceks");
    CryptoUtil.writeSharedSecret(keyStoreFile.getAbsolutePath(), 
                                 keyStorePassword, 
                                 CryptoUtil.secureRandom(16));

    tp = new ThreadPool();
    
    syncManagers = new SyncManager[4];
    moduleContexts = new FloodlightModuleContext[4];

    nodes = new ArrayList<Node>();
    nodes.add(new Node("localhost", 40101, (short)1, (short)1));
    nodes.add(new Node("localhost", 40102, (short)2, (short)2));
    nodes.add(new Node("localhost", 40103, (short)3, (short)1));
    nodes.add(new Node("localhost", 40104, (short)4, (short)2));
    nodeString = mapper.writeValueAsString(nodes);

    for(int i = 0; i < 4; i++) {
        moduleContexts[i] = new FloodlightModuleContext();
        syncManagers[i] = new SyncManager();
        setupSyncManager(moduleContexts[i], syncManagers[i], nodes.get(i));
    }
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:27,代码来源:SyncManagerTest.java

示例5: testPerfOneNode

import org.sdnplatform.sync.internal.SyncManager; //导入依赖的package包/类
@Test
@Ignore
public void testPerfOneNode() throws Exception {
    tearDown();
    tp = new ThreadPool();
    tp.init(null);
    tp.startUp(null);
    nodes = new ArrayList<Node>();
    nodes.add(new Node("localhost", 40101, (short)1, (short)1));
    nodeString = mapper.writeValueAsString(nodes);
    SyncManager sm = new SyncManager();
    FloodlightModuleContext fmc = new FloodlightModuleContext();
    setupSyncManager(fmc, sm, nodes.get(0));
    fmc.addService(ISyncService.class, sm);
    SyncTorture st = new SyncTorture();
    //fmc.addConfigParam(st, "iterations", "1");
    st.init(fmc);
    st.startUp(fmc);
    Thread.sleep(10000);
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:21,代码来源:SyncManagerTest.java

示例6: setUp

import org.sdnplatform.sync.internal.SyncManager; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    FloodlightModuleContext fmc = new FloodlightModuleContext();
    tp = new ThreadPool();

    syncManager = new SyncManager();
    remoteSyncManager = new RemoteSyncManager();

    fmc.addService(IThreadPoolService.class, tp);
    fmc.addService(IDebugCounterService.class, new MockDebugCounterService());
    fmc.addService(IDebugEventService.class, new MockDebugEventService());
    fmc.addConfigParam(syncManager, "persistenceEnabled", "false");
    
    tp.init(fmc);
    syncManager.init(fmc);
    remoteSyncManager.init(fmc);

    tp.startUp(fmc);
    syncManager.startUp(fmc);
    remoteSyncManager.startUp(fmc);

    syncManager.registerStore("local", Scope.LOCAL);
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:24,代码来源:RemoteStoreTest.java

示例7: init

import org.sdnplatform.sync.internal.SyncManager; //导入依赖的package包/类
@Override
public void init(SyncManager syncManager, FloodlightModuleContext context)
        throws SyncException {
    this.syncManager = syncManager;
    threadPool = context.getServiceImpl(IThreadPoolService.class);
    syncManager.registerPersistentStore(SYSTEM_NODE_STORE, Scope.GLOBAL);
    syncManager.registerPersistentStore(SYSTEM_UNSYNC_STORE,
                                        Scope.UNSYNCHRONIZED);
    this.nodeStoreClient =
            syncManager.getStoreClient(SYSTEM_NODE_STORE,
                                       Short.class, Node.class);
    this.nodeStoreClient.addStoreListener(new ShortListener());
    this.unsyncStoreClient =
            syncManager.getStoreClient(SYSTEM_UNSYNC_STORE,
                                       String.class, String.class);
    this.unsyncStoreClient.addStoreListener(new StringListener());

    config = context.getConfigParams(syncManager);
}
 
开发者ID:zhenshengcai,项目名称:floodlight-hardware,代码行数:20,代码来源:SyncStoreCCProvider.java

示例8: setUp

import org.sdnplatform.sync.internal.SyncManager; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    FloodlightModuleContext fmc = new FloodlightModuleContext();
    tp = new ThreadPool();

    syncManager = new SyncManager();
    remoteSyncManager = new RemoteSyncManager();

    fmc.addService(IThreadPoolService.class, tp);
    fmc.addService(IDebugCounterService.class, new NullDebugCounter());
    fmc.addConfigParam(syncManager, "persistenceEnabled", "false");
    
    tp.init(fmc);
    syncManager.init(fmc);
    remoteSyncManager.init(fmc);

    tp.startUp(fmc);
    syncManager.startUp(fmc);
    remoteSyncManager.startUp(fmc);

    syncManager.registerStore("local", Scope.LOCAL);
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:23,代码来源:RemoteStoreTest.java

示例9: RPCChannelInitializer

import org.sdnplatform.sync.internal.SyncManager; //导入依赖的package包/类
public RPCChannelInitializer(SyncManager syncManager,
                          RPCService rpcService,
                          Timer timer) {
    super();
    this.syncManager = syncManager;
    this.rpcService = rpcService;
    this.timer = timer;
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:9,代码来源:RPCChannelInitializer.java

示例10: handleSyncRequest

import org.sdnplatform.sync.internal.SyncManager; //导入依赖的package包/类
@Override
protected void handleSyncRequest(SyncRequestMessage request,
                                 Channel channel) {
    rpcService.messageAcked(MessageType.SYNC_OFFER, getRemoteNodeId());
    if (!request.isSetKeys()) return;

    String storeName = request.getStore().getStoreName();
    try {
        IStorageEngine<ByteArray, byte[]> store =
                syncManager.getRawStore(storeName);

        SyncMessage bsm =
                TProtocolUtil.getTSyncValueMessage(request.getStore());
        SyncValueMessage svm = bsm.getSyncValue();
        svm.setResponseTo(request.getHeader().getTransactionId());
        svm.getHeader().setTransactionId(rpcService.getTransactionId());

        for (ByteBuffer key : request.getKeys()) {
            ByteArray keyArray = new ByteArray(key.array());
            List<Versioned<byte[]>> values =
                    store.get(keyArray);
            if (values == null || values.size() == 0) continue;
            KeyedValues kv =
                    TProtocolUtil.getTKeyedValues(keyArray, values);
            svm.addToValues(kv);
        }

        if (svm.isSetValues()) {
            updateCounter(SyncManager.counterSentValues,
                          svm.getValuesSize());
            rpcService.syncQueue.add(new NodeMessage(getRemoteNodeId(),
                                                     bsm));
        }
    } catch (Exception e) {
        channel.writeAndFlush(getError(request.getHeader().getTransactionId(), e,
                               MessageType.SYNC_REQUEST));
    }
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:39,代码来源:RPCChannelHandler.java

示例11: RPCService

import org.sdnplatform.sync.internal.SyncManager; //导入依赖的package包/类
public RPCService(SyncManager syncManager, 
                  IDebugCounterService debugCounter,
                  Timer timer) {
    super();
    this.syncManager = syncManager;
    this.debugCounter = debugCounter;
    this.timer = timer;

    messageWindows = new ConcurrentHashMap<Short, MessageWindow>();
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:11,代码来源:RPCService.java

示例12: init

import org.sdnplatform.sync.internal.SyncManager; //导入依赖的package包/类
@Override
public void init(SyncManager syncManager,
                 FloodlightModuleContext context) {
    Iterator<IClusterConfigProvider> iter = providers.iterator();
    while (iter.hasNext()) {
        IClusterConfigProvider provider = iter.next();
        try {
            provider.init(syncManager, context);
        } catch (Exception e) {
            logger.error("Failed to initialize provider " + 
                         provider.getClass().getName(), e);
            iter.remove();
        }
    }
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:16,代码来源:DelegatingCCProvider.java

示例13: init

import org.sdnplatform.sync.internal.SyncManager; //导入依赖的package包/类
@Override
public void init(SyncManager syncManager, FloodlightModuleContext context) {
    Map<String, String> config = context.getConfigParams(syncManager);
    keyStorePath = config.get("keyStorePath");
    keyStorePassword = config.get("keyStorePassword");
    authScheme = AuthScheme.NO_AUTH;
    try {
        authScheme = AuthScheme.valueOf(config.get("authScheme"));
        syncPort = Integer.parseInt(config.get("port"));
    } catch (Exception e) {}
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:12,代码来源:FallbackCCProvider.java

示例14: BootstrapClient

import org.sdnplatform.sync.internal.SyncManager; //导入依赖的package包/类
public BootstrapClient(SyncManager syncManager, AuthScheme authScheme,
                 String keyStorePath, String keyStorePassword) {
    super();
    this.syncManager = syncManager;
    this.authScheme = authScheme;
    this.keyStorePath = keyStorePath;
    this.keyStorePassword = keyStorePassword;
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:9,代码来源:BootstrapClient.java

示例15: put

import org.sdnplatform.sync.internal.SyncManager; //导入依赖的package包/类
@Override
public void put(ByteArray key, Versioned<byte[]> value)
        throws SyncException {
    updateCounter(SyncManager.counterPuts);
    localStorage.put(key, value);
    notifyListeners(key, UpdateType.LOCAL);
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:8,代码来源:ListenerStorageEngine.java


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