private void process(LongArrayList events) { try { policy.stats().stopwatch().start(); for (int i = 0; i < events.size(); i++) { policy.record(events.getLong(i)); } } catch (Exception e) { sender().tell(ERROR, self()); context().system().log().error(e, ""); } finally { policy.stats().stopwatch().stop(); } }
private void finish() { try { policy.finished(); sender().tell(policy.stats(), self()); } catch (Exception e) { sender().tell(ERROR, self()); context().system().log().error(e, ""); } } }
/** Broadcast the trace events to all of the policy actors. */ private void broadcast() { try (LongStream events = eventStream()) { LongArrayList batch = new LongArrayList(batchSize); for (PrimitiveIterator.OfLong i = events.iterator(); i.hasNext();) { batch.add(i.nextLong()); if (batch.size() == batchSize) { router.route(batch, self()); batch = new LongArrayList(batchSize); } } router.route(batch, self()); router.route(FINISH, self()); } catch (Exception e) { context().system().log().error(e, ""); context().stop(self()); } }
/** * Hook that will be called just after the server termination. Override this method if you want to perform some cleanup actions after the server is stopped. * The {@code failure} parameter contains a {@link Throwable} only if there has been a problem shutting down the server. */ protected void postServerShutdown(Optional<Throwable> failure, ActorSystem system) { systemReference.get().log().info("Shutting down the server"); }
/** * Hook that will be called in case the Http server binding fails. Override this method if you want to perform some actions after the server binding failed. */ protected void postHttpBindingFailure(Throwable cause) { systemReference.get().log().error(cause, "Error starting the server: " + cause.getMessage()); }
/** * Hook that will be called in case the Http server binding fails. Override this method if you want to perform some actions after the server binding failed. */ protected void postHttpBindingFailure(Throwable cause) { systemReference.get().log().error(cause, "Error starting the server: " + cause.getMessage()); }
/** * Hook that will be called in case the Http server binding fails. Override this method if you want to perform some actions after the server binding failed. */ protected void postHttpBindingFailure(Throwable cause) { systemReference.get().log().error(cause, "Error starting the server: " + cause.getMessage()); }
/** * Hook that will be called just after the server termination. Override this method if you want to perform some cleanup actions after the server is stopped. * The {@code failure} parameter contains a {@link Throwable} only if there has been a problem shutting down the server. */ protected void postServerShutdown(Optional<Throwable> failure, ActorSystem system) { systemReference.get().log().info("Shutting down the server"); }
/** * Hook that will be called just after the server termination. Override this method if you want to perform some cleanup actions after the server is stopped. * The {@code failure} parameter contains a {@link Throwable} only if there has been a problem shutting down the server. */ protected void postServerShutdown(Optional<Throwable> failure, ActorSystem system) { systemReference.get().log().info("Shutting down the server"); }
@Override public void onFailure(Throwable ex) throws Throwable { system.log().error(ex, "Lookup of shared journal at {} timed out", path); } }, system.dispatcher());
/** * Constructs the {@code /status} route builder. * * @param clusterStateSupplier the supplier to get the cluster state. * @param healthCheckingActor the HealthCheckingActor to use. * @param actorSystem the Akka ActorSystem. */ public StatusRoute(final Supplier<ClusterStatus> clusterStateSupplier, final ActorRef healthCheckingActor, final ActorSystem actorSystem) { this.clusterStateSupplier = clusterStateSupplier; this.healthRouteSupplier = new HealthRouteSupplier(healthCheckingActor, actorSystem.log()); }
/** * Constructs the {@code /status} route builder. * * @param clusterStateSupplier the supplier to get the cluster state. * @param healthCheckingActor the HealthCheckingActor to use. * @param actorSystem the Akka ActorSystem. */ public StatusRoute(final Supplier<ClusterStatus> clusterStateSupplier, final ActorRef healthCheckingActor, final ActorSystem actorSystem) { this.clusterStateSupplier = clusterStateSupplier; this.healthRouteSupplier = new HealthRouteSupplier(healthCheckingActor, actorSystem.log()); }
/** * Hook that will be called just after the Http server binding is done. Override this method if you want to perform some actions after the server is up. */ protected void postHttpBinding (ServerBinding binding) { systemReference.get().log().info("Server online at http://" + binding.localAddress().getHostName() + ":" + binding.localAddress().getPort() + "/"); }
/** * Hook that will be called just after the Http server binding is done. Override this method if you want to perform some actions after the server is up. */ protected void postHttpBinding (ServerBinding binding) { systemReference.get().log().info("Server online at http://" + binding.localAddress().getHostName() + ":" + binding.localAddress().getPort() + "/"); }
/** * Hook that will be called just after the Http server binding is done. Override this method if you want to perform some actions after the server is up. */ protected void postHttpBinding (ServerBinding binding) { systemReference.get().log().info("Server online at http://" + binding.localAddress().getHostName() + ":" + binding.localAddress().getPort() + "/"); }
private ConnectionData tryToCreateConnectionDataFrom(final JsonValue json) { try { return ConnectionData.fromJson(json.asObject()); } catch (final UnsupportedOperationException | JsonParseException e) { if (system != null) { system.log().error(e, "Could not deserialize JSON: '{}'", json); } else { System.err.println("Could not deserialize JSON: '" + json + "': " + e.getMessage()); } return null; } }
@Override public void onSuccess(Object arg0) throws Throwable { if (arg0 instanceof ActorIdentity && ((ActorIdentity) arg0).getRef() != null) { SharedLeveldbJournal.setStore(((ActorIdentity) arg0).getRef(), system); } else { system.log().error("Lookup of shared journal at {} timed out", path); System.exit(-1); } } }, system.dispatcher());
/** * Creates a CompletionStage for the passed {@link HttpRequest} containing the {@link HttpResponse}. * * @return the HttpResponse CompletionStage. */ public CompletionStage<HttpResponse> createSingleHttpRequest(final HttpRequest request) { return Http.get(actorSystem).singleRequest( request, Http.get(actorSystem).defaultClientHttpsContext(), connectionPoolSettings, actorSystem.log(), actorMaterializer ); }
/** * Creates a CompletionStage for the passed {@link HttpRequest} containing the {@link HttpResponse}. * * @return the HttpResponse CompletionStage. */ public CompletionStage<HttpResponse> createSingleHttpRequest(final HttpRequest request) { return Http.get(actorSystem).singleRequest( request, Http.get(actorSystem).defaultClientHttpsContext(), connectionPoolSettings, actorSystem.log(), actorMaterializer ); }
private void process(LongArrayList events) { try { policy.stats().stopwatch().start(); for (int i = 0; i < events.size(); i++) { policy.record(events.getLong(i)); } } catch (Exception e) { sender().tell(ERROR, self()); context().system().log().error(e, ""); } finally { policy.stats().stopwatch().stop(); } }