CompletableFuture<Void> () { List<CompletableFuture<Void>> futures = new ArrayList<>(); for (EventLogGroup group : myGroups.values()) { futures.add(FeatureUsageLogger.INSTANCE.log(group, EventLogSystemEvents.COLLECTOR_REGISTERED)); } Map<String, StatisticsEventLogger> recorderLoggers = new HashMap<>(); for (FeatureUsagesCollector collector : instantiateCounterCollectors()) { EventLogGroup group = collector.getGroup(); if (group != null) { String recorder = group.getRecorder(); StatisticsEventLogger logger = recorderLoggers.get(recorder); if (logger == null) { logger = StatisticsEventLogProviderUtil.getEventLogProvider(recorder).getLogger(); recorderLoggers.put(recorder, logger); } futures.add(logger.logAsync(group, EventLogSystemEvents.COLLECTOR_REGISTERED, false)); } else { try { // get group id to check that either group or group id is overridden if (StringUtil.isEmpty(collector.getGroupId())) { LOG.error("Please override either getGroupId() or getGroup() with not empty string in " + collector.getClass().getName()); } } catch (IllegalStateException e) { LOG.error(e.getMessage() + " in " + collector.getClass().getName()); } } } return CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])); }