/** * Get requests returns the information about the instance's * {@link InstanceInfo}. * * @return response containing information about the the instance's * {@link InstanceInfo}. */ @GET public Response getInstanceInfo() { InstanceInfo appInfo = registry .getInstanceByAppAndId(app.getName(), id); if (appInfo != null) { logger.debug("Found: {} - {}", app.getName(), id); return Response.ok(appInfo).build(); } else { logger.debug("Not Found: {} - {}", app.getName(), id); return Response.status(Status.NOT_FOUND).build(); } }
private Response validateDirtyTimestamp(Long lastDirtyTimestamp, boolean isReplication) { InstanceInfo appInfo = registry.getInstanceByAppAndId(app.getName(), id, false); if (appInfo != null) { if ((lastDirtyTimestamp != null) && (!lastDirtyTimestamp.equals(appInfo.getLastDirtyTimestamp()))) {
public Response updateMetadata(@Context UriInfo uriInfo) { try { InstanceInfo instanceInfo = registry.getInstanceByAppAndId(app.getName(), id);
@QueryParam("lastDirtyTimestamp") String lastDirtyTimestamp) { try { if (registry.getInstanceByAppAndId(app.getName(), id) == null) { logger.warn("Instance not found: {}/{}", app.getName(), id); return Response.status(Status.NOT_FOUND).build();
@QueryParam("lastDirtyTimestamp") String lastDirtyTimestamp) { try { if (registry.getInstanceByAppAndId(app.getName(), id) == null) { logger.warn("Instance not found: {}/{}", app.getName(), id); return Response.status(Status.NOT_FOUND).build();
/** * this test tests a scenario where multiple registration and update requests for a single client is sent to * different eureka servers before replication can occur between them */ @Test public void testReplicationWithRegistrationAndUpdateOnDifferentServers() throws Exception { // now simulate server1 (delayed) replication to server2. // without batching this is done by server1 making a REST call to the register endpoint of server2 with // replication=true server2.applicationResource.addInstance(instance1, "true"); // verify that server2's "newer" info is (or is not) overridden // server2 should still see instance2 even though server1 tried to replicate across server1 InstanceInfo newServer2Sees = server2.registry.getInstanceByAppAndId(appName, id); assertThat(newServer2Sees.getStatus(), equalTo(instance2.getStatus())); // now let server2 replicate to server1 server1.applicationResource.addInstance(newServer2Sees, "true"); // verify that server1 now have the updated info from server2 InstanceInfo newServer1Sees = server1.registry.getInstanceByAppAndId(appName, id); assertThat(newServer1Sees.getStatus(), equalTo(instance2.getStatus())); }
server1Sees = server1.registry.getInstanceByAppAndId(appName, id); assertThat(server1Sees, equalTo(instance1)); server2Sees = server2.registry.getInstanceByAppAndId(appName, id); assertThat(server2Sees, equalTo(instance2));
/** * Get requests returns the information about the instance's * {@link InstanceInfo}. * * @return response containing information about the the instance's * {@link InstanceInfo}. */ @GET public Response getInstanceInfo() { InstanceInfo appInfo = registry .getInstanceByAppAndId(app.getName(), id); if (appInfo != null) { logger.debug("Found: {} - {}", app.getName(), id); return Response.ok(appInfo).build(); } else { logger.debug("Not Found: {} - {}", app.getName(), id); return Response.status(Status.NOT_FOUND).build(); } }
private Response validateDirtyTimestamp(Long lastDirtyTimestamp, boolean isReplication) { InstanceInfo appInfo = registry.getInstanceByAppAndId(app.getName(), id, false); if (appInfo != null) { if ((lastDirtyTimestamp != null) && (!lastDirtyTimestamp.equals(appInfo.getLastDirtyTimestamp()))) {
public Response updateMetadata(@Context UriInfo uriInfo) { try { InstanceInfo instanceInfo = registry.getInstanceByAppAndId(app.getName(), id);
@QueryParam("lastDirtyTimestamp") String lastDirtyTimestamp) { try { if (registry.getInstanceByAppAndId(app.getName(), id) == null) { logger.warn("Instance not found: {}/{}", app.getName(), id); return Response.status(Status.NOT_FOUND).build();
@QueryParam("lastDirtyTimestamp") String lastDirtyTimestamp) { try { if (registry.getInstanceByAppAndId(app.getName(), id) == null) { logger.warn("Instance not found: {}/{}", app.getName(), id); return Response.status(Status.NOT_FOUND).build();