public static Reactor reactor(Handler... handlers) throws IOException { Reactor reactor = Reactor.Factory.create(); for (Handler handler : handlers) { reactor.getHandler().add(handler); } return reactor; }
@Override public void delegate() throws HandlerException { if (delegated == null) { return; // short circuit } Iterator<Handler> children = delegated.children(); delegated = null; while(children.hasNext()) { dispatch(children.next()); } }
@Override public void dispatch(Handler handler) throws HandlerException { Handler old_delegated = delegated; try { delegated = handler; try { handler.handle(this); } catch(HandlerException handlerException) { throw handlerException; } catch(RuntimeException runtimeException) { throw new HandlerException(handler, runtimeException); } delegate(); } finally { delegated = old_delegated; } }
@Override public void dispatch(Handler handler) throws HandlerException { Handler old_delegated = delegated; try { delegated = handler; try { handler.handle(this); } catch(HandlerException handlerException) { throw handlerException; } catch(RuntimeException runtimeException) { throw new HandlerException(handler, runtimeException); } delegate(); } finally { delegated = old_delegated; } }
public static Reactor reactor(ReactorOptions options, Handler... handlers) throws IOException { Reactor reactor = Reactor.Factory.create(options); for (Handler handler : handlers) { reactor.getHandler().add(handler); } return reactor; } }
@Override public void delegate() throws HandlerException { if (delegated == null) { return; // short circuit } Iterator<Handler> children = delegated.children(); delegated = null; while(children.hasNext()) { dispatch(children.next()); } }
public static Reactor reactor(Handler... handlers) throws IOException { Reactor reactor = Reactor.Factory.create(); for (Handler handler : handlers) { reactor.getHandler().add(handler); } return reactor; } }
ReactorHandler reactorHandler = null; final Reactor reactor = e.getReactor(); final Iterator<Handler> reactorEventHandlers = reactor.getHandler().children(); while (reactorEventHandlers.hasNext()) { final Handler currentHandler = reactorEventHandlers.next();
public static Reactor reactor(ReactorHandler reactorHandler, final int maxFrameSize) throws IOException { final ReactorOptions reactorOptions = new ReactorOptions(); reactorOptions.setMaxFrameSize(maxFrameSize); Reactor reactor = Proton.reactor(reactorOptions, reactorHandler); reactor.setGlobalHandler(new CustomIOHandler()); reactor.getGlobalHandler().add(new LoggingHandler()); return reactor; } }