本文整理汇总了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);
}
}
示例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++;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}