本文整理汇总了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");
}
示例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();
}
};
}
示例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();
}
示例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;
}
示例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");
}
示例6: activate
import org.onosproject.store.serializers.KryoSerializer; //导入依赖的package包/类
@Activate
public void activate() {
serializer = new KryoSerializer();
theInstance = storeService.getHazelcastInstance();
}
示例7: TestDistributedMastershipStore
import org.onosproject.store.serializers.KryoSerializer; //导入依赖的package包/类
public TestDistributedMastershipStore(StoreService storeService,
KryoSerializer kryoSerialization) {
this.storeService = storeService;
this.serializer = kryoSerialization;
}