当前位置: 首页>>代码示例>>Java>>正文


Java Cleaner.clean方法代码示例

本文整理汇总了Java中sun.misc.Cleaner.clean方法的典型用法代码示例。如果您正苦于以下问题:Java Cleaner.clean方法的具体用法?Java Cleaner.clean怎么用?Java Cleaner.clean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sun.misc.Cleaner的用法示例。


在下文中一共展示了Cleaner.clean方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: shutdown

import sun.misc.Cleaner; //导入方法依赖的package包/类
public void shutdown() {
    removeMonitoring();
    writeQ.clear();
    readQ.clear();
    inputQueue.clear();
    try {
        // Cleanup the ByteBuffers only if they are sun.nio.ch.DirectBuffer
        // If we don't cleanup then we will leak 16K of memory
        if (getRbuf() instanceof DirectBuffer) {
            Cleaner cleaner = ((DirectBuffer) getRbuf()).cleaner();
            if (cleaner != null) cleaner.clean();
            cleaner = ((DirectBuffer) getWbuf()).cleaner();
            if (cleaner != null) cleaner.clean();
        }
    } catch (Throwable t) {
        getLogger().error("Exception cleaning ByteBuffer.", t);
    }
}
 
开发者ID:Netflix,项目名称:EVCache,代码行数:19,代码来源:EVCacheNodeImpl.java

示例2: close

import sun.misc.Cleaner; //导入方法依赖的package包/类
@Override
public void close() throws IOException {
    channel.close();
    if (PlatformUtil.IS_WINDOWS) {
        final Cleaner cleaner = ((DirectBuffer) this.buffer).cleaner();
        if (cleaner != null) {
            cleaner.clean();
        }
    }
}
 
开发者ID:daten-io,项目名称:faster,代码行数:11,代码来源:MmapFile.java

示例3: free

import sun.misc.Cleaner; //导入方法依赖的package包/类
public static void free(ByteBuffer buffer) {
    if (buffer.isDirect()) {
        Cleaner cleaner = ((DirectBuffer) buffer).cleaner();
        if (cleaner != null) {
            cleaner.clean();
        }
    }
}
 
开发者ID:shunfei,项目名称:indexr,代码行数:9,代码来源:ByteBufferUtil.java

示例4: clean

import sun.misc.Cleaner; //导入方法依赖的package包/类
private void clean(MappedByteBuffer mapping) {
    if (mapping == null) {
        return;
    }
    Cleaner cleaner = ((DirectBuffer) mapping).cleaner();
    if (cleaner != null) {
        cleaner.clean();
    }
}
 
开发者ID:rafaelmss,项目名称:GraphClustering,代码行数:10,代码来源:MatrixFile.java

示例5: freeDirectBuffer

import sun.misc.Cleaner; //导入方法依赖的package包/类
static void freeDirectBuffer(ByteBuffer buffer) {
    if (CLEANER_FIELD_OFFSET == -1 || !buffer.isDirect()) {
        return;
    }
    try {
        Cleaner cleaner = (Cleaner) PlatformDependent0.getObject(buffer, CLEANER_FIELD_OFFSET);
        if (cleaner != null) {
            cleaner.clean();
        }
    } catch (Throwable t) {
        // Nothing we can do here.
    }
}
 
开发者ID:wuyinxian124,项目名称:netty4.0.27Learn,代码行数:14,代码来源:Cleaner0.java

示例6: free

import sun.misc.Cleaner; //导入方法依赖的package包/类
@Override
public void free() {
  Cleaner cleaner = ((DirectBuffer) buffer).cleaner();
  if (cleaner != null)
    cleaner.clean();
  ((MappedMemoryAllocator) allocator).release();
}
 
开发者ID:atomix,项目名称:catalyst,代码行数:8,代码来源:MappedMemory.java

示例7: close

import sun.misc.Cleaner; //导入方法依赖的package包/类
public static void close( MappedByteBuffer buffer ) {
    try {
        if( cleanerField == null ) {
            synchronized( Closeables.class ) {
                if( cleanerField == null ) init();
            }
        }
        Cleaner cleaner = ( Cleaner ) cleanerField.get( buffer );
        cleaner.clean();
    } catch( IllegalAccessException e ) {
        logger.warn( e.getMessage(), e );
    }
}
 
开发者ID:oaplatform,项目名称:oap,代码行数:14,代码来源:Closeables.java

示例8: freeDirectBuffer

import sun.misc.Cleaner; //导入方法依赖的package包/类
static void freeDirectBuffer(ByteBuffer buffer) {
    if (CLEANER_FIELD == null) {
        return;
    }
    try {
        Cleaner cleaner = (Cleaner) CLEANER_FIELD.get(buffer);
        if (cleaner == null) {
            throw new IllegalArgumentException(
                    "attempted to deallocate the buffer which was allocated via JNIEnv->NewDirectByteBuffer()");
        }
        cleaner.clean();
    } catch (Throwable t) {
        // Nothing we can do here.
    }
}
 
开发者ID:kyle-liu,项目名称:netty4study,代码行数:16,代码来源:PlatformDependent0.java

示例9: destroy

import sun.misc.Cleaner; //导入方法依赖的package包/类
/**
 * Destroys this allocation
 */
void destroy() {
	if(block instanceof DirectBuffer) {
		Cleaner cleaner = ((DirectBuffer)block).cleaner();
		if(cleaner!=null) cleaner.clean();
		// leave the accounting for the RefQueue processor
	}
}
 
开发者ID:nickman,项目名称:UnsafeAdapter,代码行数:11,代码来源:SafeMemoryAllocator.java

示例10: deallocate

import sun.misc.Cleaner; //导入方法依赖的package包/类
private void deallocate(ByteBuffer byteBuffer) {
    if (byteBuffer == null) {
        return;
    }

    if (byteBuffer instanceof DirectBuffer) {
        Cleaner cleaner = ((DirectBuffer) byteBuffer).cleaner();
        if (cleaner != null) {
            cleaner.clean();
        }
    }
}
 
开发者ID:naver,项目名称:pinpoint,代码行数:13,代码来源:ByteBufferOutputStream.java

示例11: unmap

import sun.misc.Cleaner; //导入方法依赖的package包/类
private static void unmap(MappedByteBuffer bb) {
    Cleaner cl = ((DirectBuffer)bb).cleaner();
    if (cl != null)
        cl.clean();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:6,代码来源:FileChannelImpl.java

示例12: unmap

import sun.misc.Cleaner; //导入方法依赖的package包/类
private static void unmap(MappedByteBuffer buffer) {
    Cleaner cleaner = ((DirectBuffer) buffer).cleaner();
    cleaner.clean(); // If file was memory mapped then windows does not allow to delete it
}
 
开发者ID:andymalakov,项目名称:f1x,代码行数:5,代码来源:Test_MemoryMappedSessionState.java

示例13: destroy

import sun.misc.Cleaner; //导入方法依赖的package包/类
@TearDown
public void destroy() throws IOException {
    Cleaner cleaner = ((DirectBuffer) memoryMappedSessionState.buffer).cleaner();
    cleaner.clean(); // If file was memory mapped then windows does not allow to delete it
    Files.deleteIfExists(tempFile);
}
 
开发者ID:andymalakov,项目名称:f1x,代码行数:7,代码来源:Benchmark_SessionStates.java


注:本文中的sun.misc.Cleaner.clean方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。