@Override public List<EndpointDefinition> loadServices(final String serviceName) { if (trace) { logger.trace(sputs( "ConsulServiceDiscoveryProvider::loadServices", serviceName )); } if (debug) logger.debug(sputs("Fetching healthy nodes for", serviceName)); final List<ServiceHealth> healthyServices = getHealthyServices(serviceName); if (debug) logger.debug(sputs("Fetched healthy nodes for", serviceName, "node count fetched", healthyServices.size())); return convertToServiceDefinitions(healthyServices); }
public String method2(final String arg1, final int arg2, final float arg3, final double arg4) { return sputs(arg1, arg2, arg3, arg4); }
@Override public String toString() { return sputs("Vertx MultiMap Wrapper", this.entrySet()); } }
public String method2(final String arg1, final int arg2, final float arg3, final double arg4) { return sputs(arg1, arg2, arg3, arg4); }
public String hello(String arg, int arg2, float arg3) { return sputs(arg, arg2, arg3); } }
public static void die(Object... args) { throw new ConsulException(sputs(args)); } }
public static void notRegistered(Object... args) { throw new NotRegisteredException(sputs(args)); } }
public static void dieWithException(Exception ex, Object... args) { throw new ConsulException(sputs(args), ex); }
private void addService(final EndpointDefinition endpointDefinition) { if (endpointDefinition.getId().equals(localServiceId)) { return; } logger.info(sputs("ClusteredStatReplicator::addService()", endpointDefinition, " replicator count ", replicatorsMap.size())); final StatReplicator statReplicator = statReplicatorProvider.provide(endpointDefinition); this.replicatorsMap.put(endpointDefinition.getId(), Pair.pair(endpointDefinition, statReplicator)); this.statReplicators = new ArrayList<>(replicatorsMap.values()); logger.info(sputs("ClusteredStatReplicator::addService() added", serviceName, endpointDefinition, " replicator count ", replicatorsMap.size())); }
public void doCheckReconnect() { lastReconnectTime = currentTime; final List<EndpointDefinition> services = servicePool.services(); if ((services.size() - 1) != this.statReplicators.size()) { logger.info(sputs("DOING RECONNECT", services.size() - 1, this.statReplicators.size())); shutDownReplicators(); services.forEach(this::addService); } }
private void doRecordCount(Pair<EndpointDefinition, StatReplicator> statReplicator, final String name, final long count, final long now) { try { statReplicator.getSecond().replicateCount(name, count, now); } catch (Exception ex) { logger.error(sputs("ClusteredStatReplicator::Replicator failed", statReplicator), ex); } }
private void wireWebSocket(final String serviceName, final String message) { this.webSocket.setErrorConsumer(error -> { if (error instanceof ConnectException) { connected.set(false); } logger.error(sputs(this.getClass().getName(), "::Exception calling WebSocket from client proxy", "\nService Name", serviceName, "\nMessage", message), error); }); //noinspection Convert2MethodRef this.webSocket.setTextMessageConsumer(messageFromServer -> handleWebSocketReplyMessage(messageFromServer)); }
@Override public void checkIn(final Queue<ServiceHealthCheckIn> checkInsQueue) { if (trace) { logger.trace(sputs( "ConsulServiceDiscoveryProvider::checkIn", checkInsQueue )); } /* This was added to remove duplicate check-ins. */ final Set<ServiceHealthCheckIn> uniqueCheckIns = createUniqueSetOfCheckins(checkInsQueue); if (uniqueCheckIns.size() > 0) { Consul consul = consul(); for (ServiceHealthCheckIn checkIn : uniqueCheckIns) { checkInWithConsul(consul, checkIn); } } }
@Override public void event(String arg) { puts("GOT EVENT", arg); event.set(sputs("GOT EVENT", arg)); } }
public void method1(String arg) { puts("method1", arg); method.set(sputs("method1", arg)); }
@RequestMapping(value = "/method3/", method = RequestMethod.POST) public String method3(@RequestParam("arg1") final String arg1, @HeaderParam("arg2") final int arg2, Employee employee) { return sputs(arg1, arg2, employee); }
private EndpointDefinition convertToServiceDefinition(final ServiceHealth serviceHealth) { final String host = serviceHealth.getNode().getAddress(); final int port = serviceHealth.getService().getPort(); final String id = serviceHealth.getService().getId(); final String name = serviceHealth.getService().getService(); final List<String> tags = serviceHealth.getService().getTags(); final EndpointDefinition endpointDefinition = new EndpointDefinition(HealthStatus.PASS, id, name, host, port, tags); if (debug) logger.debug(sputs("convertToServiceDefinition \nserviceHealth", serviceHealth, "\nserviceDefinition", endpointDefinition)); return endpointDefinition; }
@RequestMapping("/call1/foo/{arg4}/{2}") public String method1(@RequestParam("arg1") final String arg1, @HeaderParam("arg2") final int arg2, @PathVariable final float arg3, @PathVariable("arg4") final double arg4) { return sputs(arg1, arg2, arg3, arg4); }
@RequestMapping("/call1/foo/{arg4}/{2}") public String method1(@RequestParam("arg1") final String arg1, @HeaderParam("arg2") final int arg2, @PathVariable final float arg3, @PathVariable("arg4") final double arg4) { return sputs(arg1, arg2, arg3, arg4); }
@RequestMapping("/call1/foo/{arg4}/{2}") public String method1(@RequestParam("arg1") final String arg1, @HeaderParam("arg2") final int arg2, @PathVariable final float arg3, @PathVariable("arg4") final double arg4) { return sputs(arg1, arg2, arg3, arg4); }