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


Java UnsafeBuffer.addressOffset方法代码示例

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


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

示例1: TermAppender

import org.agrona.concurrent.UnsafeBuffer; //导入方法依赖的package包/类
/**
 * Construct a view over a term buffer and state buffer for appending frames.
 *
 * @param termBuffer     for where messages are stored.
 * @param metaDataBuffer for where the state of writers is stored manage concurrency.
 * @param partitionIndex for this will be the active appender.
 */
public TermAppender(final UnsafeBuffer termBuffer, final UnsafeBuffer metaDataBuffer, final int partitionIndex)
{
    final int tailCounterOffset = TERM_TAIL_COUNTERS_OFFSET + (partitionIndex * SIZE_OF_LONG);
    metaDataBuffer.boundsCheck(tailCounterOffset, SIZE_OF_LONG);

    this.termBuffer = termBuffer;
    tailBuffer = metaDataBuffer.byteArray();
    tailAddressOffset = metaDataBuffer.addressOffset() + tailCounterOffset;
}
 
开发者ID:real-logic,项目名称:aeron,代码行数:17,代码来源:TermAppender.java

示例2: ExclusiveTermAppender

import org.agrona.concurrent.UnsafeBuffer; //导入方法依赖的package包/类
/**
 * Construct a view over a term buffer and state buffer for appending frames.
 *
 * @param termBuffer     for where messages are stored.
 * @param metaDataBuffer for where the state of writers is stored manage concurrency.
 * @param partitionIndex for this will be the active appender.
 */
public ExclusiveTermAppender(
    final UnsafeBuffer termBuffer, final UnsafeBuffer metaDataBuffer, final int partitionIndex)
{
    final int tailCounterOffset = TERM_TAIL_COUNTERS_OFFSET + (partitionIndex * SIZE_OF_LONG);
    metaDataBuffer.boundsCheck(tailCounterOffset, SIZE_OF_LONG);

    this.termBuffer = termBuffer;
    tailBuffer = metaDataBuffer.byteArray();
    tailAddressOffset = metaDataBuffer.addressOffset() + tailCounterOffset;
}
 
开发者ID:real-logic,项目名称:aeron,代码行数:18,代码来源:ExclusiveTermAppender.java

示例3: UnsafeBufferPosition

import org.agrona.concurrent.UnsafeBuffer; //导入方法依赖的package包/类
/**
 * Map a position over a buffer and this indicator owns the counter for reclamation.
 *
 * @param buffer          containing the counter.
 * @param counterId       identifier of the counter.
 * @param countersManager to be used for freeing the counter when this is closed.
 */
public UnsafeBufferPosition(final UnsafeBuffer buffer, final int counterId, final CountersManager countersManager)
{
    this.counterId = counterId;
    this.countersManager = countersManager;
    this.buffer = buffer.byteArray();

    final int counterOffset = CountersManager.counterOffset(counterId);
    buffer.boundsCheck(counterOffset, SIZE_OF_LONG);
    this.addressOffset = buffer.addressOffset() + counterOffset;
}
 
开发者ID:real-logic,项目名称:agrona,代码行数:18,代码来源:UnsafeBufferPosition.java


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