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


Java RingBuffer.getBufferSize方法代码示例

本文整理汇总了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();
}
 
开发者ID:ricardopadilha,项目名称:dsys-snio,代码行数:19,代码来源:RingBufferConsumer.java

示例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);
}
 
开发者ID:camunda,项目名称:camunda-bpm-reactor,代码行数:14,代码来源:RingBufferSubscriberUtils.java

示例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;
}
 
开发者ID:ricardopadilha,项目名称:dsys-snio,代码行数:14,代码来源:RingBufferProducer.java


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