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


Java GridUnsafe.getLong方法代码示例

本文整理汇总了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);
}
 
开发者ID:apache,项目名称:ignite,代码行数:26,代码来源:PlatformMemoryUtils.java

示例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;
}
 
开发者ID:apache,项目名称:ignite,代码行数:29,代码来源:FullPageIdTable.java

示例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;
}
 
开发者ID:apache,项目名称:ignite,代码行数:23,代码来源:FullPageIdTable.java

示例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);
}
 
开发者ID:apache,项目名称:ignite,代码行数:9,代码来源:GridUnsafeDataInput.java

示例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;
}
 
开发者ID:apache,项目名称:ignite,代码行数:13,代码来源:PageMemoryImpl.java

示例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));
}
 
开发者ID:apache,项目名称:ignite,代码行数:14,代码来源:FullPageIdTable.java

示例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);
        }
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:19,代码来源:FullPageIdTable.java

示例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;
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:31,代码来源:PageMemoryNoStoreImpl.java

示例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);
}
 
开发者ID:apache,项目名称:ignite,代码行数:7,代码来源:TrackingPageIO.java

示例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);
}
 
开发者ID:apache,项目名称:ignite,代码行数:11,代码来源:BinaryPrimitives.java

示例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);
}
 
开发者ID:apache,项目名称:ignite,代码行数:7,代码来源:BinaryOffheapInputStream.java

示例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;
}
 
开发者ID:apache,项目名称:ignite,代码行数:11,代码来源:HadoopDirectDataInput.java

示例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;
}
 
开发者ID:apache,项目名称:ignite,代码行数:11,代码来源:PlatformInputStreamImpl.java

示例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);
}
 
开发者ID:apache,项目名称:ignite,代码行数:8,代码来源:GridUnsafeMemory.java

示例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);
}
 
开发者ID:apache,项目名称:ignite,代码行数:10,代码来源:PlatformMemoryUtils.java


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