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


Java GridUnsafe.getInt方法代码示例

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


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

示例1: visit

import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/**
 * @param v Visitor.
 */
public void visit(Visitor v) throws IgniteCheckedException {
    for (int i = 0; i < off;) {
        byte marker = buf[i++];

        int size = GridUnsafe.getInt(buf, GridUnsafe.BYTE_ARR_OFF + i);

        i += 4;

        if (marker == MARKER_VALUE)
            v.onValue(buf, i, size);
        else if (marker == MARKER_KEY)
            v.onKey(buf, i, size);
        else
            throw new IllegalStateException();

        i += size;
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:22,代码来源:HadoopShuffleMessage.java

示例2: getNearestAt

import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/**
 * Find nearest value from specified position to the right.
 *
 * @param idx Index to start searching from.
 * @param absent Default value that will be returned if no values present.
 * @return Closest value to the index and it's partition tag or {@code absent} and -1 if no values found.
 */
public EvictCandidate getNearestAt(final int idx, final long absent) {
    for (int i = idx; i < capacity + idx; i++) {
        final int idx2 = i >= capacity ? i - capacity : i;

        if (isValuePresentAt(idx2)) {
            long base = entryBase(idx2);

            int cacheId = GridUnsafe.getInt(base);
            int tag = GridUnsafe.getInt(base + 4);
            long pageId = GridUnsafe.getLong(base + 8);
            long val = GridUnsafe.getLong(base + 16);

            return new EvictCandidate(tag, val, new FullPageId(pageId, cacheId));
        }
    }

    return null;
}
 
开发者ID:apache,项目名称:ignite,代码行数:26,代码来源:FullPageIdTable.java

示例3: 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

示例4: 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

示例5: readIntPositioned

import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public int readIntPositioned(int pos) {
    int delta = pos + 4 - this.pos;

    if (delta > 0)
        ensureEnoughData(delta);

    return GridUnsafe.getInt(data + pos);
}
 
开发者ID:apache,项目名称:ignite,代码行数:10,代码来源:PlatformInputStreamImpl.java

示例6: readInt

import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public int readInt() throws IOException {
    fromStream(4);

    long off = BYTE_ARR_OFF + offset(4);

    return BIG_ENDIAN ? GridUnsafe.getIntLE(buf, off) : GridUnsafe.getInt(buf, off);
}
 
开发者ID:apache,项目名称:ignite,代码行数:9,代码来源:GridUnsafeDataInput.java

示例7: 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

示例8: 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

示例9: readInt

import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public int readInt() {
    lastFinished = buf.remaining() >= 4;

    if (lastFinished) {
        int pos = buf.position();

        buf.position(pos + 4);

        return GridUnsafe.getInt(heapArr, baseOff + pos);
    }
    else
        return 0;
}
 
开发者ID:apache,项目名称:ignite,代码行数:15,代码来源:DirectByteBufferStreamImplV1.java

示例10: readIntPositioned0

import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected int readIntPositioned0(int pos) {
    long addr = ptr + pos;

    return BIG_ENDIAN ? GridUnsafe.getIntLE(addr) : GridUnsafe.getInt(addr);
}
 
开发者ID:apache,项目名称:ignite,代码行数:7,代码来源:BinaryOffheapInputStream.java

示例11: readIntFast

import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected int readIntFast() {
    long addr = ptr + pos;

    return BIG_ENDIAN ? GridUnsafe.getIntLE(addr) : GridUnsafe.getInt(addr);
}
 
开发者ID:apache,项目名称:ignite,代码行数:7,代码来源:BinaryOffheapInputStream.java

示例12: readInt

import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/**
 * @param ptr Pointer.
 * @param off Offset.
 * @return Value.
 */
public static int readInt(long ptr, int off) {
    long addr = ptr + off;

    return BIG_ENDIAN ? GridUnsafe.getIntLE(addr) : GridUnsafe.getInt(addr);
}
 
开发者ID:apache,项目名称:ignite,代码行数:11,代码来源:BinaryPrimitives.java

示例13: readIntPositioned0

import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected int readIntPositioned0(int pos) {
    long off = GridUnsafe.BYTE_ARR_OFF + pos;

    return BIG_ENDIAN ? GridUnsafe.getIntLE(data, off) : GridUnsafe.getInt(data, off);
}
 
开发者ID:apache,项目名称:ignite,代码行数:7,代码来源:BinaryHeapInputStream.java

示例14: acquiredPages

import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/**
 * @return Total number of acquired pages.
 */
private int acquiredPages() {
    return GridUnsafe.getInt(acquiredPagesPtr);
}
 
开发者ID:apache,项目名称:ignite,代码行数:7,代码来源:PageMemoryImpl.java

示例15: size

import org.apache.ignite.internal.util.GridUnsafe; //导入方法依赖的package包/类
/**
 * @return Current number of entries in the map.
 */
public final int size() {
    return GridUnsafe.getInt(valPtr);
}
 
开发者ID:apache,项目名称:ignite,代码行数:7,代码来源:FullPageIdTable.java


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