@Override public void updateService(ServiceInstance<String> serviceInstance) throws Exception { discovery.updateService(serviceInstance); }
@Override public void updateService(ServiceInstance<String> serviceInstance) throws Exception { discovery.updateService(serviceInstance); }
public void updateService(ServiceInstance<InstanceDetails> service) throws Exception{ serviceDiscovery.updateService(service); }
@Override public void update() throws ComponentRegistrationException { try { if (registered) { registeredInstance = createServiceInstance(registeredComponent); serviceDiscovery.updateService(registeredInstance); } } catch (Exception e) { throw new ComponentRegistrationException(e); } }
private void updateRegistration(Payload newPayload) { if ( !soaInfo.isRegisterInDiscovery() ) { return; } ServiceInstance<Payload> localUs = us.get(); Payload currentPayload = localUs.getPayload(); if ( !newPayload.equals(currentPayload) ) { try { ServiceInstance<Payload> updatedInstance = buildInstance(newPayload, localUs.getId()); us.set(updatedInstance); discovery.updateService(updatedInstance); } catch ( Exception e ) { log.error("Could not update registration for local instance: " + localUs, e); throw new RuntimeException(e); } } }
@Override public void setStatus(ZookeeperRegistration registration, String status) { ServiceInstance<ZookeeperInstance> serviceInstance = registration.getServiceInstance(); ZookeeperInstance instance = serviceInstance.getPayload(); instance.getMetadata().put(INSTANCE_STATUS_KEY, status); try { getServiceDiscovery().updateService(serviceInstance); } catch (Exception e) { ReflectionUtils.rethrowRuntimeException(e); } }
@Override public void setForcedState(String serviceName, String instanceId, ForcedState forcedState) { try { ServiceInstance<Payload> foundInstance = discovery.queryForInstance(serviceName, instanceId); if ( foundInstance != null ) { DiscoveryInstance soaInstance = toSoaInstance(foundInstance); Payload oldPayload = foundInstance.getPayload(); Payload newPayload = new Payload(null, oldPayload.getAdminPort(), oldPayload.getMetaData(), forcedState, oldPayload.getHealthyState()); ServiceInstance<Payload> updatedInstance = buildInstance(serviceName, HostAndPort.fromParts(soaInstance.getHost(), soaInstance.getPort()), newPayload, instanceId, soaInstance.getHost()); discovery.updateService(updatedInstance); } // TODO else? } catch ( Exception e ) { log.error("Could not update service: " + (serviceName + ":" + instanceId), e); throw new RuntimeException(e); } }
/** * Update drillbit endpoint state. Drillbit advertises its * state in Zookeeper when a shutdown request of drillbit is * triggered. State information is used during planning and * initial client connection phases. */ public RegistrationHandle update(RegistrationHandle handle, State state) { ZKRegistrationHandle h = (ZKRegistrationHandle) handle; try { endpoint = h.endpoint.toBuilder().setState(state).build(); ServiceInstance<DrillbitEndpoint> serviceInstance = ServiceInstance.<DrillbitEndpoint>builder() .name(serviceName) .id(h.id) .payload(endpoint).build(); discovery.updateService(serviceInstance); } catch (Exception e) { Throwables.throwIfUnchecked(e); throw new RuntimeException(e); } return handle; }