Java Code Examples for org.agrona.concurrent.AtomicBuffer#byteBuffer()
The following examples show how to use
org.agrona.concurrent.AtomicBuffer#byteBuffer() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AtomicCounter.java From agrona with Apache License 2.0 | 5 votes |
/** * Map a counter over a buffer. This version will free the counter on close. * * @param buffer containing the counter. * @param counterId identifier for the counter. * @param countersManager to be called to free the counter on close. */ public AtomicCounter(final AtomicBuffer buffer, final int counterId, final CountersManager countersManager) { this.id = counterId; this.countersManager = countersManager; this.byteBuffer = buffer.byteBuffer(); this.byteArray = buffer.byteArray(); final int counterOffset = CountersManager.counterOffset(counterId); buffer.boundsCheck(counterOffset, SIZE_OF_LONG); this.addressOffset = buffer.addressOffset() + counterOffset; }
Example 2
Source File: UnsafeBufferStatusIndicator.java From agrona with Apache License 2.0 | 5 votes |
/** * Map a status indicator over a buffer. * * @param buffer containing the indicator. * @param counterId identifier of the indicator. */ public UnsafeBufferStatusIndicator(final AtomicBuffer buffer, final int counterId) { this.counterId = counterId; this.byteArray = buffer.byteArray(); this.byteBuffer = buffer.byteBuffer(); final int counterOffset = CountersManager.counterOffset(counterId); buffer.boundsCheck(counterOffset, SIZE_OF_LONG); this.addressOffset = buffer.addressOffset() + counterOffset; }