本文整理汇总了Java中com.lmax.disruptor.RingBuffer.getBufferSize方法的典型用法代码示例。如果您正苦于以下问题:Java RingBuffer.getBufferSize方法的具体用法?Java RingBuffer.getBufferSize怎么用?Java RingBuffer.getBufferSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.lmax.disruptor.RingBuffer
的用法示例。
在下文中一共展示了RingBuffer.getBufferSize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: RingBufferConsumer
import com.lmax.disruptor.RingBuffer; //导入方法依赖的package包/类
RingBufferConsumer(@Nonnull final RingBuffer<T> buffer, @Nonnull final Object[] attachments) {
if (buffer == null) {
throw new NullPointerException("buffer == null");
}
if (attachments == null) {
throw new NullPointerException("attachments == null");
}
if (buffer.getBufferSize() != attachments.length) {
throw new IllegalArgumentException("buffer.getBufferSize() != attachments.length");
}
this.buffer = buffer;
this.attachments = attachments;
this.barrier = buffer.newBarrier();
this.sequence = new Sequence();
buffer.addGatingSequences(sequence);
this.cursor = sequence.get();
this.available = sequence.get();
}
示例2: writeWith
import com.lmax.disruptor.RingBuffer; //导入方法依赖的package包/类
public static <E> Publisher<Void> writeWith(final Publisher<? extends E> source,
final RingBuffer<MutableSignal<E>> ringBuffer) {
final NonBlocking nonBlockingSource = NonBlocking.class.isAssignableFrom(source.getClass()) ?
(NonBlocking) source :
null;
final int capacity =
nonBlockingSource != null ?
(int) Math.min(nonBlockingSource.getCapacity(), ringBuffer.getBufferSize()) :
ringBuffer.getBufferSize();
return new WriteWithPublisher<>(source, ringBuffer, capacity);
}
示例3: RingBufferProducer
import com.lmax.disruptor.RingBuffer; //导入方法依赖的package包/类
public RingBufferProducer(@Nonnull final RingBuffer<T> buffer, @Nonnull final Object[] attachments) {
if (buffer == null) {
throw new NullPointerException("buffer == null");
}
if (attachments == null) {
throw new NullPointerException("attachments == null");
}
if (buffer.getBufferSize() != attachments.length) {
throw new IllegalArgumentException("buffer.getBufferSize() != attachments.length");
}
this.buffer = buffer;
this.attachments = attachments;
}