com.netflix.discovery.shared.Application.removeInstance()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(73)

本文整理了Java中com.netflix.discovery.shared.Application.removeInstance()方法的一些代码示例,展示了Application.removeInstance()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Application.removeInstance()方法的具体详情如下:
包路径:com.netflix.discovery.shared.Application
类名称:Application
方法名:removeInstance

Application.removeInstance介绍

[英]Remove the given instance info the list.
[中]从列表中删除给定的实例信息。

代码示例

代码示例来源:origin: Netflix/eureka

/**
 * Remove the given instance info the list.
 *
 * @param i
 *            the instance info object to be removed.
 */
public void removeInstance(InstanceInfo i) {
  removeInstance(i, true);
}

代码示例来源:origin: Netflix/eureka

this.removeInstance(instanceInfo, false);
it.remove();

代码示例来源:origin: Netflix/eureka

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;
}

代码示例来源:origin: Netflix/eureka

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;
}

代码示例来源:origin: Netflix/eureka

if (existingApp != null) {
  logger.debug("Deleted instance {} to the existing apps ", instance.getId());
  existingApp.removeInstance(instance);

代码示例来源:origin: Netflix/eureka

instance.getId());
getApplications().getRegisteredApplications(
    instance.getAppName()).removeInstance(instance);

代码示例来源:origin: Netflix/eureka

/**
 * 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"));
}

代码示例来源:origin: Netflix/eureka

application.removeInstance(instanceInfo);
assertNull(application.getByInstanceId("test.hostname"));
assertEquals(0, applications.size());

代码示例来源:origin: com.netflix.eureka/eureka-client

/**
 * Remove the given instance info the list.
 *
 * @param i
 *            the instance info object to be removed.
 */
public void removeInstance(InstanceInfo i) {
  removeInstance(i, true);
}

代码示例来源:origin: com.netflix.eureka/eureka-client

this.removeInstance(instanceInfo, false);
it.remove();

代码示例来源:origin: com.netflix.eureka/eureka-client

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;
}

代码示例来源:origin: com.netflix.eureka/eureka-test-utils

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;
}

代码示例来源:origin: com.netflix.eureka/eureka2-test-utils

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);
}

代码示例来源:origin: com.netflix.eureka/eureka-client

if (existingApp != null) {
  logger.debug("Deleted instance {} to the existing apps ", instance.getId());
  existingApp.removeInstance(instance);

代码示例来源:origin: com.netflix.eureka/eureka-core

instance.getId());
getApplications().getRegisteredApplications(
    instance.getAppName()).removeInstance(instance);

相关文章