com.lmax.disruptor.util.DaemonThreadFactory Java Examples

The following examples show how to use com.lmax.disruptor.util.DaemonThreadFactory. 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: FastEventServiceImpl.java    From redtorch with MIT License 6 votes vote down vote up
@Override
public void afterPropertiesSet() throws Exception {
	if ("BusySpinWaitStrategy".equals(waitStrategy)) {
		disruptor = new Disruptor<FastEvent>(new FastEventFactory(), 65536, DaemonThreadFactory.INSTANCE,
				ProducerType.MULTI, new BusySpinWaitStrategy());
	} else if ("SleepingWaitStrategy".equals(waitStrategy)) {
		disruptor = new Disruptor<FastEvent>(new FastEventFactory(), 65536, DaemonThreadFactory.INSTANCE,
				ProducerType.MULTI, new SleepingWaitStrategy());
	} else if ("BlockingWaitStrategy".equals(waitStrategy)) {
		disruptor = new Disruptor<FastEvent>(new FastEventFactory(), 65536, DaemonThreadFactory.INSTANCE,
				ProducerType.MULTI, new BlockingWaitStrategy());
	} else {
		disruptor = new Disruptor<FastEvent>(new FastEventFactory(), 65536, DaemonThreadFactory.INSTANCE,
				ProducerType.MULTI, new YieldingWaitStrategy());
	}
	ringBuffer = disruptor.start();
}
 
Example #2
Source File: DisruptorIntegrationTest.java    From tutorials with MIT License 4 votes vote down vote up
private void createDisruptor(final ProducerType producerType, final EventConsumer eventConsumer) {
    final ThreadFactory threadFactory = DaemonThreadFactory.INSTANCE;
    disruptor = new Disruptor<>(ValueEvent.EVENT_FACTORY, 16, threadFactory, producerType, waitStrategy);
    disruptor.handleEventsWith(eventConsumer.getEventHandler());
}