@Override public boolean waitUntilReady(double seconds) { for (int i = 0; i < seconds * 100; ++i) { if (mirror.ready()) { return true; } try { Thread.sleep(10); } catch (InterruptedException e) { // empty } } return false; }
@Override public void select(RoutingContext ctx) { if (error != null) { ctx.setError(DocumentProtocol.ERROR_POLICY_FAILURE, error); } else if (mirror.ready()) { Hop hop = getRecipient(); if (hop != null) { Route route = new Route(ctx.getRoute()); route.setHop(0, hop); ctx.addChild(route); } else { ctx.setError(ErrorCode.NO_ADDRESS_FOR_SERVICE, "Could not resolve any recipients from '" + pattern + "'."); } } else { ctx.setError(ErrorCode.APP_TRANSIENT_ERROR, "Extern slobrok not ready."); } }