All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hubspot.singularity.data.zkmigrations.AgentAndRackMigration2 Maven / Gradle / Ivy

package com.hubspot.singularity.data.zkmigrations;

import com.google.inject.Inject;
import javax.inject.Singleton;
import org.apache.curator.framework.CuratorFramework;
import org.apache.zookeeper.KeeperException.NoNodeException;

@Singleton
public class AgentAndRackMigration2 extends ZkDataMigration {
  private final CuratorFramework curator;

  @Inject
  public AgentAndRackMigration2(CuratorFramework curator) {
    super(6);
    this.curator = curator;
  }

  @Override
  public void applyMigration() {
    try {
      try {
        curator.delete().deletingChildrenIfNeeded().forPath("/slaves");
      } catch (NoNodeException nee) {}
      try {
        curator.delete().deletingChildrenIfNeeded().forPath("/racks");
      } catch (NoNodeException nee) {}
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy