本文整理匯總了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;
}