private void threadPoolDispatcher() { Boundary b = new Boundary(); // Bind to a Selector using an anonymous object Tuple2<Selector, Object> anon = $(); threadPoolReactor.on(anon.getT1(), b.bind(consumer, 3)); threadPoolReactor.notify(anon.getT2(), Event.wrap(threadPoolReactor)); threadPoolReactor.notify(anon.getT2(), Event.wrap(threadPoolReactor)); threadPoolReactor.notify(anon.getT2(), Event.wrap(threadPoolReactor)); b.await(); }
private void multipleRingBufferDispatchers() { Boundary b = new Boundary(); Reactor r1 = Reactors.reactor().env(env).dispatcher(Environment.RING_BUFFER).get(); Reactor r2 = Reactors.reactor().env(env).dispatcher(Environment.RING_BUFFER).get(); // Bind to a Selector using an anonymous object Tuple2<Selector, Object> anon = $(); r1.on(anon.getT1(), b.bind(consumer, 3)); r2.on(anon.getT1(), b.bind(consumer, 2)); r1.notify(anon.getT2(), Event.wrap(r1)); r1.notify(anon.getT2(), Event.wrap(r1)); r1.notify(anon.getT2(), Event.wrap(r1)); r2.notify(anon.getT2(), Event.wrap(r2)); r2.notify(anon.getT2(), Event.wrap(r2)); b.await(); }