- 我想开启rocketmq的异步刷盘,所以在broker.conf中配置transientstorepoolenable = true
- RocketMQ启动Broker时出现问题
- 我试图替换 msvcrt.dll 但它似乎没有用
系统环境:windows 10
RocketMQ中的代码抛出异常:
LibC INSTANCE = (LibC) Native.loadLibrary(Platform.isWindows() ? "msvcrt" : "c", LibC.class);
public void init() {
for (int i = 0; i < poolSize; i++) {
ByteBuffer byteBuffer = ByteBuffer.allocateDirect(fileSize);
final long address = ((DirectBuffer) byteBuffer).address();
Pointer pointer = new Pointer(address);
this line ==> LibC.INSTANCE.mlock(pointer, new NativeLong(fileSize));
availableBuffers.offer(byteBuffer);
}
}
错误信息:
java.lang.UnsatisfiedLinkError: Error looking up function 'mlock': The specified program cannot be found。
at com.sun.jna.Function.<init>(Function.java:212)
at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:541)
at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:518)
at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:504)
at com.sun.jna.Library$Handler.invoke(Library.java:220)
at com.sun.proxy.$Proxy0.mlock(Unknown Source)
at org.apache.rocketmq.store.TransientStorePool.init(TransientStorePool.java:58)
at org.apache.rocketmq.store.DefaultMessageStore.<init>(DefaultMessageStore.java:153)
at org.apache.rocketmq.broker.BrokerController.initialize(BrokerController.java:243)
at org.apache.rocketmq.broker.BrokerStartup.createBrokerController(BrokerStartup.java:228)
at org.apache.rocketmq.broker.BrokerStartup.main(BrokerStartup.java:58)