From 3cdf9b6131f4124536e2646602675be422993e9f Mon Sep 17 00:00:00 2001 From: jaysunxiao Date: Sat, 28 Aug 2021 12:39:48 +0800 Subject: [PATCH] =?UTF-8?q?fix[orm]:=20=E4=BF=AE=E5=A4=8DFileChannelMap?= =?UTF-8?q?=E7=A9=BA=E6=8C=87=E9=92=88=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- orm/src/main/java/com/zfoo/orm/lpmap/FileChannelMap.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/orm/src/main/java/com/zfoo/orm/lpmap/FileChannelMap.java b/orm/src/main/java/com/zfoo/orm/lpmap/FileChannelMap.java index 4cddba71..369794ee 100644 --- a/orm/src/main/java/com/zfoo/orm/lpmap/FileChannelMap.java +++ b/orm/src/main/java/com/zfoo/orm/lpmap/FileChannelMap.java @@ -66,13 +66,13 @@ public class FileChannelMap implements LpMap, Closeable { indexFileRandomAccess.writeLong(0L); } - maxIndex = readMaxIndex(); - var protocolId = ProtocolAnalysis.getProtocolIdByClass(clazz); protocolRegistration = ProtocolManager.getProtocol(protocolId); indexBuffer = ByteBufAllocator.DEFAULT.ioBuffer(16); dbBuffer = ByteBufAllocator.DEFAULT.ioBuffer(100); + + maxIndex = readMaxIndex(); } catch (Exception e) { throw new RuntimeException(e); } @@ -120,6 +120,7 @@ public class FileChannelMap implements LpMap, Closeable { } try { + clearByteBuf(); indexBuffer.writeBytes(indexFileChannel, key * 16L, 16); var packetPosition = indexBuffer.readLong(); var packetSize = indexBuffer.readLong();