本文整理汇总了Java中akka.serialization.Serialization类的典型用法代码示例。如果您正苦于以下问题:Java Serialization类的具体用法?Java Serialization怎么用?Java Serialization使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Serialization类属于akka.serialization包,在下文中一共展示了Serialization类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createArea
import akka.serialization.Serialization; //导入依赖的package包/类
private void createArea(int loaclGridId) {
CacheManager cacheManager = ContextResolver.getComponent(CacheManager.class);
if (cacheManager.containsAreaKey(loaclGridId)) {
return;
} else {
String areaId = CacheManager.getAreaId(loaclGridId);
ActorRef actorOf = getContext().actorOf(Props.create(AreaActor.class, areaId), areaId);
AreaInfoCache info=new AreaInfoCache();
info.setAreaId(areaId);
info.setAreaRef(actorOf);
cacheManager.putAreaInfoCache(areaId,info);
getContext().watch(actorOf);
String identifier = Serialization.serializedActorPath(actorOf);
cacheManager.putAreaManagerPath(areaId, identifier);
}
}
开发者ID:zerosoft,项目名称:CodeBroker,代码行数:18,代码来源:AreaManagerActor.java
示例2: createGrid
import akka.serialization.Serialization; //导入依赖的package包/类
/**
* 创建一个格子
* @param gridId
*/
private void createGrid(String gridId) {
CacheManager component = ContextResolver.getComponent(CacheManager.class);
AreaInfoCache areaInfoCache = component.getAreaInfoCache(areaId);
Map<String, String> gridPath = areaInfoCache.getGridPath();
if (!gridPath.containsKey(gridId)) {
ActorRef actorOf = getContext().actorOf(Props.create(GridActor.class, getSelf()), gridId);
getContext().watch(actorOf);
gridPath.put(gridId,Serialization.serializedActorPath(actorOf));
component.putAreaInfoCache(areaId,areaInfoCache);
}
}
开发者ID:zerosoft,项目名称:CodeBroker,代码行数:17,代码来源:AreaActor.java
示例3: getSerializedLeaderActor
import akka.serialization.Serialization; //导入依赖的package包/类
String getSerializedLeaderActor() {
if (isLeader()) {
return Serialization.serializedActorPath(getActor());
} else {
return addressResolver.resolve(leaderId);
}
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:8,代码来源:ShardInformation.java
示例4: writeExternal
import akka.serialization.Serialization; //导入依赖的package包/类
@Override
public void writeExternal(ObjectOutput out) throws IOException {
out.writeObject(messageSliceReply.identifier);
out.writeInt(messageSliceReply.sliceIndex);
out.writeObject(messageSliceReply.failure);
out.writeObject(Serialization.serializedActorPath(messageSliceReply.sendTo));
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:8,代码来源:MessageSliceReply.java
示例5: writeExternal
import akka.serialization.Serialization; //导入依赖的package包/类
@Override
public void writeExternal(ObjectOutput out) throws IOException {
out.writeObject(messageSlice.identifier);
out.writeInt(messageSlice.sliceIndex);
out.writeInt(messageSlice.totalSlices);
out.writeInt(messageSlice.lastSliceHashCode);
out.writeObject(messageSlice.data);
out.writeObject(Serialization.serializedActorPath(messageSlice.replyTo));
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:10,代码来源:MessageSlice.java
示例6: writeExternal
import akka.serialization.Serialization; //导入依赖的package包/类
@Override
public void writeExternal(final ObjectOutput out) throws IOException {
out.writeObject(Serialization.serializedActorPath(rpcInvoker));
final NormalizedNodeDataOutput nnout = NormalizedNodeInputOutput.newDataOutput(out);
nnout.writeInt(rpcs.size());
for (DOMRpcIdentifier id : rpcs) {
nnout.writeSchemaPath(id.getType());
nnout.writeYangInstanceIdentifier(id.getContextReference());
}
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:12,代码来源:RoutingTable.java
示例7: writeExternal
import akka.serialization.Serialization; //导入依赖的package包/类
@Override
public void writeExternal(final ObjectOutput out) throws IOException {
super.writeExternal(out);
out.writeObject(Serialization.serializedActorPath(backend));
out.writeInt(maxMessages);
out.writeInt(alternates.size());
for (ActorSelection b : alternates) {
out.writeObject(b.toSerializationFormat());
}
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:13,代码来源:ConnectClientSuccessProxyV1.java
示例8: setAreaRef
import akka.serialization.Serialization; //导入依赖的package包/类
public void setAreaRef(ActorRef areaRef) {
AreaRef = Serialization.serializedActorPath(areaRef);
}
开发者ID:zerosoft,项目名称:CodeBroker,代码行数:4,代码来源:AreaInfoCache.java
示例9: handleRequestAssemblerMessage
import akka.serialization.Serialization; //导入依赖的package包/类
private void handleRequestAssemblerMessage(final Object message) {
dispatchers.getDispatcher(DispatcherType.Serialization).execute(() -> {
JavaSerializer.currentSystem().value_$eq((ExtendedActorSystem) context().system());
requestMessageAssembler.handleMessage(message, self());
});
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:7,代码来源:Shard.java
示例10: preStart
import akka.serialization.Serialization; //导入依赖的package包/类
@Override
public void preStart() throws Exception {
super.preStart();
LOG.info("RoleChangeNotifier:{} created and ready for shard:{}",
Serialization.serializedActorPath(getSelf()), memberId);
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:7,代码来源:RoleChangeNotifier.java
示例11: writeExternal
import akka.serialization.Serialization; //导入依赖的package包/类
@Override
public void writeExternal(final ObjectOutput out) throws IOException {
super.writeExternal(out);
out.writeObject(Serialization.serializedActorPath(replyTo));
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:6,代码来源:AbstractRequestProxy.java
示例12: main
import akka.serialization.Serialization; //导入依赖的package包/类
public static void main(String[] args) {
ActorSystem system = ActorSystem.create("MySerializableSys",
ConfigFactory.load().getConfig("MySerializableSys"));
Serialization serialization = SerializationExtension.get(system);
MyMessage originalMessage = new MyMessage("Munish", 36, "Bangalore");
System.out.println("The original message is as " + originalMessage);
// Get the Binded Serializer for it
Serializer serializer = serialization
.findSerializerFor(originalMessage);
// Turn the object into bytes
byte[] bytes = serializer.toBinary(originalMessage);
// Turn the byte[] back into an object,
MyMessage deSerializedMessage = (MyMessage) serializer.fromBinary(
bytes, MyMessage.class);
System.out.println("The de-serialized message is as " + deSerializedMessage);
system.shutdown();
}
开发者ID:rokumar7,项目名称:trial,代码行数:27,代码来源:MySerializationApp.java
示例13: putActorGlobalPath
import akka.serialization.Serialization; //导入依赖的package包/类
/**
* 放置唯一的
* @param IDENTIFY
* @param actorRef
*/
public void putActorGlobalPath(String IDENTIFY, ActorRef actorRef) {
String identifier = Serialization.serializedActorPath(actorRef);
putActorRefPath(IDENTIFY, identifier);
}
开发者ID:zerosoft,项目名称:CodeBroker,代码行数:10,代码来源:CacheManager.java
注:本文中的akka.serialization.Serialization类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论