當前位置: 首頁>>代碼示例>>Java>>正文


Java KryoSerializer類代碼示例

本文整理匯總了Java中org.onosproject.store.serializers.KryoSerializer的典型用法代碼示例。如果您正苦於以下問題:Java KryoSerializer類的具體用法?Java KryoSerializer怎麽用?Java KryoSerializer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


KryoSerializer類屬於org.onosproject.store.serializers包,在下文中一共展示了KryoSerializer類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: activate

import org.onosproject.store.serializers.KryoSerializer; //導入依賴的package包/類
@Override
@Activate
public void activate() {
    super.activate();

    this.serializer = new KryoSerializer() {
        @Override
        protected void setupKryoPool() {
            serializerPool = KryoNamespace.newBuilder()
                    .register(KryoNamespaces.API)
                    .nextId(KryoNamespaces.BEGIN_USER_CUSTOM_ID)
                    .build();
        }
    };

    lastAppId = theInstance.getAtomicLong("applicationId");

    appIdsByName = new SMap<>(theInstance.<byte[], byte[]>getMap("appIdsByName"), this.serializer);
    listenerId = appIdsByName.addEntryListener((new RemoteAppIdEventHandler()), true);

    primeAppIds();

    log.info("Started");
}
 
開發者ID:ravikumaran2015,項目名稱:ravikumaran201504,代碼行數:25,代碼來源:DistributedApplicationIdStore.java

示例2: createSerializer

import org.onosproject.store.serializers.KryoSerializer; //導入依賴的package包/類
private KryoSerializer createSerializer(KryoNamespace.Builder builder) {
    return new KryoSerializer() {
        @Override
        protected void setupKryoPool() {
            // Add the map's internal helper classes to the user-supplied serializer
            serializerPool = builder
                    .register(LogicalTimestamp.class)
                    .register(WallClockTimestamp.class)
                    .register(PutEntry.class)
                    .register(RemoveEntry.class)
                    .register(ArrayList.class)
                    .register(AntiEntropyAdvertisement.class)
                    .register(HashMap.class)
                    .register(Timestamped.class)
                    .build();
        }
    };
}
 
開發者ID:ravikumaran2015,項目名稱:ravikumaran201504,代碼行數:19,代碼來源:EventuallyConsistentMapImpl.java

示例3: MapDbPersistentStore

import org.onosproject.store.serializers.KryoSerializer; //導入依賴的package包/類
/**
 * Creates a new MapDB based persistent store.
 *
 * @param filename filename of the database on disk
 * @param executor executor to use for tasks that write to the disk
 * @param serializer serializer for keys and values
 */
MapDbPersistentStore(String filename, ExecutorService executor,
                     KryoSerializer serializer) {
    this.executor = checkNotNull(executor);
    this.serializer = checkNotNull(serializer);

    File databaseFile = new File(filename);

    database = DBMaker.newFileDB(databaseFile).make();

    items = database.createHashMap("items")
            .keySerializer(Serializer.BYTE_ARRAY)
            .valueSerializer(Serializer.BYTE_ARRAY)
            .hasher(Hasher.BYTE_ARRAY)
            .makeOrGet();

    tombstones = database.createHashMap("tombstones")
            .keySerializer(Serializer.BYTE_ARRAY)
            .valueSerializer(Serializer.BYTE_ARRAY)
            .hasher(Hasher.BYTE_ARRAY)
            .makeOrGet();
}
 
開發者ID:ravikumaran2015,項目名稱:ravikumaran201504,代碼行數:29,代碼來源:MapDbPersistentStore.java

示例4: setUp

import org.onosproject.store.serializers.KryoSerializer; //導入依賴的package包/類
@Before
public void setUp() throws Exception {
    // TODO should find a way to clean Hazelcast instance without shutdown.
    TestStoreManager testStoreMgr = new TestStoreManager();
    testStoreMgr.setHazelcastInstance(testStoreMgr.initSingleInstance());
    storeMgr = testStoreMgr;
    storeMgr.activate();

    serializationMgr = new KryoSerializer();

    dms = new TestDistributedMastershipStore(storeMgr, serializationMgr);
    dms.clusterService = new TestClusterService();
    dms.activate();

    testStore = (TestDistributedMastershipStore) dms;
}
 
開發者ID:ravikumaran2015,項目名稱:ravikumaran201504,代碼行數:17,代碼來源:DistributedMastershipStoreTest.java

示例5: activate

import org.onosproject.store.serializers.KryoSerializer; //導入依賴的package包/類
@Override
@Activate
public void activate() {
    super.activate();

    this.serializer = new KryoSerializer() {
        @Override
        protected void setupKryoPool() {
            serializerPool = KryoNamespace.newBuilder()
                    .register(KryoNamespaces.API)
                    .nextId(KryoNamespaces.BEGIN_USER_CUSTOM_ID)
                    .register(new RoleValueSerializer(), RoleValue.class)
                    .build();
        }
    };

    final Config config = theInstance.getConfig();

    MapConfig nodeRolesCfg = config.getMapConfig(NODE_ROLES_MAP_NAME);
    nodeRolesCfg.setAsyncBackupCount(MapConfig.MAX_BACKUP_COUNT - nodeRolesCfg.getBackupCount());

    MapConfig termsCfg = config.getMapConfig(TERMS_MAP_NAME);
    termsCfg.setAsyncBackupCount(MapConfig.MAX_BACKUP_COUNT - termsCfg.getBackupCount());

    roleMap = new SMap<>(theInstance.<byte[], byte[]>getMap(NODE_ROLES_MAP_NAME), this.serializer);
    listenerId = roleMap.addEntryListener((new RemoteMasterShipEventHandler()), true);
    terms = new SMap<>(theInstance.<byte[], byte[]>getMap(TERMS_MAP_NAME), this.serializer);

    log.info("Started");
}
 
開發者ID:ravikumaran2015,項目名稱:ravikumaran201504,代碼行數:31,代碼來源:DistributedMastershipStore.java

示例6: activate

import org.onosproject.store.serializers.KryoSerializer; //導入依賴的package包/類
@Activate
public void activate() {
    serializer = new KryoSerializer();
    theInstance = storeService.getHazelcastInstance();
}
 
開發者ID:ravikumaran2015,項目名稱:ravikumaran201504,代碼行數:6,代碼來源:AbstractHazelcastStore.java

示例7: TestDistributedMastershipStore

import org.onosproject.store.serializers.KryoSerializer; //導入依賴的package包/類
public TestDistributedMastershipStore(StoreService storeService,
        KryoSerializer kryoSerialization) {
    this.storeService = storeService;
    this.serializer = kryoSerialization;
}
 
開發者ID:ravikumaran2015,項目名稱:ravikumaran201504,代碼行數:6,代碼來源:DistributedMastershipStoreTest.java


注:本文中的org.onosproject.store.serializers.KryoSerializer類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。