本文整理汇总了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;
}
示例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;
}
示例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;
}