perf[protocol]: 增加缓存提高通过class获取协议id的速度

This commit is contained in:
jaysunxiao committed 2022-06-23 23:03:48 +08:00
1 parent 795f0c7e28
commit cfc15a80be
6 files changed
+23 -12

No files matched your search

@@ -64,7 +64,7 @@ public class FileChannelMap<V extends IPacket> implements LpMap<V>, Closeable {
this.indexFileRandomAccess = new RandomAccessFile(indexFile, "rw");
this.indexFileChannel = this.indexFileRandomAccess.getChannel();
var protocolId = ProtocolManager.getProtocolIdByClass(clazz);
var protocolId = ProtocolManager.protocolId(clazz);
protocolRegistration = ProtocolManager.getProtocol(protocolId);
indexBuffer = ByteBufAllocator.DEFAULT.ioBuffer(16);
@@ -46,7 +46,7 @@ public class FileHeapMap<V extends IPacket> implements LpMap<V> {
try {
this.dbFile = FileUtils.getOrCreateFile(dbPath, StringUtils.format("{}.db", clazz.getSimpleName()));
var protocolId = ProtocolManager.getProtocolIdByClass(clazz);
var protocolId = ProtocolManager.protocolId(clazz);
protocolRegistration = ProtocolManager.getProtocol(protocolId);
heapMap = new HeapMap<>();