Код: Выделить всё
com.esotericsoftware.kryo.KryoException: Encountered unregistered class ID: 44
at com.esotericsoftware.kryo.util.DefaultClassResolver.readClass(DefaultClassResolver.java:137)
at com.esotericsoftware.kryo.Kryo.readClass(Kryo.java:693)
at com.esotericsoftware.kryo.Kryo.readClassAndObject(Kryo.java:804)
at main.java.com.bag.client.TestClient.processReadReturn(TestClient.java:246)
at main.java.com.bag.client.TestClient.replyReceived(TestClient.java:221)
at bftsmart.communication.client.netty.NettyClientServerCommunicationSystemClientSide.channelRead0(NettyClientServerCommunicationSystemClientSide.java:244)
at bftsmart.communication.client.netty.NettyClientServerCommunicationSystemClientSide.channelRead0(NettyClientServerCommunicationSystemClientSide.java:65)
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:292)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:278)
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:277)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:264)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:292)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:278)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:962)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:528)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:485)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:399)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:371)
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112)
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137)
at java.lang.Thread.run(Thread.java:745)
Код: Выделить всё
KryoPool pool = new KryoPool.Builder(factory).softReferences().build();
Kryo kryo = pool.borrow();
Input input = new Input(bytes);
ArrayList nodeStorage = new ArrayList();
ArrayList relationshipStorage = new ArrayList();
kryo.writeClassAndObject(output, nodeStorage);
kryo.writeClassAndObject(output, relationshipStorage);
Код: Выделить всё
private KryoFactory factory = () ->
{
Kryo kryo = new Kryo();
kryo.register(NodeStorage.class, 100);
kryo.register(RelationshipStorage.class, 200);
// configure kryo instance, customize settings
return kryo;
};
Код: Выделить всё
KryoPool pool = new KryoPool.Builder(factory).softReferences().build();
Kryo kryo = pool.borrow();
ArrayList nodeResult = (ArrayList) kryo.readClassAndObject(input);
ArrayList relationshipResult = (ArrayList) kryo.readClassAndObject(input);
Хранилище NodeStorage и хранилище отношений содержат различные строки , int и карты с большим количеством строк.
Полный код можно найти здесь:
https:// github.com/Raycoms/thesis
Подробнее здесь: https://stackoverflow.com/questions/403 ... lass-id-44