public Simulator() { Config config = context().system().settings().config().getConfig("caffeine.simulator"); settings = new BasicSettings(config); List<Routee> routes = makeRoutes(); router = new Router(new BroadcastRoutingLogic(), routes); remaining = routes.size(); batchSize = settings.batchSize(); stopwatch = Stopwatch.createStarted(); reporter = settings.report().format().create(config); }
public Simulator() { Config config = context().system().settings().config().getConfig("caffeine.simulator"); settings = new BasicSettings(config); List<Routee> routes = makeRoutes(); router = new Router(new BroadcastRoutingLogic(), routes); remaining = routes.size(); batchSize = settings.batchSize(); stopwatch = Stopwatch.createStarted(); reporter = settings.report().format().create(config); }
@Override public void preStart() throws Exception { log.info("Starting up"); List<Routee> routees = new ArrayList<Routee>(); for (int i = 0; i < 100; i++) { ActorRef actor = getContext().actorOf(springExtension.props( "taskActor")); getContext().watch(actor); routees.add(new ActorRefRoutee(actor)); } router = new Router(new SmallestMailboxRoutingLogic(), routees); super.preStart(); }
@Override public void preStart() { router = new Router(new BroadcastRoutingLogic()); routees = new HashMap<ActorRef, String>(processes.size()); for (final Process process : processes) { logger.debug("starting " + process.getName() + " on port " + process.getPort()); final ActorRef processActor = getContext().actorOf(Props.create(ProcessActor.class, process), process.getName()); getContext().watch(processActor); router = router.addRoutee(processActor); routees.put(processActor, process.getName()); } router.route(Signal.FORK, getSelf()); state = State.STARTED; }
@Override public void preStart() { log().info("Starting up..."); // --- basic initializations --- processedAcksAccumulator = new ArrayList<>(); // --- initialize scheduler events --- getContext().system().scheduler().scheduleOnce( Duration.apply(20, TimeUnit.SECONDS) /* Note: this is actually the timeout */, getSelf(), new CheckAllAcks(), getContext().system().dispatcher(), getSelf() ); // --- initialize router --- final List<Routee> routees = new ArrayList<>(childrenToCreate); for (int i = 0; i < childrenToCreate; i++) { ActorRef crimeRecordsProcessorChild = actorSystem.actorOf(springAkkaExtension .props(SpringAkkaExtension.classNameToSpringName(CrimeRecordsProcessor.class)) .withDispatcher("akka.blocking-io-dispatcher")); getContext().watch(crimeRecordsProcessorChild); routees.add(new ActorRefRoutee(crimeRecordsProcessorChild)); } router = new Router(new SmallestMailboxRoutingLogic(), routees); }