/** * Registers the client as a service with Consul. * Registration enables * the use of check with a script. * * @param host The public facing host of the service to register with Consul. * @param port The public facing port of the service to register with Consul. * @param script Health script for Consul to use. * @param interval Health script run interval in seconds. * @param serviceName Service name to register. * @param serviceId Service id to register. * @param tags Tags to register with. */ public void registerServiceWithScript(final String host, final int port, final String script, final long interval, final String serviceName, final String serviceId, final String... tags) { RegistrationCheck check = new RegistrationCheck(); check.setScript(script); check.setInterval("" + interval + "s"); registerServiceWithRegistrationCheck(host, port, check, serviceName, serviceId, tags); }
@SuppressWarnings("SimplifiableIfStatement") @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Registration)) return false; Registration that = (Registration) o; if (port != that.port) return false; if (host != null ? !host.equals(that.host) : that.host != null) return false; if (check != null ? !check.equals(that.check) : that.check != null) return false; if (id != null ? !id.equals(that.id) : that.id != null) return false; return !(name != null ? !name.equals(that.name) : that.name != null) && Arrays.equals(tags, that.tags); }
@Override public int hashCode() { int result = name != null ? name.hashCode() : 0; result = 31 * result + (id != null ? id.hashCode() : 0); result = 31 * result + port; result = 31 * result + (host != null ? host.hashCode() : 0); result = 31 * result + (check != null ? check.hashCode() : 0); result = 31 * result + (tags != null ? Arrays.hashCode(tags) : 0); return result; }
/** * Registers the client as a service with Consul. Registration enables * the use of checks. * * @param host The public facing host of the service to register with Consul. * @param port The public facing port of the service to register with Consul. * @param ttl Time to live for the Consul dead man's switch. * @param serviceName Service name to register. * @param serviceId Service id to register. * @param tags Tags to register with. */ public void registerService(final String host, final int port, final long ttl, final String serviceName, final String serviceId, final String... tags) { RegistrationCheck check = new RegistrationCheck(); check.setTtl("" + ttl + "s"); registerServiceWithRegistrationCheck(host, port, check, serviceName, serviceId, tags); }
/** * Registers the client as a service with Consul. Registration enables * the use of checks. * * @param port The public facing port of the service to register with Consul. * @param ttl Time to live for the Consul dead man's switch. * @param serviceName Service name to register. * @param serviceId Service id to register. * @param tags Tags to register with. */ public void registerService(final int port, final long ttl, final String serviceName, final String serviceId, final String... tags) { RegistrationCheck check = new RegistrationCheck(); check.setTtl("" + ttl + "s"); registerServiceWithRegistrationCheck(port, check, serviceName, serviceId, tags); }
/** * Registers the client as a service with Consul. * Registration enables * the use of check with a script. * * @param port The public facing port of the service to register with Consul. * @param script Health script for Consul to use. * @param interval Health script run interval in seconds. * @param serviceName Service name to register. * @param serviceId Service id to register. * @param tags Tags to register with. */ public void registerServiceWithScript(final int port, final String script, final long interval, final String serviceName, final String serviceId, final String... tags) { RegistrationCheck check = new RegistrationCheck(); check.setScript(script); check.setInterval("" + interval + "s"); registerServiceWithRegistrationCheck(port, check, serviceName, serviceId, tags); }
@SuppressWarnings("SimplifiableIfStatement") @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Registration)) return false; Registration that = (Registration) o; if (port != that.port) return false; if (check != null ? !check.equals(that.check) : that.check != null) return false; if (id != null ? !id.equals(that.id) : that.id != null) return false; return !(name != null ? !name.equals(that.name) : that.name != null) && Arrays.equals(tags, that.tags); }
@Override public int hashCode() { int result = name != null ? name.hashCode() : 0; result = 31 * result + (id != null ? id.hashCode() : 0); result = 31 * result + port; result = 31 * result + (check != null ? check.hashCode() : 0); result = 31 * result + (tags != null ? Arrays.hashCode(tags) : 0); return result; }