当前位置: 首页>>代码示例>>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;未经允许,请勿转载。