com.jdon.async.disruptor
类 DisruptorFactory

java.lang.Object
  继承者 com.jdon.async.disruptor.DisruptorFactory
所有已实现的接口:
Startable

public class DisruptorFactory
extends Object
implements Startable

SLEEPING is a better option when you have a large number of event processors and you need throughput when you don't mind a 1ms latency hit in the worse case. BLOCKING has the lowest throughput of all the strategies but it does not have the 1ms latency spikes of SLEEPING. It uses no CPU when idle but it does not scale up so well with increasing numbers of event processors because of the contention on the lock. YIELDING and BUSY_SPIN have the best performance for both throughput and latency but eat up a CPU. YIELDING is more friendly in allowing other threads to run when cores are limited. It would be nice if Java had access to the x86 PAUSE instruction to save power and further reduce latency that gets lost due to the wrong choices the CPU can make with speculative execution of busy spin loops. In all cases where you have sufficient cores then all the wait strategies will beat pretty much any other alternative such as queues.

作者:
banq

字段摘要
protected  ConcurrentHashMap<String,TreeSet<DomainEventHandler>> handlesMap
           
static String module
           
 
构造方法摘要
DisruptorFactory()
           
DisruptorFactory(DisruptorParams disruptorParams, ContainerCallback containerCallback, DisruptorPoolFactory disruptorPoolFactory)
           
 
方法摘要
 com.lmax.disruptor.dsl.Disruptor addEventMessageHandler(com.lmax.disruptor.dsl.Disruptor dw, String topic, TreeSet<DomainEventHandler> handlers)
           
 com.lmax.disruptor.dsl.Disruptor createDisruptor(String topic)
          one topic one EventDisruptor
 com.lmax.disruptor.dsl.Disruptor createDw(String topic)
           
 com.lmax.disruptor.dsl.Disruptor createSingleDisruptor(String topic)
          single producer :single consumer no lock
 com.lmax.disruptor.dsl.Disruptor createSingleDw(String topic)
           
 com.lmax.disruptor.dsl.Disruptor getDisruptor(String topic)
           
 com.lmax.disruptor.dsl.Disruptor getDisruptorSingle(String topic)
           
 TreeSet<DomainEventHandler> getTreeSet()
           
 boolean isContain(String topic)
           
protected  Collection loadEvenHandler(String topic)
          if there are many consumers, execution order will be alphabetical list by Name of @Consumer class.
protected  Collection loadOnEventConsumers(String topic)
           
 void releaseDisruptor(Object owner)
           
 void start()
          Start this component.
 void stop()
          Stop this component.
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

module

public static final String module

handlesMap

protected final ConcurrentHashMap<String,TreeSet<DomainEventHandler>> handlesMap
构造方法详细信息

DisruptorFactory

public DisruptorFactory(DisruptorParams disruptorParams,
                        ContainerCallback containerCallback,
                        DisruptorPoolFactory disruptorPoolFactory)

DisruptorFactory

public DisruptorFactory()
方法详细信息

createDw

public com.lmax.disruptor.dsl.Disruptor createDw(String topic)

createSingleDw

public com.lmax.disruptor.dsl.Disruptor createSingleDw(String topic)

addEventMessageHandler

public com.lmax.disruptor.dsl.Disruptor addEventMessageHandler(com.lmax.disruptor.dsl.Disruptor dw,
                                                               String topic,
                                                               TreeSet<DomainEventHandler> handlers)

getDisruptor

public com.lmax.disruptor.dsl.Disruptor getDisruptor(String topic)

getDisruptorSingle

public com.lmax.disruptor.dsl.Disruptor getDisruptorSingle(String topic)

releaseDisruptor

public void releaseDisruptor(Object owner)

createDisruptor

public com.lmax.disruptor.dsl.Disruptor createDisruptor(String topic)
one topic one EventDisruptor

参数:
topic -
返回:

createSingleDisruptor

public com.lmax.disruptor.dsl.Disruptor createSingleDisruptor(String topic)
single producer :single consumer no lock

参数:
topic -
返回:

isContain

public boolean isContain(String topic)

loadEvenHandler

protected Collection loadEvenHandler(String topic)
if there are many consumers, execution order will be alphabetical list by Name of @Consumer class.

参数:
topic -
返回:

loadOnEventConsumers

protected Collection loadOnEventConsumers(String topic)

getTreeSet

public TreeSet<DomainEventHandler> getTreeSet()

start

public void start()
从接口 Startable 复制的描述
Start this component.

指定者:
接口 Startable 中的 start

stop

public void stop()
从接口 Startable 复制的描述
Stop this component.

指定者:
接口 Startable 中的 stop


Copyright © 2013. All Rights Reserved.