java.lang.Object
cn.wjybxx.disruptor.RingBufferEventSequencer<T>
- 所有已实现的接口:
DataProvider<T>,EventSequencer<T>
- 作者:
- wjybxx date - 2024/1/17
-
嵌套类概要
嵌套类 -
字段概要
从接口继承的字段 cn.wjybxx.disruptor.EventSequencer
UNBOUNDED_CAPACITY -
方法概要
修饰符和类型方法说明intcapacity()数据结构大小 1.如果为【无界】数据结构,则返回-1; 2.如果为【有界】数据结构,则返回真实值。final TconsumerGet(long sequence) 该接口用于优化消费者查询数据voidconsumerSet(long sequence, T data) 该接口用于消费者覆盖数据(通常用于删除数据) 1.当使用无界队列需要即时清理内存时使用。数据提供者final Tget(long sequence) 根据指定序号获取data 该接口可用于生产者和消费者获取数据,但对于非固定大小的数据结构而言,可能有较长的查询路径。booleanhasAvailableCapacity(int requiredCapacity) static <T> RingBufferEventSequencer.Builder<T> newMultiProducer(EventFactory<? extends T> factory) 多线程生产者builderstatic <T> RingBufferEventSequencer.Builder<T> newSingleProducer(EventFactory<? extends T> factory) 单线程生产者builderlongnext()longnext(int n) longlongnextInterruptibly(int n) 获取生产者屏障 -- 生产者发布数据final TproducerGet(long sequence) 该接口用于优化生产者查询数据voidproducerSet(long sequence, T data) 该接口用于生产者填充数据 1.voidpublish(long sequence) voidpublish(long lo, long hi) long当前剩余容量 1.并不一定具有价值,因为多线程模型下查询容器的当前大小时,它反映的总是一个旧值。获取序号生成器 -- 用于特殊需求longtryNext()longtryNext(int n) long从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait从接口继承的方法 cn.wjybxx.disruptor.EventSequencer
addGatingBarriers, newMultiConsumerBarrier, newMultiConsumerBarrier, newSingleConsumerBarrier, newSingleConsumerBarrier, removeGatingBarrier
-
方法详细资料
-
getBuffer
-
get
从接口复制的说明:DataProvider根据指定序号获取data 该接口可用于生产者和消费者获取数据,但对于非固定大小的数据结构而言,可能有较长的查询路径。- 指定者:
get在接口中DataProvider<T>
-
producerGet
从接口复制的说明:DataProvider该接口用于优化生产者查询数据- 指定者:
producerGet在接口中DataProvider<T>
-
consumerGet
从接口复制的说明:DataProvider该接口用于优化消费者查询数据- 指定者:
consumerGet在接口中DataProvider<T>
-
producerSet
从接口复制的说明:DataProvider该接口用于生产者填充数据 1. 当拷贝既有数据成本较高时可替换既有对象 2. set不提供特殊的内存语义,因此只应该生产者调用- 指定者:
producerSet在接口中DataProvider<T>
-
consumerSet
从接口复制的说明:DataProvider该接口用于消费者覆盖数据(通常用于删除数据) 1.当使用无界队列需要即时清理内存时使用。 2.set不提供特殊的内存语义,因此只应该由末尾的消费者调用- 指定者:
consumerSet在接口中DataProvider<T>
-
capacity
public int capacity()从接口复制的说明:EventSequencer数据结构大小 1.如果为【无界】数据结构,则返回-1; 2.如果为【有界】数据结构,则返回真实值。The capacity of the data structure to hold entries.
- 指定者:
capacity在接口中EventSequencer<T>- 返回:
- the size of the RingBuffer.
-
remainingCapacity
public long remainingCapacity()从接口复制的说明:EventSequencer当前剩余容量 1.并不一定具有价值,因为多线程模型下查询容器的当前大小时,它反映的总是一个旧值。 2.如果为【无界】数据结构,可能返回任意值(大于0),但建议返回Integer.MAX_VALUE。 3.如果为【有界】数据结构,则返回真实的值。Get the remaining capacity for this sequencer.
- 指定者:
remainingCapacity在接口中EventSequencer<T>- 返回:
- The number of slots remaining.
-
sequencer
从接口复制的说明:EventSequencer获取序号生成器 -- 用于特殊需求- 指定者:
sequencer在接口中EventSequencer<T>
-
producerBarrier
从接口复制的说明:EventSequencer获取生产者屏障 -- 生产者发布数据- 指定者:
producerBarrier在接口中EventSequencer<T>
-
dataProvider
从接口复制的说明:EventSequencer数据提供者- 指定者:
dataProvider在接口中EventSequencer<T>
-
hasAvailableCapacity
public boolean hasAvailableCapacity(int requiredCapacity) - 指定者:
hasAvailableCapacity在接口中EventSequencer<T>
-
next
public long next()- 指定者:
next在接口中EventSequencer<T>
-
next
public long next(int n) - 指定者:
next在接口中EventSequencer<T>
-
tryNext
public long tryNext()- 指定者:
tryNext在接口中EventSequencer<T>
-
tryNext
public long tryNext(int n) - 指定者:
tryNext在接口中EventSequencer<T>
-
nextInterruptibly
- 指定者:
nextInterruptibly在接口中EventSequencer<T>- 抛出:
InterruptedException
-
nextInterruptibly
- 指定者:
nextInterruptibly在接口中EventSequencer<T>- 抛出:
InterruptedException
-
tryNext
- 指定者:
tryNext在接口中EventSequencer<T>
-
publish
public void publish(long sequence) - 指定者:
publish在接口中EventSequencer<T>
-
publish
public void publish(long lo, long hi) - 指定者:
publish在接口中EventSequencer<T>
-
newMultiProducer
public static <T> RingBufferEventSequencer.Builder<T> newMultiProducer(EventFactory<? extends T> factory) 多线程生产者builder -
newSingleProducer
public static <T> RingBufferEventSequencer.Builder<T> newSingleProducer(EventFactory<? extends T> factory) 单线程生产者builder
-