@Autowired public NodeInfoUpdater(DiscoveryStorage discoveryStorage, @Qualifier(NodesGroupEvent.BUS) Subscriptions<NodesGroupEvent> nodesGroupSubs, @Qualifier(DockerServiceEvent.BUS) Subscriptions<DockerServiceEvent> dockerServiceSubs, NodeStorage storage) { this.scheduledExecutor = ExecutorUtils.singleThreadScheduledExecutor(this.getClass()); this.discoveryStorage = discoveryStorage; this.nodesGroupSubs = nodesGroupSubs; this.dockerServiceSubs = dockerServiceSubs; this.storage = storage; }
.build(); log.info("{} initialized with config: {}", getClass().getSimpleName(), this.config); this.executorService = ExecutorUtils.executorBuilder() .name(getClass().getSimpleName()) .maxSize(this.config.getMaxNodes())
this.executor = ExecutorUtils.executorBuilder() .coreSize(1).maxSize(10 /*possible max count of clusters*/) .exceptionHandler(Throwables.uncaughtHandler(log))
@Autowired public Notifier(NotifierProps config, RestTemplate restTemplate, ObjectMapper objectMapper, DataProvider dataProvider) { this.restTemplate = restTemplate; this.objectMapper = objectMapper; this.dataProvider = dataProvider; this.url = calculateUrl(config); this.secret = config.getSecret(); this.executor = ExecutorUtils.singleThreadScheduledExecutor(this.getClass()); if(url != null) { log.warn("Server url is '{}', schedule notifier.", url); ScheduledFuture<?> future = this.executor.scheduleWithFixedDelay(this::send, 60L, 60L, TimeUnit.SECONDS); addToClose(() -> future.cancel(true)); } else { log.warn("Server url is null, disable notifier."); } addToClose(this.executor::shutdownNow); }