问题描述
我在hazelcast 3.5中遇到序列化问题:
I have a serialization problem with hazelcast 3.5:
当一个hazelcast客户端(Java)放置一个类的值
When one hazelcast client(Java) puts a value of class
public class MyType extends ArrayList<MyElem>
进入地图,然后另一个客户端(其他Java进程)检索该值,它会返回类ArrayList
的值,而不是预期的子类MyType
!
into a map, and afterwards another client (other Java process) retrieves the value,it gets back a value of class ArrayList
, not the expected subclass MyType
!
在hazelcast版本3.1.3中,此方法运行良好:第二个客户端检索了一个值正确的子类MyType
的对象.
In hazelcast version 3.1.3 this worked fine: the second client retrieved a valueof the correct subclass MyType
.
我使用了示例配置hazelcast.xml和启动脚本server.bat在两个hazelcast版本中.
I used the sample configuration hazelcast.xml and the start script server.batin both hazelcast versions.
这可能是新3.5版本中的错误吗?
Is this possibly a bug in the new 3.5 version?
我的客户端配置为空.
推荐答案
Hazelcast(我想是)3.4为List子类添加了专门的序列化程序.您必须注册一个自定义序列化器才能选择您的类型.您可以继承Hazelcast内部序列化器的子类,只需交换使它唯一标识的工厂和类型ID.
Hazelcast (I guess it was) 3.4 added a specialized serializer for List subclasses. You have to register a custom serializer to pick up your type. You can subclass the Hazelcast internal serializer and just exchange the factory and type ids you make it uniquely identified.
这篇关于get在hazelcast 3.5中返回超类ArrayList的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!