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


Java DirectBuffer.address方法代码示例

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


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

示例1: recycle

import sun.nio.ch.DirectBuffer; //导入方法依赖的package包/类
public void recycle(ByteBuffer theBuf) {
	if(!(theBuf instanceof DirectBuffer)){
		theBuf.clear();
		return;
	}

	final long size = theBuf.capacity();

    boolean recycled = false;
    DirectBuffer thisNavBuf = (DirectBuffer) theBuf;
    int chunkCount = theBuf.capacity() / chunkSize;
    DirectBuffer parentBuf = (DirectBuffer) thisNavBuf.attachment();
    int startChunk = (int) ((thisNavBuf.address() - parentBuf.address()) / this.chunkSize);
    for (int i = 0; i < allPages.length; i++) {
        if ((recycled = allPages[i].recycleBuffer((ByteBuffer) parentBuf, startChunk, chunkCount) == true)) {
            break;
        }
    }
    final long threadId = Thread.currentThread().getId();

    if (memoryUsage.containsKey(threadId)){
        memoryUsage.put(threadId,memoryUsage.get(threadId)-size);
    }
    if (recycled == false) {
        LOGGER.warn("warning ,not recycled buffer " + theBuf);
    }
}
 
开发者ID:huang-up,项目名称:mycat-src-1.6.1-RELEASE,代码行数:28,代码来源:DirectByteBufferPool.java

示例2: recycle

import sun.nio.ch.DirectBuffer; //导入方法依赖的package包/类
@Override
  public void recycle(ByteBuffer theBuf) {
  	
    	if(theBuf !=null && (!(theBuf instanceof DirectBuffer) )){
  		theBuf.clear();
  		return;
       }

    	final long size = theBuf.capacity();
boolean recycled = false;
DirectBuffer thisNavBuf = (DirectBuffer) theBuf;
int chunkCount = theBuf.capacity() / chunkSize;
DirectBuffer parentBuf = (DirectBuffer) thisNavBuf.attachment();
int startChunk = (int) ((thisNavBuf.address() - parentBuf.address()) / chunkSize);
for (int i = 0; i < allPages.length; i++) {
	if ((recycled = allPages[i].recycleBuffer((ByteBuffer) parentBuf, startChunk,chunkCount) == true)) {
		break;
	}
}

final long threadId = Thread.currentThread().getId();
if (memoryUsage.containsKey(threadId)) {
	memoryUsage.put(threadId, memoryUsage.get(threadId) - size);
}

if (recycled == false) {
	LOGGER.warn("warning , not recycled buffer " + theBuf);
}

sharedOptsCount++;	
  }
 
开发者ID:variflight,项目名称:feeyo-redisproxy,代码行数:32,代码来源:ByteBufferPagePool.java

示例3: recycle

import sun.nio.ch.DirectBuffer; //导入方法依赖的package包/类
public void recycle(ByteBuffer theBuf) {
    if (!(theBuf instanceof DirectBuffer)) {
        theBuf.clear();
        return;
    }

    final long size = theBuf.capacity();

    boolean recycled = false;
    DirectBuffer thisNavBuf = (DirectBuffer) theBuf;
    int chunkCount = theBuf.capacity() / chunkSize;
    DirectBuffer parentBuf = (DirectBuffer) thisNavBuf.attachment();
    int startChunk = (int) ((thisNavBuf.address() - parentBuf.address()) / this.chunkSize);
    for (ByteBufferPage allPage : allPages) {
        if ((recycled = allPage.recycleBuffer((ByteBuffer) parentBuf, startChunk, chunkCount))) {
            break;
        }
    }
    final long threadId = Thread.currentThread().getId();

    if (memoryUsage.containsKey(threadId)) {
        memoryUsage.put(threadId, memoryUsage.get(threadId) - size);
    }
    if (!recycled) {
        LOGGER.info("warning ,not recycled buffer " + theBuf);
    }
}
 
开发者ID:actiontech,项目名称:dble,代码行数:28,代码来源:DirectByteBufferPool.java

示例4: DirectFloatBufferU

import sun.nio.ch.DirectBuffer; //导入方法依赖的package包/类
DirectFloatBufferU(DirectBuffer db,         // package-private
                           int mark, int pos, int lim, int cap,
                           int off)
{

    super(mark, pos, lim, cap);
    address = db.address() + off;



    att = db;



}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:DirectFloatBufferU.java

示例5: DirectShortBufferU

import sun.nio.ch.DirectBuffer; //导入方法依赖的package包/类
DirectShortBufferU(DirectBuffer db,         // package-private
                           int mark, int pos, int lim, int cap,
                           int off)
{

    super(mark, pos, lim, cap);
    address = db.address() + off;



    att = db;



}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:DirectShortBufferU.java

示例6: DirectCharBufferS

import sun.nio.ch.DirectBuffer; //导入方法依赖的package包/类
DirectCharBufferS(DirectBuffer db,         // package-private
                           int mark, int pos, int lim, int cap,
                           int off)
{

    super(mark, pos, lim, cap);
    address = db.address() + off;



    att = db;



}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:DirectCharBufferS.java

示例7: DirectLongBufferS

import sun.nio.ch.DirectBuffer; //导入方法依赖的package包/类
DirectLongBufferS(DirectBuffer db,         // package-private
                           int mark, int pos, int lim, int cap,
                           int off)
{

    super(mark, pos, lim, cap);
    address = db.address() + off;



    att = db;



}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:DirectLongBufferS.java

示例8: DirectShortBufferS

import sun.nio.ch.DirectBuffer; //导入方法依赖的package包/类
DirectShortBufferS(DirectBuffer db,         // package-private
                           int mark, int pos, int lim, int cap,
                           int off)
{

    super(mark, pos, lim, cap);
    address = db.address() + off;



    att = db;



}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:DirectShortBufferS.java

示例9: DirectByteBuffer

import sun.nio.ch.DirectBuffer; //导入方法依赖的package包/类
DirectByteBuffer(DirectBuffer db,         // package-private
                           int mark, int pos, int lim, int cap,
                           int off)
{

    super(mark, pos, lim, cap);
    address = db.address() + off;

    cleaner = null;

    att = db;



}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:DirectByteBuffer.java

示例10: DirectIntBufferS

import sun.nio.ch.DirectBuffer; //导入方法依赖的package包/类
DirectIntBufferS(DirectBuffer db,         // package-private
                           int mark, int pos, int lim, int cap,
                           int off)
{

    super(mark, pos, lim, cap);
    address = db.address() + off;



    att = db;



}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:DirectIntBufferS.java

示例11: DirectCharBufferU

import sun.nio.ch.DirectBuffer; //导入方法依赖的package包/类
DirectCharBufferU(DirectBuffer db,         // package-private
                           int mark, int pos, int lim, int cap,
                           int off)
{

    super(mark, pos, lim, cap);
    address = db.address() + off;



    att = db;



}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:DirectCharBufferU.java

示例12: DirectIntBufferU

import sun.nio.ch.DirectBuffer; //导入方法依赖的package包/类
DirectIntBufferU(DirectBuffer db,         // package-private
                           int mark, int pos, int lim, int cap,
                           int off)
{

    super(mark, pos, lim, cap);
    address = db.address() + off;



    att = db;



}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:DirectIntBufferU.java

示例13: DirectFloatBufferS

import sun.nio.ch.DirectBuffer; //导入方法依赖的package包/类
DirectFloatBufferS(DirectBuffer db,         // package-private
                           int mark, int pos, int lim, int cap,
                           int off)
{

    super(mark, pos, lim, cap);
    address = db.address() + off;



    att = db;



}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:DirectFloatBufferS.java

示例14: DirectLongBufferU

import sun.nio.ch.DirectBuffer; //导入方法依赖的package包/类
DirectLongBufferU(DirectBuffer db,         // package-private
                           int mark, int pos, int lim, int cap,
                           int off)
{

    super(mark, pos, lim, cap);
    address = db.address() + off;



    att = db;



}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:DirectLongBufferU.java

示例15: DirectDoubleBufferU

import sun.nio.ch.DirectBuffer; //导入方法依赖的package包/类
DirectDoubleBufferU(DirectBuffer db,         // package-private
                           int mark, int pos, int lim, int cap,
                           int off)
{

    super(mark, pos, lim, cap);
    address = db.address() + off;



    att = db;



}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:DirectDoubleBufferU.java


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