本文整理汇总了Java中org.apache.ignite.internal.util.GridUnsafe.getLong方法的典型用法代码示例。如果您正苦于以下问题:Java GridUnsafe.getLong方法的具体用法?Java GridUnsafe.getLong怎么用?Java GridUnsafe.getLong使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ignite.internal.util.GridUnsafe
的用法示例。
在下文中一共展示了GridUnsafe.getLong方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: releasePool
import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/**
* Release pool memory.
*
* @param poolPtr Pool pointer.
*/
public static void releasePool(long poolPtr) {
// Clean predefined memory chunks.
long mem = GridUnsafe.getLong(poolPtr + POOL_HDR_OFF_MEM_1);
if (mem != 0)
GridUnsafe.freeMemory(mem);
mem = GridUnsafe.getLong(poolPtr + POOL_HDR_OFF_MEM_2);
if (mem != 0)
GridUnsafe.freeMemory(mem);
mem = GridUnsafe.getLong(poolPtr + POOL_HDR_OFF_MEM_3);
if (mem != 0)
GridUnsafe.freeMemory(mem);
// Clean pool chunk.
GridUnsafe.freeMemory(poolPtr);
}
示例2: clearAt
import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/**
* @param idx Index to clear value at.
* @param pred Test predicate.
* @param absent Value to return if the cell is empty.
* @return Value at the given index.
*/
public long clearAt(int idx, GridPredicate3<Integer, Long, Integer> pred, long absent) {
long base = entryBase(idx);
int grpId = GridUnsafe.getInt(base);
int tag = GridUnsafe.getInt(base + 4);
long pageId = GridUnsafe.getLong(base + 8);
if ((pageId == REMOVED_PAGE_ID && grpId == REMOVED_CACHE_GRP_ID)
|| (pageId == EMPTY_PAGE_ID && grpId == EMPTY_CACHE_GRP_ID))
return absent;
if (pred.apply(grpId, pageId, tag)) {
long res = valueAt(idx);
setKeyAt(idx, REMOVED_CACHE_GRP_ID, REMOVED_PAGE_ID);
setValueAt(idx, 0);
return res;
}
else
return absent;
}
示例3: testKeyAt
import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/**
* @param index Entry index.
* @return Key value.
*/
private int testKeyAt(int index, int testCacheId, long testPageId, int testTag) {
long base = entryBase(index);
int grpId = GridUnsafe.getInt(base);
int tag = GridUnsafe.getInt(base + 4);
long pageId = GridUnsafe.getLong(base + 8);
if (pageId == REMOVED_PAGE_ID && grpId == REMOVED_CACHE_GRP_ID)
return REMOVED;
else if (pageId == testPageId && grpId == testCacheId && tag >= testTag)
return EQUAL;
else if (pageId == testPageId && grpId == testCacheId && tag < testTag)
return OUTDATED;
else if (pageId == EMPTY_PAGE_ID && grpId == EMPTY_CACHE_GRP_ID)
return EMPTY;
else
return NOT_EQUAL;
}
示例4: readLong
import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public long readLong() throws IOException {
fromStream(8);
long off = BYTE_ARR_OFF + offset(8);
return BIG_ENDIAN ? GridUnsafe.getLongLE(buf, off) : GridUnsafe.getLong(buf, off);
}
示例5: readTimestamp
import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/**
* Read for timestamp from page in {@code absAddr} address.
*
* @param absPtr Absolute page address.
* @return Timestamp.
*/
private static long readTimestamp(final long absPtr) {
long markerAndTs = GridUnsafe.getLong(absPtr);
// Clear last byte as it is occupied by page marker.
return markerAndTs & ~0xFF;
}
示例6: isValuePresentAt
import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/**
* @param idx Index to test.
* @return {@code True} if value set for index.
*/
private boolean isValuePresentAt(final int idx) {
long base = entryBase(idx);
int grpId = GridUnsafe.getInt(base);
long pageId = GridUnsafe.getLong(base + 8);
return !((pageId == REMOVED_PAGE_ID && grpId == REMOVED_CACHE_GRP_ID)
|| (pageId == EMPTY_PAGE_ID && grpId == EMPTY_CACHE_GRP_ID));
}
示例7: visitAll
import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/**
* Scans all the elements in this table.
*
* @param visitor Visitor.
*/
public void visitAll(IgniteBiInClosure<FullPageId, Long> visitor) {
for (int i = 0; i < capacity; i++) {
if (isValuePresentAt(i)) {
long base = entryBase(i);
int cacheId = GridUnsafe.getInt(base);
long pageId = GridUnsafe.getLong(base + 8);
long val = GridUnsafe.getLong(base + 16);
visitor.apply(new FullPageId(pageId, cacheId), val);
}
}
}
示例8: borrowFreePage
import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/**
* @return Relative pointer to a free page that was borrowed from the allocated pool.
*/
private long borrowFreePage() {
while (true) {
long freePageRelPtrMasked = freePageListHead.get();
long freePageRelPtr = freePageRelPtrMasked & ADDRESS_MASK;
if (freePageRelPtr != INVALID_REL_PTR) {
int pageIdx = PageIdUtils.pageIndex(freePageRelPtr);
Segment seg = segment(pageIdx);
long freePageAbsPtr = seg.absolute(pageIdx);
long nextFreePageRelPtr = GridUnsafe.getLong(freePageAbsPtr) & ADDRESS_MASK;
long cnt = ((freePageRelPtrMasked & COUNTER_MASK) + COUNTER_INC) & COUNTER_MASK;
if (freePageListHead.compareAndSet(freePageRelPtrMasked, nextFreePageRelPtr | cnt)) {
GridUnsafe.putLong(freePageAbsPtr, PAGE_MARKER);
allocatedPages.incrementAndGet();
return freePageRelPtr;
}
}
else
return INVALID_REL_PTR;
}
}
示例9: getLastSnapshotTag
import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/**
* @param addr Address.
*/
long getLastSnapshotTag(long addr) {
return GridUnsafe.getLong(addr + LAST_SNAPSHOT_TAG_OFFSET);
}
示例10: readLong
import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/**
* @param arr Array.
* @param off Offset.
* @return Value.
*/
public static long readLong(byte[] arr, int off) {
long pos = GridUnsafe.BYTE_ARR_OFF + off;
return BIG_ENDIAN ? GridUnsafe.getLongLE(arr, pos) : GridUnsafe.getLong(arr, pos);
}
示例11: readLongFast
import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected long readLongFast() {
long addr = ptr + pos;
return BIG_ENDIAN ? GridUnsafe.getLongLE(addr) : GridUnsafe.getLong(addr);
}
示例12: readLong
import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public long readLong() throws IOException {
checkRange(8);
long res = GridUnsafe.getLong(buf, BYTE_ARR_OFF + pos);
pos += 8;
return res;
}
示例13: readLong
import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public long readLong() {
ensureEnoughData(8);
long res = GridUnsafe.getLong(data + pos);
shift(8);
return res;
}
示例14: readLong
import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/**
* @param ptr Pointer.
* @return Long value.
*/
public long readLong(long ptr) {
return GridUnsafe.getLong(ptr);
}
示例15: data
import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/**
* Gets data pointer for the given memory chunk.
*
* @param memPtr Memory pointer.
* @return Data pointer.
*/
public static long data(long memPtr) {
return GridUnsafe.getLong(memPtr);
}