Apache RocketMQ 从入门到实战Integer.MAX_VALUE; } 如果启用 transientStorePoolEnable 机制,返回当前可用的 ByteBuffer 个数,即整 个 isTransientStorePoolDeficient 方法的用意是是否还存在可用的 ByteBuffer,如果不 存在,即表示 pageCache 繁忙。那什么是 transientStorePoolEnable 机制呢? 3 MappedFile 的 ByteBuffer writeBuffer、MappedByteBuffer mapped ByteBuffer 这两个属性的初始化,因为这两个方法是写消息与查消息操作的直接数据结构。 两个关键点如下: ByteBuffer writeBuffer 如果开启了 transientStorePoolEnable,则使用 ByteBuffer.allocateDirect(fileSiz eturnBuffer public void returnBuffer(ByteBuffer byteBuffer) { byteBuffer.position(0); byteBuffer.limit(fileSize); this.availableBuffers.offerFirst(byteBuffer); } 其调用栈如下: 从上面的分析看来,并不会随着消息的不断写入而导致内存溢出。0 码力 | 165 页 | 12.53 MB | 1 年前3
共 1 条
- 1













