@Override public ServiceMonitor getServiceMonitor(ServiceMonitorRegistry registry) { final ServiceMonitor sm = registry.getMonitorByClassName(m_serviceClass.getCanonicalName()); if (sm == null) { throw new ConfigObjectRetrievalFailureException("Could not find monitor for service " +m_serviceName+" with class-name "+m_serviceClass.getName(), null); } return sm; }
@Override public Object execute() throws Exception { registry.getMonitorClassNames().stream().forEachOrdered(e -> { System.out.printf("%s\n", e); }); return null; } }
@Override public PollerRequestBuilder withMonitorClassName(String className) { this.className = className; this.serviceMonitor = client.getRegistry().getMonitorByClassName(className); return this; }
@Override public Object execute() throws Exception { registry.getMonitorClassNames().stream().forEachOrdered(e -> { System.out.printf("%s\n", e); }); return null; }
@Override public CompletableFuture<PollerResponseDTO> execute(PollerRequestDTO request) { final String className = request.getClassName(); final ServiceMonitor monitor = serviceMonitorRegistry.getMonitorByClassName(className); if (monitor == null) { return CompletableFuture.completedFuture(new PollerResponseDTO(PollStatus.unknown("No monitor found with class name '" + className + "'."))); } return CompletableFuture.supplyAsync(new Supplier<PollerResponseDTO>() { @Override public PollerResponseDTO get() { PollStatus pollStatus; try { final Map<String, Object> parameters = request.getMonitorParameters(); pollStatus = monitor.poll(request, parameters); } catch (RuntimeException e) { pollStatus = PollStatus.unknown(e.getMessage()); } return new PollerResponseDTO(pollStatus); } }, executor); }
@Override public Object execute() throws Exception { registry.getMonitorClassNames().stream().forEachOrdered(e -> { System.out.printf("%s\n", e); }); return null; }
monitor = registry.getMonitorByClassName(monitorClass); System.err.printf("Error: No monitor found with class name %s\n", monitorClass); if (monitor == null) {
@Override public int complete(Session session, CommandLine commandLine, List<String> candidates) { StringsCompleter serviceNames = new StringsCompleter(); serviceNames.getStrings().addAll(registry.getMonitorClassNames()); return serviceNames.complete(session, commandLine, candidates); } }