org.apache.rocketmq.store.util.LibC Java Examples

The following examples show how to use org.apache.rocketmq.store.util.LibC. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TransientStorePool.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
/**
 * It's a heavy init method.
 */
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);
        LibC.INSTANCE.mlock(pointer, new NativeLong(fileSize));

        availableBuffers.offer(byteBuffer);
    }
}
 
Example #2
Source File: MappedFile.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
public void munlock() {
    final long beginTime = System.currentTimeMillis();
    final long address = ((DirectBuffer) (this.mappedByteBuffer)).address();
    Pointer pointer = new Pointer(address);
    int ret = LibC.INSTANCE.munlock(pointer, new NativeLong(this.fileSize));
    log.info("munlock {} {} {} ret = {} time consuming = {}", address, this.fileName, this.fileSize, ret, System.currentTimeMillis() - beginTime);
}
 
Example #3
Source File: TransientStorePool.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
public void destroy() {
    for (ByteBuffer byteBuffer : availableBuffers) {
        final long address = ((DirectBuffer) byteBuffer).address();
        Pointer pointer = new Pointer(address);
        LibC.INSTANCE.munlock(pointer, new NativeLong(fileSize));
    }
}
 
Example #4
Source File: TransientStorePool.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
/**
 * It's a heavy init method.
 */
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);
        LibC.INSTANCE.mlock(pointer, new NativeLong(fileSize));

        availableBuffers.offer(byteBuffer);
    }
}
 
Example #5
Source File: MappedFile.java    From rocketmq_trans_message with Apache License 2.0 5 votes vote down vote up
public void munlock() {
    final long beginTime = System.currentTimeMillis();
    final long address = ((DirectBuffer) (this.mappedByteBuffer)).address();
    Pointer pointer = new Pointer(address);
    int ret = LibC.INSTANCE.munlock(pointer, new NativeLong(this.fileSize));
    log.info("munlock {} {} {} ret = {} time consuming = {}", address, this.fileName, this.fileSize, ret, System.currentTimeMillis() - beginTime);
}
 
Example #6
Source File: TransientStorePool.java    From rocketmq_trans_message with Apache License 2.0 5 votes vote down vote up
public void destroy() {
    for (ByteBuffer byteBuffer : availableBuffers) {
        final long address = ((DirectBuffer) byteBuffer).address();
        Pointer pointer = new Pointer(address);
        LibC.INSTANCE.munlock(pointer, new NativeLong(fileSize));
    }
}
 
Example #7
Source File: TransientStorePool.java    From rocketmq_trans_message with Apache License 2.0 5 votes vote down vote up
/**
 * It's a heavy init method.
 */
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);
        LibC.INSTANCE.mlock(pointer, new NativeLong(fileSize));

        availableBuffers.offer(byteBuffer);
    }
}
 
Example #8
Source File: MappedFile.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 5 votes vote down vote up
public void munlock() {
    final long beginTime = System.currentTimeMillis();
    final long address = ((DirectBuffer) (this.mappedByteBuffer)).address();
    Pointer pointer = new Pointer(address);
    int ret = LibC.INSTANCE.munlock(pointer, new NativeLong(this.fileSize));
    log.info("munlock {} {} {} ret = {} time consuming = {}", address, this.fileName, this.fileSize, ret, System.currentTimeMillis() - beginTime);
}
 
Example #9
Source File: TransientStorePool.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 5 votes vote down vote up
public void destroy() {
    for (ByteBuffer byteBuffer : availableBuffers) {
        final long address = ((DirectBuffer) byteBuffer).address();
        Pointer pointer = new Pointer(address);
        LibC.INSTANCE.munlock(pointer, new NativeLong(fileSize));
    }
}
 
Example #10
Source File: TransientStorePool.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 5 votes vote down vote up
/**
 * It's a heavy init method.
 */
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);
        LibC.INSTANCE.mlock(pointer, new NativeLong(fileSize));

        availableBuffers.offer(byteBuffer);
    }
}
 
Example #11
Source File: MappedFile.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
public void munlock() {
    final long beginTime = System.currentTimeMillis();
    final long address = ((DirectBuffer) (this.mappedByteBuffer)).address();
    Pointer pointer = new Pointer(address);
    int ret = LibC.INSTANCE.munlock(pointer, new NativeLong(this.fileSize));
    log.info("munlock {} {} {} ret = {} time consuming = {}", address, this.fileName, this.fileSize, ret, System.currentTimeMillis() - beginTime);
}
 
Example #12
Source File: TransientStorePool.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
public void destroy() {
    for (ByteBuffer byteBuffer : availableBuffers) {
        final long address = ((DirectBuffer) byteBuffer).address();
        Pointer pointer = new Pointer(address);
        LibC.INSTANCE.munlock(pointer, new NativeLong(fileSize));
    }
}
 
Example #13
Source File: TransientStorePool.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
/**
 * It's a heavy init method.
 */
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);
        LibC.INSTANCE.mlock(pointer, new NativeLong(fileSize));

        availableBuffers.offer(byteBuffer);
    }
}
 
Example #14
Source File: MappedFile.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
public void munlock() {
    final long beginTime = System.currentTimeMillis();
    final long address = ((DirectBuffer)(this.mappedByteBuffer)).address();
    Pointer pointer = new Pointer(address);
    int ret = LibC.INSTANCE.munlock(pointer, new NativeLong(this.fileSize));
    log.info("munlock {} {} {} ret = {} time consuming = {}", address, this.fileName, this.fileSize, ret, System.currentTimeMillis() - beginTime);
}
 
Example #15
Source File: TransientStorePool.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
public void destroy() {
    for (ByteBuffer byteBuffer : availableBuffers) {
        final long address = ((DirectBuffer) byteBuffer).address();
        Pointer pointer = new Pointer(address);
        LibC.INSTANCE.munlock(pointer, new NativeLong(fileSize));
    }
}
 
Example #16
Source File: TransientStorePool.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
/**
 * It's a heavy init method.
 */
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);
        LibC.INSTANCE.mlock(pointer, new NativeLong(fileSize));

        availableBuffers.offer(byteBuffer);
    }
}
 
Example #17
Source File: MappedFile.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
/**
 * unlock系统调用
 */
public void munlock() {
    final long beginTime = System.currentTimeMillis();
    final long address = ((DirectBuffer) (this.mappedByteBuffer)).address();
    Pointer pointer = new Pointer(address);
    int ret = LibC.INSTANCE.munlock(pointer, new NativeLong(this.fileSize));
    log.info("munlock {} {} {} ret = {} time consuming = {}", address, this.fileName, this.fileSize, ret, System.currentTimeMillis() - beginTime);
}
 
Example #18
Source File: TransientStorePool.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
/**
 * 销毁:执行unlock系统调用
 */
public void destroy() {
    for (ByteBuffer byteBuffer : availableBuffers) {
        final long address = ((DirectBuffer) byteBuffer).address();
        Pointer pointer = new Pointer(address);
        LibC.INSTANCE.munlock(pointer, new NativeLong(fileSize));
    }
}
 
Example #19
Source File: TransientStorePool.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
/**
 * It's a heavy init method.
 * 初始化操作,比较重
 */
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);
        LibC.INSTANCE.mlock(pointer, new NativeLong(fileSize));
        availableBuffers.offer(byteBuffer);
    }
}
 
Example #20
Source File: MappedFile.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
public void munlock() {
    final long beginTime = System.currentTimeMillis();
    final long address = ((DirectBuffer) (this.mappedByteBuffer)).address();
    Pointer pointer = new Pointer(address);
    int ret = LibC.INSTANCE.munlock(pointer, new NativeLong(this.fileSize));
    log.info("munlock {} {} {} ret = {} time consuming = {}", address, this.fileName, this.fileSize, ret, System.currentTimeMillis() - beginTime);
}
 
Example #21
Source File: TransientStorePool.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
public void destroy() {
    for (ByteBuffer byteBuffer : availableBuffers) {
        final long address = ((DirectBuffer) byteBuffer).address();
        Pointer pointer = new Pointer(address);
        LibC.INSTANCE.munlock(pointer, new NativeLong(fileSize));
    }
}
 
Example #22
Source File: TransientStorePool.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
/**
     * It's a heavy init method.
     */
//
    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);
            LibC.INSTANCE.mlock(pointer, new NativeLong(fileSize));

            availableBuffers.offer(byteBuffer);
        }
    }
 
Example #23
Source File: MappedFile.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
public void munlock() {
    final long beginTime = System.currentTimeMillis();
    final long address = ((DirectBuffer) (this.mappedByteBuffer)).address();
    Pointer pointer = new Pointer(address);
    int ret = LibC.INSTANCE.munlock(pointer, new NativeLong(this.fileSize));
    log.info("munlock {} {} {} ret = {} time consuming = {}", address, this.fileName, this.fileSize, ret, System.currentTimeMillis() - beginTime);
}
 
Example #24
Source File: TransientStorePool.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
public void destroy() {
    for (ByteBuffer byteBuffer : availableBuffers) {
        final long address = ((DirectBuffer) byteBuffer).address();
        Pointer pointer = new Pointer(address);
        LibC.INSTANCE.munlock(pointer, new NativeLong(fileSize));
    }
}