get returns a value of the superclass ArrayList in hazelcast 3.5

自闭症网瘾萝莉.ら 提交于 2019-12-10 15:38:22

问题


I have a serialization problem with hazelcast 3.5:

When one hazelcast client(Java) puts a value of class

public class MyType extends ArrayList<MyElem>

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!

In hazelcast version 3.1.3 this worked fine: the second client retrieved a value of the correct subclass MyType.

I used the sample configuration hazelcast.xml and the start script server.bat in both hazelcast versions.

Is this possibly a bug in the new 3.5 version?

My client configuration is empty.


回答1:


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.



来源:https://stackoverflow.com/questions/31537670/get-returns-a-value-of-the-superclass-arraylist-in-hazelcast-3-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!