本文整理汇总了Java中org.onlab.util.KryoNamespace.Builder方法的典型用法代码示例。如果您正苦于以下问题:Java KryoNamespace.Builder方法的具体用法?Java KryoNamespace.Builder怎么用?Java KryoNamespace.Builder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.onlab.util.KryoNamespace
的用法示例。
在下文中一共展示了KryoNamespace.Builder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: activate
import org.onlab.util.KryoNamespace; //导入方法依赖的package包/类
@Activate
public void activate() {
KryoNamespace.Builder kryoBuilder = new KryoNamespace.Builder()
.register(KryoNamespaces.API)
.register(UiTopoLayoutId.class)
.register(UiTopoLayout.class);
layouts = storageService.<UiTopoLayoutId, UiTopoLayout>consistentMapBuilder()
.withSerializer(Serializer.using(kryoBuilder.build()))
.withName("onos-topo-layouts")
.withRelaxedReadConsistency()
.build();
layoutMap = layouts.asJavaMap();
// Create and add the default layout, if needed.
layoutMap.computeIfAbsent(DEFAULT_ID, k -> new UiTopoLayout(k, null, null));
log.info("Started");
}
示例2: activate
import org.onlab.util.KryoNamespace; //导入方法依赖的package包/类
@Activate
public void activate() {
KryoNamespace.Builder serializer = KryoNamespace.newBuilder()
.register(KryoNamespaces.API)
.register(MultiValuedTimestamp.class);
tunnelIdAsKeyStore = storageService
.<TunnelId, Tunnel>eventuallyConsistentMapBuilder()
.withName("all_tunnel").withSerializer(serializer)
.withTimestampProvider((k, v) -> new WallClockTimestamp()).build();
orderRelationship = storageService
.<ApplicationId, Set<TunnelSubscription>>eventuallyConsistentMapBuilder()
.withName("type_tunnel").withSerializer(serializer)
.withTimestampProvider((k, v) -> new WallClockTimestamp()).build();
idGenerator = coreService.getIdGenerator(tunnelOpTopic);
tunnelIdAsKeyStore.addListener(tunnelUpdateListener);
log.info("Started");
}
示例3: activate
import org.onlab.util.KryoNamespace; //导入方法依赖的package包/类
@Activate
public void activate() {
KryoNamespace.Builder hostSerializer = KryoNamespace.newBuilder()
.register(KryoNamespaces.API);
hostsConsistentMap = storageService.<HostId, DefaultHost>consistentMapBuilder()
.withName("onos-hosts")
.withRelaxedReadConsistency()
.withSerializer(Serializer.using(hostSerializer.build()))
.build();
hosts = hostsConsistentMap.asJavaMap();
prevHosts.putAll(hosts);
hostsConsistentMap.addListener(hostLocationTracker);
log.info("Started");
}
示例4: activate
import org.onlab.util.KryoNamespace; //导入方法依赖的package包/类
@Activate
public void activate() {
appId = coreService.registerApplication(VTNRSC_APP);
KryoNamespace.Builder serializer = KryoNamespace
.newBuilder()
.register(KryoNamespaces.API)
.register(FloatingIp.class, FloatingIpId.class,
TenantNetworkId.class, TenantId.class,
FloatingIp.Status.class, RouterId.class,
VirtualPortId.class, DefaultFloatingIp.class,
UUID.class);
floatingIpStore = storageService
.<FloatingIpId, FloatingIp>eventuallyConsistentMapBuilder()
.withName(FLOATINGIPSTORE).withSerializer(serializer)
.withTimestampProvider((k, v) -> new WallClockTimestamp())
.build();
floatingIpBindStore = storageService
.<FloatingIpId, FloatingIp>eventuallyConsistentMapBuilder()
.withName(FLOATINGIPBINDSTORE).withSerializer(serializer)
.withTimestampProvider((k, v) -> new WallClockTimestamp())
.build();
floatingIpStore.addListener(floatingIpListener);
log.info("Started");
}
示例5: activate
import org.onlab.util.KryoNamespace; //导入方法依赖的package包/类
@Activate
public void activate() {
eventDispatcher.addSink(PortChainEvent.class, listenerRegistry);
KryoNamespace.Builder serializer = KryoNamespace.newBuilder()
.register(KryoNamespaces.API)
.register(MultiValuedTimestamp.class)
.register(PortChain.class, PortChainId.class, UUID.class, PortPairGroupId.class,
FlowClassifierId.class, FiveTuple.class, LoadBalanceId.class, DeviceId.class,
DefaultPortChain.class, PortPairId.class, TenantId.class);
portChainStore = storageService
.<PortChainId, PortChain>eventuallyConsistentMapBuilder()
.withName("portchainstore").withSerializer(serializer)
.withTimestampProvider((k, v) -> new WallClockTimestamp()).build();
portChainStore.addListener(portChainListener);
log.info("Started");
}
示例6: activate
import org.onlab.util.KryoNamespace; //导入方法依赖的package包/类
@Activate
public void activate() {
eventDispatcher.addSink(PortPairGroupEvent.class, listenerRegistry);
KryoNamespace.Builder serializer = KryoNamespace.newBuilder()
.register(KryoNamespaces.API)
.register(MultiValuedTimestamp.class)
.register(PortPairGroup.class, PortPairGroupId.class, UUID.class, DefaultPortPairGroup.class,
TenantId.class, PortPairId.class);
portPairGroupStore = storageService
.<PortPairGroupId, PortPairGroup>eventuallyConsistentMapBuilder()
.withName("portpairgroupstore").withSerializer(serializer)
.withTimestampProvider((k, v) -> new WallClockTimestamp()).build();
portPairGroupStore.addListener(portPairGroupListener);
log.info("Started");
}
示例7: activate
import org.onlab.util.KryoNamespace; //导入方法依赖的package包/类
@Activate
public void activate() {
eventDispatcher.addSink(PortPairEvent.class, listenerRegistry);
KryoNamespace.Builder serializer = KryoNamespace.newBuilder()
.register(KryoNamespaces.API)
.register(MultiValuedTimestamp.class)
.register(PortPair.class, PortPairId.class, UUID.class, DefaultPortPair.class, TenantId.class);
portPairStore = storageService.<PortPairId, PortPair>eventuallyConsistentMapBuilder()
.withName("portpairstore")
.withSerializer(serializer)
.withTimestampProvider((k, v) -> new WallClockTimestamp())
.build();
portPairStore.addListener(portPairListener);
log.info("Started");
}
示例8: activate
import org.onlab.util.KryoNamespace; //导入方法依赖的package包/类
@Activate
public void activate() {
appId = coreService.registerApplication(VTNRSC_APP);
KryoNamespace.Builder serializer = KryoNamespace
.newBuilder()
.register(KryoNamespaces.API)
.register(Router.class, RouterId.class, DefaultRouter.class,
TenantNetworkId.class, TenantId.class,
VirtualPortId.class, DefaultRouter.class,
RouterGateway.class, Router.Status.class,
SubnetId.class, FixedIp.class);
routerStore = storageService
.<RouterId, Router>eventuallyConsistentMapBuilder()
.withName(ROUTER).withSerializer(serializer)
.withTimestampProvider((k, v) -> new WallClockTimestamp())
.build();
routerStore.addListener(routerListener);
log.info("Started");
}
示例9: createSerializer
import org.onlab.util.KryoNamespace; //导入方法依赖的package包/类
private KryoNamespace.Builder createSerializer() {
return new KryoNamespace.Builder()
.register(KryoNamespaces.API)
.register(NeighborSetNextObjectiveStoreKey.class,
SubnetNextObjectiveStoreKey.class,
SubnetAssignedVidStoreKey.class,
NeighborSet.class,
Tunnel.class,
DefaultTunnel.class,
Policy.class,
TunnelPolicy.class,
Policy.Type.class,
PortNextObjectiveStoreKey.class,
XConnectStoreKey.class
);
}
示例10: using
import org.onlab.util.KryoNamespace; //导入方法依赖的package包/类
/**
* Creates a new Serializer instance from a list of KryoNamespaces and some additional classes.
*
* @param namespaces kryo namespaces
* @param classes variable length array of classes to register
* @return Serializer instance
*/
static Serializer using(List<KryoNamespace> namespaces, Class<?>... classes) {
KryoNamespace.Builder builder = new KryoNamespace.Builder();
namespaces.forEach(builder::register);
Lists.newArrayList(classes).forEach(builder::register);
KryoNamespace namespace = builder.build();
return new Serializer() {
@Override
public <T> byte[] encode(T object) {
return namespace.serialize(object);
}
@Override
public <T> T decode(byte[] bytes) {
return namespace.deserialize(bytes);
}
};
}
示例11: createSerializer
import org.onlab.util.KryoNamespace; //导入方法依赖的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();
}
};
}
示例12: createSerializer
import org.onlab.util.KryoNamespace; //导入方法依赖的package包/类
KryoNamespace.Builder createSerializer() {
return new KryoNamespace.Builder()
.register(KryoNamespaces.API)
.register(DestinationSetNextObjectiveStoreKey.class,
VlanNextObjectiveStoreKey.class,
DestinationSet.class,
NextNeighbors.class,
Tunnel.class,
DefaultTunnel.class,
Policy.class,
TunnelPolicy.class,
Policy.Type.class,
PortNextObjectiveStoreKey.class,
XConnectStoreKey.class,
DefaultL2Tunnel.class,
DefaultL2TunnelPolicy.class
);
}
示例13: activate
import org.onlab.util.KryoNamespace; //导入方法依赖的package包/类
@Activate
public void activate() {
appId = coreService.registerApplication(VTNRSC_APP);
KryoNamespace.Builder serializer = KryoNamespace
.newBuilder()
.register(KryoNamespaces.API)
.register(RouterId.class, TenantId.class, VirtualPortId.class,
RouterInterface.class, SubnetId.class);
routerInterfaceStore = storageService
.<SubnetId, RouterInterface>eventuallyConsistentMapBuilder()
.withName(ROUTER_INTERFACE).withSerializer(serializer)
.withTimestampProvider((k, v) -> new WallClockTimestamp())
.build();
routerInterfaceStore.addListener(routerInterfaceListener);
log.info("Started");
}
示例14: activate
import org.onlab.util.KryoNamespace; //导入方法依赖的package包/类
@Activate
public void activate() {
KryoNamespace.Builder intentSerializer = KryoNamespace.newBuilder()
.register(KryoNamespaces.API)
.nextId(KryoNamespaces.BEGIN_USER_CUSTOM_ID)
.register(IntentData.class)
.register(MultiValuedTimestamp.class);
currentMap = storageService.<Key, IntentData>eventuallyConsistentMapBuilder()
.withName("intent-current")
.withSerializer(intentSerializer)
.withTimestampProvider((key, intentData) ->
new MultiValuedTimestamp<>(intentData.version(),
sequenceNumber.getAndIncrement()))
.withPeerUpdateFunction((key, intentData) -> getPeerNodes(key, intentData))
.build();
pendingMap = storageService.<Key, IntentData>eventuallyConsistentMapBuilder()
.withName("intent-pending")
.withSerializer(intentSerializer)
.withTimestampProvider((key, intentData) -> new MultiValuedTimestamp<>(intentData.version(),
System.nanoTime()))
.withPeerUpdateFunction((key, intentData) -> getPeerNodes(key, intentData))
.build();
currentMap.addListener(new InternalCurrentListener());
pendingMap.addListener(new InternalPendingListener());
log.info("Started");
}
示例15: activate
import org.onlab.util.KryoNamespace; //导入方法依赖的package包/类
@Activate
public void activate() {
eventDispatcher.addSink(VtnRscEvent.class, listenerRegistry);
floatingIpService.addListener(floatingIpListener);
routerService.addListener(routerListener);
routerInterfaceService.addListener(routerInterfaceListener);
portPairService.addListener(portPairListener);
portPairGroupService.addListener(portPairGroupListener);
flowClassifierService.addListener(flowClassifierListener);
portChainService.addListener(portChainListener);
virtualPortService.addListener(virtualPortListener);
KryoNamespace.Builder serializer = KryoNamespace.newBuilder()
.register(KryoNamespaces.API)
.register(TenantId.class, DeviceId.class, SegmentationId.class,
TenantRouter.class, RouterId.class);
l3vniTenantMap = storageService
.<TenantId, SegmentationId>eventuallyConsistentMapBuilder()
.withName(L3VNITENANTMAP).withSerializer(serializer)
.withTimestampProvider((k, v) -> clockService.getTimestamp())
.build();
l3vniTenantRouterMap = storageService
.<TenantRouter, SegmentationId>eventuallyConsistentMapBuilder()
.withName(L3VNITENANTROUTERMAP).withSerializer(serializer)
.withTimestampProvider((k, v) -> clockService.getTimestamp())
.build();
classifierOvsMap = storageService
.<TenantId, Set<DeviceId>>eventuallyConsistentMapBuilder()
.withName(CLASSIFIEROVSMAP).withSerializer(serializer)
.withTimestampProvider((k, v) -> clockService.getTimestamp())
.build();
sffOvsMap = storageService
.<TenantId, Set<DeviceId>>eventuallyConsistentMapBuilder()
.withName(SFFOVSMAP).withSerializer(serializer)
.withTimestampProvider((k, v) -> clockService.getTimestamp())
.build();
}