Dawidan

Process: com.example.chaos_ping_pong, PID: 25230
com.esotericsoftware.kryo.KryoException: java.lang.IllegalArgumentException: Class is not registered: java.util.Collections$SynchronizedRandomAccessList
Note: To register this class use: kryo.register(java.util.Collections$SynchronizedRandomAccessList.class);

I tried to add this "SynchronizedRandomAccessList" in registration or even in Collections.SynchronizedRandomAccessList but Java can't find it

Then was attempt to add kryo-serializers, but gradle had errored with "duplicare class" (https://github.com/magro/kryo-serializers)

//implementation 'de.javakaffee:kryo-serializers:0.45' - something wrong here maybe?

I'm using List<> with made-by-me classes.
List<MyClass> for example

Also, i'm russian. Sorry for bad english.
Dawidan
  • Beiträge: 1

Nate

How do you create such a List? You can register it with eg:
kryo.register(Collections.synchronizedList(new ArrayList()).getClass());
But you need to look at the internal representation in the JRE you are using and make sure you can serialize it with FieldSerializer. Another option is to write a serializer for it (pass your serialize to register). Another option is to use ArrayList in your classes internally and have a transient field that is a synchronized list, so the synchronized list is not serialized while the ArrayList is.
Benutzeravatar
Nate

Nate
  • Beiträge: 9858


Zurück zu Off-topic