.name(name) .port(endpointUrl.getPort()) .registrationTimeUTC(System.currentTimeMillis()) .serviceType(ServiceType.STATIC) .payload(endpoint)
public RegistrationBuilder registrationTimeUTC(long registrationTimeUTC) { this.builder.registrationTimeUTC(registrationTimeUTC); return this; }
private ServiceInstance<ModelEndpoint> createInstance(ModelEndpoint ep) throws Exception { URL url = new URL(ep.getEndpoint().getUrl()); ServiceInstanceBuilder<ModelEndpoint> builder = ServiceInstance.<ModelEndpoint> builder() .address(url.getHost()) .id(ep.getContainerId()) .name(ep.getName()) .port(url.getPort()) .registrationTimeUTC(System.currentTimeMillis()) .serviceType(ServiceType.STATIC) .payload(ep) ; return builder.build(); }
.name("dga") .port(endpointUrl.getPort()) .registrationTimeUTC(System.currentTimeMillis()) .serviceType(ServiceType.STATIC) .payload(endpoint);
/** * Return a new builder. The {@link #address} is set to the ip of the first * NIC in the system. The {@link #id} is set to a random UUID. * * @return builder * @throws Exception errors getting the local IP */ public static<T> ServiceInstanceBuilder<T>builder() throws Exception { String address = null; Collection<InetAddress> ips = ServiceInstanceBuilder.getAllLocalIPs(); if ( ips.size() > 0 ) { address = ips.iterator().next().getHostAddress(); // default to the first address } String id = UUID.randomUUID().toString(); return new ServiceInstanceBuilder<T>().address(address).id(id).registrationTimeUTC(System.currentTimeMillis()); }
/** * Return a new builder. The {@link #address} is set to the ip of the first * NIC in the system. The {@link #id} is set to a random UUID. * * @return builder * @throws Exception errors getting the local IP */ public static<T> ServiceInstanceBuilder<T>builder() throws Exception { String address = null; Collection<InetAddress> ips = ServiceInstanceBuilder.getAllLocalIPs(); if ( ips.size() > 0 ) { address = ips.iterator().next().getHostAddress(); // default to the first address } String id = UUID.randomUUID().toString(); return new ServiceInstanceBuilder<T>().address(address).id(id).registrationTimeUTC(System.currentTimeMillis()); }
static<T> ServiceInstance<T> readInstance(JsonNode node, DiscoveryContext<T> context) throws Exception { ServiceInstanceBuilder<T> builder = ServiceInstance.builder(); builder.name(node.get("name").asText()); builder.id(node.get("id").asText()); builder.address(node.get("address").asText()); builder.registrationTimeUTC(node.get("registrationTimeUTC").asLong()); builder.serviceType(ServiceType.valueOf(node.get("serviceType").asText())); builder.payload(context.unMarshallJson(node.get("payload"))); Integer port = getInteger(node, "port"); Integer sslPort = getInteger(node, "sslPort"); if ( port != null ) { builder.port(port); } if ( sslPort != null ) { builder.sslPort(sslPort); } return builder.build(); }
@Override public ServiceInstance<DrillbitEndpoint> deserialize(byte[] bytes) throws Exception { DrillServiceInstance i = DrillServiceInstance.parseFrom(bytes); ServiceInstanceBuilder<DrillbitEndpoint> b = ServiceInstance.<DrillbitEndpoint>builder(); b.id(i.getId()); b.name(ExecConstants.SERVICE_NAME); b.registrationTimeUTC(i.getRegistrationTimeUTC()); b.payload(i.getEndpoint()); return b.build(); }
@Override public ServiceInstance<NodeEndpoint> deserialize(byte[] bytes) throws Exception { DremioServiceInstance i = DremioServiceInstance.parseFrom(bytes); ServiceInstanceBuilder<NodeEndpoint> b = ServiceInstance.<NodeEndpoint>builder(); b.id(i.getId()); b.name(i.getName()); b.registrationTimeUTC(i.getRegistrationTimeUTC()); b.payload(i.getEndpoint()); return b.build(); }
public ServiceInstance<JsonObject> deserialize(byte[] bytes) throws Exception { ServiceInstance rawServiceInstance = this.mapper.readValue(bytes, this.type); ServiceInstanceBuilder<JsonObject> builder = ServiceInstance.<JsonObject>builder() .address(rawServiceInstance.getAddress()) .id(rawServiceInstance.getId()) .name(rawServiceInstance.getName()) .payload(new JsonObject(rawServiceInstance.getPayload().toString())) .registrationTimeUTC(rawServiceInstance.getRegistrationTimeUTC()) .serviceType(rawServiceInstance.getServiceType()); if (rawServiceInstance.getSslPort() != null) { builder.sslPort(rawServiceInstance.getSslPort()); } if (rawServiceInstance.getPort() != null) { builder.sslPort(rawServiceInstance.getPort()); } if (rawServiceInstance.getUriSpec() != null) { builder.uriSpec(rawServiceInstance.getUriSpec()); } return builder.build(); } }
public ServiceInstance<JsonObject> deserialize(byte[] bytes) throws Exception { ServiceInstance rawServiceInstance = this.mapper.readValue(bytes, this.type); ServiceInstanceBuilder<JsonObject> builder = ServiceInstance.<JsonObject>builder() .address(rawServiceInstance.getAddress()) .id(rawServiceInstance.getId()) .name(rawServiceInstance.getName()) .payload(new JsonObject(rawServiceInstance.getPayload().toString())) .registrationTimeUTC(rawServiceInstance.getRegistrationTimeUTC()) .serviceType(rawServiceInstance.getServiceType()); if (rawServiceInstance.getSslPort() != null) { builder.sslPort(rawServiceInstance.getSslPort()); } if (rawServiceInstance.getPort() != null) { builder.sslPort(rawServiceInstance.getPort()); } if (rawServiceInstance.getUriSpec() != null) { builder.uriSpec(rawServiceInstance.getUriSpec()); } return builder.build(); } }
builder.registrationTimeUTC(registrationTimeUTC);
builder.registrationTimeUTC(registrationTimeUTC);
builder.registrationTimeUTC(registrationTimeUTC);