本文整理匯總了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;
}