Exemplo n.º 1
0
  public void destroyContainer(Container container, boolean force) {
    assertValid();
    String containerId = container.getId();
    LOGGER.info("Destroying container {}", containerId);
    boolean destroyed = false;
    try {
      ContainerProvider provider = getProvider(container, true);
      if (provider != null) {
        try {
          provider.stop(container);
        } catch (Exception ex) {
          // Ignore error while stopping and try to destroy.
        }
        provider.destroy(container);
        destroyed = true;
      }

    } finally {
      try {
        if (destroyed || force) {
          portService.get().unregisterPort(container);
          getDataStore().deleteContainer(container.getId());
        }
      } catch (Exception e) {
        LOGGER.warn(
            "Failed to cleanup container {} entries due to: {}. This will be ignored.",
            containerId,
            e.getMessage());
      }
    }
  }
Exemplo n.º 2
0
 void unbindProvider(ContainerProvider provider) {
   providers.remove(provider.getScheme());
 }
Exemplo n.º 3
0
 public void stopContainer(Container container, boolean force) {
   assertValid();
   LOGGER.info("Stopping container {}", container.getId());
   ContainerProvider provider = getProvider(container);
   provider.stop(container);
 }
Exemplo n.º 4
0
 void bindProvider(ContainerProvider provider) {
   providers.put(provider.getScheme(), provider);
 }