Package com.lmax.disruptor

Examples of com.lmax.disruptor.EventProcessor


                waitStrategy);

        // Initial barrier
        SequenceBarrier translationBarrier = ringBuffer.newBarrier();

        EventProcessor tradeProcessor = createTradeProcessor(ringBuffer, translationBarrier);
        EventProcessor rateProcessor = createRateProcessor(ringBuffer, translationBarrier);

        // Add the portfolio position aggregator with a barrier after both
        // processors.
        SequenceBarrier positionBarrier = ringBuffer.newBarrier(tradeProcessor.getSequence(),
                rateProcessor.getSequence());
        EventProcessor portfolioPositionProcessor = createPortfolioPositionProcessor(ringBuffer, positionBarrier);
       
        // Netty Event Publisher
        TextMessageGateway gateway = createGatewayEventPublisher(ringBuffer);

        // The producer can't move past this barrier.
        ringBuffer.setGatingSequences(tradeProcessor.getSequence(), rateProcessor.getSequence(),
                portfolioPositionProcessor.getSequence());

        // Start the threads
        tasks[0] = threadPool.submit(gateway);
        tasks[1] = threadPool.submit(tradeProcessor);
        tasks[2] = threadPool.submit(rateProcessor);
View Full Code Here


     * @return
     */
    private EventProcessor createPortfolioPositionProcessor(RingBuffer<MarketEvent> ringBuffer,
            SequenceBarrier positionBarrier) {
        PortfolioPositionEventHandler portfolioPositionHandler = new PortfolioPositionEventHandler();
        EventProcessor portfolioPositionProcessor = new BatchEventProcessor<MarketEvent>(ringBuffer, positionBarrier,
                portfolioPositionHandler);
        eventProcessors[2] = portfolioPositionProcessor;
        return portfolioPositionProcessor;
    }
View Full Code Here

     * @param translationBarrier
     * @return
     */
    private EventProcessor createRateProcessor(RingBuffer<MarketEvent> ringBuffer, SequenceBarrier translationBarrier) {
        MarketRateEventHandler rateHandler = new MarketRateEventHandler();
        EventProcessor rateProcessor = new BatchEventProcessor<MarketEvent>(ringBuffer, translationBarrier, rateHandler);
        eventProcessors[1] = rateProcessor;
        return rateProcessor;
    }
View Full Code Here

     * @param translationBarrier
     * @return
     */
    private EventProcessor createTradeProcessor(RingBuffer<MarketEvent> ringBuffer, SequenceBarrier translationBarrier) {
        MarketTradeEventHandler tradeHandler = new MarketTradeEventHandler();
        EventProcessor tradeProcessor = new BatchEventProcessor<MarketEvent>(ringBuffer, translationBarrier,
                tradeHandler);
        eventProcessors[0] = tradeProcessor;
        return tradeProcessor;
    }
View Full Code Here

TOP

Related Classes of com.lmax.disruptor.EventProcessor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.