/** * Remove the given instance info the list. * * @param i * the instance info object to be removed. */ public void removeInstance(InstanceInfo i) { removeInstance(i, true); }
this.removeInstance(instanceInfo, false); it.remove();
public static Application mergeApplication(Application first, Application second) { if (!first.getName().equals(second.getName())) { throw new IllegalArgumentException("Cannot merge applications with different names"); } Application merged = copyApplication(first); for (InstanceInfo instance : second.getInstances()) { switch (instance.getActionType()) { case ADDED: case MODIFIED: merged.addInstance(instance); break; case DELETED: merged.removeInstance(instance); } } return merged; }
public static Application merge(Application first, Application second) { if (!first.getName().equals(second.getName())) { throw new IllegalArgumentException("Cannot merge applications with different names"); } Application merged = copyOf(first); for (InstanceInfo instance : second.getInstances()) { switch (instance.getActionType()) { case ADDED: case MODIFIED: merged.addInstance(instance); break; case DELETED: merged.removeInstance(instance); } } return merged; }
if (existingApp != null) { logger.debug("Deleted instance {} to the existing apps ", instance.getId()); existingApp.removeInstance(instance);
instance.getId()); getApplications().getRegisteredApplications( instance.getAppName()).removeInstance(instance);
/** * Test that instancesMap in Application and shuffleVirtualHostNameMap in * Applications are correctly updated when the last instance is removed from * an application and shuffleInstances has been run. */ @Test public void shuffleVirtualHostNameMapLastInstanceTest() { DataCenterInfo myDCI = new DataCenterInfo() { public DataCenterInfo.Name getName() { return DataCenterInfo.Name.MyOwn; } }; InstanceInfo instanceInfo = InstanceInfo.Builder.newBuilder().setAppName("test") .setVIPAddress("test.testname:1").setDataCenterInfo(myDCI).setHostName("test.hostname").build(); Application application = new Application("TestApp"); application.addInstance(instanceInfo); Applications applications = new Applications(); applications.addApplication(application); applications.shuffleInstances(true); List<InstanceInfo> testApp = applications.getInstancesByVirtualHostName("test.testname:1"); assertEquals(Iterables.getOnlyElement(testApp), application.getByInstanceId("test.hostname")); application.removeInstance(instanceInfo); assertEquals(0, applications.size()); applications.shuffleInstances(true); testApp = applications.getInstancesByVirtualHostName("test.testname:1"); assertTrue(testApp.isEmpty()); assertNull(application.getByInstanceId("test.hostname")); }
application.removeInstance(instanceInfo); assertNull(application.getByInstanceId("test.hostname")); assertEquals(0, applications.size());
/** * Remove the given instance info the list. * * @param i * the instance info object to be removed. */ public void removeInstance(InstanceInfo i) { removeInstance(i, true); }
this.removeInstance(instanceInfo, false); it.remove();
public static Application mergeApplication(Application first, Application second) { if (!first.getName().equals(second.getName())) { throw new IllegalArgumentException("Cannot merge applications with different names"); } Application merged = copyApplication(first); for (InstanceInfo instance : second.getInstances()) { switch (instance.getActionType()) { case ADDED: case MODIFIED: merged.addInstance(instance); break; case DELETED: merged.removeInstance(instance); } } return merged; }
public static Application merge(Application first, Application second) { if (!first.getName().equals(second.getName())) { throw new IllegalArgumentException("Cannot merge applications with different names"); } Application merged = copyOf(first); for (InstanceInfo instance : second.getInstances()) { switch (instance.getActionType()) { case ADDED: case MODIFIED: merged.addInstance(instance); break; case DELETED: merged.removeInstance(instance); } } return merged; }
private Observable<Void> instanceResource(HttpServerRequest<ByteBuf> request, HttpServerResponse<ByteBuf> response, String appName, String instanceId) { Application app = applications.getRegisteredApplications(appName); if (app == null) { response.setStatus(HttpResponseStatus.NOT_FOUND); return Observable.empty(); } if (request.getHttpMethod() == HttpMethod.PUT) { return Observable.empty(); } if (request.getHttpMethod() == HttpMethod.DELETE) { InstanceInfo instanceInfo = app.getByInstanceId(instanceId); app.removeInstance(instanceInfo); return Observable.empty(); } return notSupportedError(request, response); }
if (existingApp != null) { logger.debug("Deleted instance {} to the existing apps ", instance.getId()); existingApp.removeInstance(instance);
instance.getId()); getApplications().getRegisteredApplications( instance.getAppName()).removeInstance(instance);