public void shutdownGracefully() throws IllegalStateException { if (disruptor == null) { throw new IllegalStateException("disruptor == null, call init"); } for (ExchangeEventProducer<T> producer : producers) { producer.stop(); } try { disruptor.shutdown(shutdownTimeout, TimeUnit.MINUTES); } catch (TimeoutException ex) { LOG.error(ex.getMessage()); } }
public void registerProducer(ExchangeEventProducer<T> producer) throws IllegalStateException, NullPointerException { if (disruptor == null) { throw new IllegalStateException("disruptor == null, call init"); } if (producer == null) { throw new NullPointerException("consumer == null"); } producer.setRingBuffer(disruptor.getRingBuffer()); producers.add(producer); }