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();