serialization - Using Kryo to Serialize Classes with Non Serializable Attributes -


i using kryo serializer serializing java object

my java object this

class {  private class b; private class c; private class d; int x ; int y; } 

b, c , d third party libraries , not serializable . cant edit code .

i using kryo serialize a = new (); //populate properties of kryo kryo = new kryo(); output output = new output(new fileoutputstream("file.bin")); kryo.writeclassandobject(output, ); output.close();

and deserialize

    input = new com.esotericsoftware.kryo.io.input(new fileinputstream("file.bin"));         inputqueuemanagerimpl inputqueue = (a) kryo.readclassandobject(input);//, a.class);         input.close(); 

while executing , concurrentmodificationexception

    @ apache.application.main(application.java:43) caused by: com.esotericsoftware.kryo.kryoexception: java.util.concurrentmodificationexception serialization trace: classes (sun.misc.launcher$appclassloader) contextclassloader (java.lang.thread) threads (java.lang.threadgroup) parent (java.lang.threadgroup) group (java.util.concurrent.executors$defaultthreadfactory) threadfactory (java.util.concurrent.threadpoolexecutor) executor (com.rabbitmq.client.impl.consumerworkservice) workservice (com.rabbitmq.client.impl.consumerdispatcher) dispatcher (com.rabbitmq.client.impl.channeln) _channelmap (com.rabbitmq.client.impl.channelmanager) _channelmanager (com.rabbitmq.client.impl.amqconnection) delegate (org.springframework.amqp.rabbit.connection.simpleconnection) target     (org.springframework.amqp.rabbit.connection.cachingconnectionfactory$channelcachingconnectionproxy) checkoutpermits (org.springframework.amqp.rabbit.connection.cachingconnectionfactory) connectionfactory (org.springframework.amqp.rabbit.core.rabbitadmin) amqpadmin (mqclient.rabbitmq.manager.impl.inputqueuemanagerimpl) @ com.esotericsoftware.kryo.serializers.fieldserializer$objectfield.write(fieldserializer.java:585) @ com.esotericsoftware.kryo.serializers.fieldserializer.write(fieldserializer.java:213) 

when make b,c,d transient works . want serialize b,c,d too.

can kryo here? if yes , correct way it?

it means while kryo serializing class , of member class (b, c, ...) got modified in whole hierarchy thread. example let class b contains list list. , getting changed in list while serializing class -> above exception. that's how kryo designed.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -