You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aurora.apache.org by wf...@apache.org on 2015/08/28 20:33:19 UTC

[01/21] aurora git commit: Remove unused classes from commons fork.

Repository: aurora
Updated Branches:
  refs/heads/master 06ddaadbc -> 356eeac97


http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/zookeeper/PartitionerTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/zookeeper/PartitionerTest.java b/commons/src/test/java/org/apache/aurora/common/zookeeper/PartitionerTest.java
deleted file mode 100644
index fbc2cdb..0000000
--- a/commons/src/test/java/org/apache/aurora/common/zookeeper/PartitionerTest.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.zookeeper;
-
-import com.google.common.testing.TearDown;
-
-import org.apache.aurora.common.zookeeper.testing.BaseZooKeeperTest;
-import org.apache.zookeeper.ZooDefs;
-import org.apache.zookeeper.data.ACL;
-import org.junit.Test;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-/**
- * @author John Sirois
- */
-public class PartitionerTest extends BaseZooKeeperTest {
-  private static final List<ACL> ACL = ZooDefs.Ids.OPEN_ACL_UNSAFE;
-  private static final String PARTITION_NAMESPACE = "/twitter/puffin/hosebird";
-
-  @Test
-  public void testHeterogeneousPartitionGroup() throws Exception {
-    ZooKeeperClient zkClient = createZkClient();
-    ZooKeeperUtils.ensurePath(zkClient, ACL, PARTITION_NAMESPACE + "/not-a-partition-node");
-    Partitioner partitioner = new Partitioner(zkClient, ACL, PARTITION_NAMESPACE);
-    join(partitioner);
-
-    assertEquals("Expected Partitioner to be tolerant of foreign nodes",
-        1, partitioner.getGroupSize());
-  }
-
-  private static class InstrumentedPartitioner extends Partitioner {
-    private final AtomicInteger myViewOfGroupSize = new AtomicInteger();
-
-    public InstrumentedPartitioner(ZooKeeperClient zkClient) throws IOException {
-      super(zkClient, ACL, PARTITION_NAMESPACE);
-    }
-
-    @Override
-    Group.GroupChangeListener createGroupChangeListener(Group.Membership membership) {
-      final Group.GroupChangeListener listener = super.createGroupChangeListener(membership);
-      return new Group.GroupChangeListener() {
-        @Override public void onGroupChange(Iterable<String> memberIds) {
-          listener.onGroupChange(memberIds);
-          synchronized (myViewOfGroupSize) {
-            myViewOfGroupSize.set(getGroupSize());
-            myViewOfGroupSize.notify();
-          }
-        }
-      };
-    }
-
-    public void observeGroupSize(int expectedSize) throws InterruptedException {
-      while (expectedSize != myViewOfGroupSize.get()) {
-        synchronized (myViewOfGroupSize) {
-          myViewOfGroupSize.wait();
-        }
-      }
-    }
-  }
-
-  @Test
-  public void testJoin() throws Exception {
-    // Test that the 1st member of the partition group owns the whole space.
-    InstrumentedPartitioner firstPartitioner = new InstrumentedPartitioner(createZkClient());
-    Partitioner.Partition firstPartition = join(firstPartitioner);
-
-    assertTrue(firstPartition.isMember(0L));
-    assertTrue(firstPartition.isMember(1L));
-    assertTrue(firstPartition.isMember(2L));
-
-    // Test that when additional members join partitions are added and existing partitions shrink.
-    InstrumentedPartitioner secondPartitioner = new InstrumentedPartitioner(createZkClient());
-    Partitioner.Partition secondPartition = join(secondPartitioner);
-
-    firstPartitioner.observeGroupSize(2);
-
-    assertTrue(firstPartition.isMember(0L));
-    assertFalse(secondPartition.isMember(0L));
-
-    assertFalse(firstPartition.isMember(1L));
-    assertTrue(secondPartition.isMember(1L));
-
-    assertTrue(firstPartition.isMember(2L));
-    assertFalse(secondPartition.isMember(2L));
-
-    InstrumentedPartitioner thirdPartitioner = new InstrumentedPartitioner(createZkClient());
-    Partitioner.Partition thirdPartition = join(thirdPartitioner);
-
-    firstPartitioner.observeGroupSize(3);
-    secondPartitioner.observeGroupSize(3);
-
-    assertTrue(firstPartition.isMember(0L));
-    assertFalse(secondPartition.isMember(0L));
-    assertFalse(thirdPartition.isMember(0L));
-
-    assertFalse(firstPartition.isMember(1L));
-    assertTrue(secondPartition.isMember(1L));
-    assertFalse(thirdPartition.isMember(1L));
-
-    assertFalse(firstPartition.isMember(2L));
-    assertFalse(secondPartition.isMember(2L));
-    assertTrue(thirdPartition.isMember(2L));
-
-    assertTrue(firstPartition.isMember(3L));
-    assertFalse(secondPartition.isMember(3L));
-    assertFalse(thirdPartition.isMember(3L));
-
-    // Test that members leaving the partition group results in the partitions being merged.
-    firstPartition.cancel();
-
-    secondPartitioner.observeGroupSize(2);
-    thirdPartitioner.observeGroupSize(2);
-
-    assertTrue(secondPartition.isMember(0L));
-    assertFalse(thirdPartition.isMember(0L));
-
-    assertFalse(secondPartition.isMember(1L));
-    assertTrue(thirdPartition.isMember(1L));
-
-    assertTrue(secondPartition.isMember(2L));
-    assertFalse(thirdPartition.isMember(2L));
-
-    thirdPartition.cancel();
-
-    secondPartitioner.observeGroupSize(1);
-
-    assertTrue(secondPartition.isMember(0L));
-    assertTrue(secondPartition.isMember(1L));
-    assertTrue(secondPartition.isMember(2L));
-  }
-
-  private Partitioner.Partition join(Partitioner partitioner) throws Group.JoinException, InterruptedException {
-    final Partitioner.Partition partition = partitioner.join();
-    addTearDown(new TearDown() {
-      @Override public void tearDown() throws Group.JoinException {
-        partition.cancel();
-      }
-    });
-    return partition;
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/zookeeper/ServerSetImplTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/zookeeper/ServerSetImplTest.java b/commons/src/test/java/org/apache/aurora/common/zookeeper/ServerSetImplTest.java
index 1dec34e..4db578c 100644
--- a/commons/src/test/java/org/apache/aurora/common/zookeeper/ServerSetImplTest.java
+++ b/commons/src/test/java/org/apache/aurora/common/zookeeper/ServerSetImplTest.java
@@ -15,16 +15,10 @@ package org.apache.aurora.common.zookeeper;
 
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
-import java.lang.Override;
 import java.net.InetSocketAddress;
-import java.net.ServerSocket;
-import java.net.Socket;
 import java.util.List;
 import java.util.Map;
-import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.atomic.AtomicReference;
-import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import com.google.common.base.Function;
@@ -32,39 +26,27 @@ import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Iterables;
-import com.google.common.collect.Maps;
-import com.google.common.testing.TearDown;
-import com.google.gson.GsonBuilder;
-
-import org.apache.thrift.protocol.TProtocol;
-import org.apache.zookeeper.Watcher;
-import org.apache.zookeeper.ZooDefs;
-import org.apache.zookeeper.data.ACL;
-import org.easymock.IMocksControl;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
 
 import org.apache.aurora.common.base.Command;
 import org.apache.aurora.common.io.Codec;
-import org.apache.aurora.common.io.JsonCodec;
 import org.apache.aurora.common.net.pool.DynamicHostSet;
-import org.apache.aurora.common.thrift.TResourceExhaustedException;
-import org.apache.aurora.common.thrift.Thrift;
-import org.apache.aurora.common.thrift.ThriftFactory;
-import org.apache.aurora.common.thrift.ThriftFactory.ThriftFactoryException;
-import org.apache.aurora.common.zookeeper.Group.JoinException;
-import org.apache.aurora.common.zookeeper.testing.BaseZooKeeperTest;
 import org.apache.aurora.common.thrift.Endpoint;
 import org.apache.aurora.common.thrift.ServiceInstance;
 import org.apache.aurora.common.thrift.Status;
+import org.apache.aurora.common.zookeeper.Group.JoinException;
+import org.apache.aurora.common.zookeeper.testing.BaseZooKeeperTest;
+import org.apache.zookeeper.Watcher;
+import org.apache.zookeeper.ZooDefs;
+import org.apache.zookeeper.data.ACL;
+import org.easymock.IMocksControl;
+import org.junit.Before;
+import org.junit.Test;
 
 import static org.easymock.EasyMock.anyObject;
 import static org.easymock.EasyMock.createControl;
 import static org.easymock.EasyMock.expect;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
@@ -256,25 +238,16 @@ public class ServerSetImplTest extends BaseZooKeeperTest {
     assertFalse(ServerSets.deserializeServiceInstance(data, codec).isSetShard());
   }
 
-  @Ignore("TODO(zmanji): Fix to work with thrift 0.9.0")
   @Test
-  public void testJsonCodecCompatibility() throws IOException {
+  public void testJsonCompatibility() throws IOException {
     ServiceInstance instance = new ServiceInstance(
         new Endpoint("foo", 1000),
         ImmutableMap.of("http", new Endpoint("foo", 8080)),
         Status.ALIVE).setShard(42);
 
-    ByteArrayOutputStream legacy = new ByteArrayOutputStream();
-    JsonCodec.create(
-        ServiceInstance.class,
-        new GsonBuilder().setExclusionStrategies(JsonCodec.getThriftExclusionStrategy())
-            .create()).serialize(instance, legacy);
-
     ByteArrayOutputStream results = new ByteArrayOutputStream();
     ServerSetImpl.createJsonCodec().serialize(instance, results);
 
-    assertEquals(legacy.toString(), results.toString());
-
     results = new ByteArrayOutputStream();
     ServerSetImpl.createJsonCodec().serialize(instance, results);
     assertEquals(
@@ -285,48 +258,6 @@ public class ServerSetImplTest extends BaseZooKeeperTest {
         results.toString());
   }
 
-  //TODO(Jake Mannix) move this test method to ServerSetConnectionPoolTest, which should be renamed
-  // to DynamicBackendConnectionPoolTest, and refactor assertChangeFired* methods to be used both
-  // here and there
-  @Test
-  public void testThriftWithServerSet() throws Exception {
-    final AtomicReference<Socket> clientConnection = new AtomicReference<Socket>();
-    final CountDownLatch connected = new CountDownLatch(1);
-    final ServerSocket server = new ServerSocket(0);
-    Thread service = new Thread(new Runnable() {
-      @Override public void run() {
-        try {
-          clientConnection.set(server.accept());
-        } catch (IOException e) {
-          LOG.log(Level.WARNING, "Problem accepting a connection to thrift server", e);
-        } finally {
-          connected.countDown();
-        }
-      }
-    });
-    service.setDaemon(true);
-    service.start();
-
-    ServerSetImpl serverSetImpl = new ServerSetImpl(createZkClient(), SERVICE);
-    serverSetImpl.watch(serverSetMonitor);
-    assertChangeFiredEmpty();
-    InetSocketAddress localSocket = new InetSocketAddress(server.getLocalPort());
-    serverSetImpl.join(localSocket, Maps.<String, InetSocketAddress>newHashMap());
-    assertChangeFired(ImmutableMap.<InetSocketAddress, Status>of(localSocket, Status.ALIVE));
-
-    Service.Iface svc = createThriftClient(serverSetImpl);
-    try {
-      String value = svc.getString();
-      LOG.info("Got value: " + value + " from server");
-      assertEquals(Service.Iface.DONE, value);
-    } catch (TResourceExhaustedException e) {
-      fail("ServerSet is not empty, should not throw exception here");
-    } finally {
-      connected.await();
-      server.close();
-    }
-  }
-
   @Test
   public void testUnwatchOnException() throws Exception {
     IMocksControl control = createControl();
@@ -356,38 +287,10 @@ public class ServerSetImplTest extends BaseZooKeeperTest {
     control.verify();
   }
 
-  private Service.Iface createThriftClient(DynamicHostSet<ServiceInstance> serverSet)
-      throws ThriftFactoryException {
-
-    final Thrift<Service.Iface> thrift = ThriftFactory.create(Service.Iface.class).build(serverSet);
-    addTearDown(new TearDown() {
-      @Override public void tearDown() {
-        thrift.close();
-      }
-    });
-    return thrift.create();
-  }
-
   private static Map<String, InetSocketAddress> makePortMap(String name, int port) {
     return ImmutableMap.of(name, InetSocketAddress.createUnresolved("foo", port));
   }
 
-  public static class Service {
-    public static interface Iface {
-      public static final String DONE = "done";
-      public String getString() throws TResourceExhaustedException;
-    }
-
-    public static class Client implements Iface {
-      public Client(TProtocol protocol) {
-        assertNotNull(protocol);
-      }
-      @Override public String getString() {
-        return DONE;
-      }
-    }
-  }
-
   private ServerSet.EndpointStatus join(ServerSet serverSet, String host)
       throws JoinException, InterruptedException {
 

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/zookeeper/StaticServerSetTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/zookeeper/StaticServerSetTest.java b/commons/src/test/java/org/apache/aurora/common/zookeeper/StaticServerSetTest.java
deleted file mode 100644
index 9c98951..0000000
--- a/commons/src/test/java/org/apache/aurora/common/zookeeper/StaticServerSetTest.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.zookeeper;
-
-import java.net.InetSocketAddress;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import org.apache.aurora.common.net.pool.DynamicHostSet.HostChangeMonitor;
-import org.apache.aurora.common.testing.easymock.EasyMockTest;
-
-import org.apache.aurora.common.thrift.Endpoint;
-import org.apache.aurora.common.thrift.ServiceInstance;
-import org.apache.aurora.common.thrift.Status;
-
-public class StaticServerSetTest extends EasyMockTest {
-
-  private static final ServiceInstance BACKEND_1 = new ServiceInstance(
-      new Endpoint("host_1", 12345),
-      ImmutableMap.of("http", new Endpoint("host_1", 80)),
-      Status.ALIVE);
-  private static final ServiceInstance BACKEND_2 = new ServiceInstance(
-      new Endpoint("host_2", 12346),
-      ImmutableMap.of("http", new Endpoint("host_1", 80)),
-      Status.ALIVE);
-
-  private HostChangeMonitor<ServiceInstance> monitor;
-
-  @Before
-  public void setUp() {
-    monitor = createMock(new Clazz<HostChangeMonitor<ServiceInstance>>() { });
-  }
-
-  @Test
-  public void testMonitor() throws Exception {
-    ImmutableSet<ServiceInstance> hosts = ImmutableSet.of(BACKEND_1, BACKEND_2);
-    monitor.onChange(hosts);
-
-    control.replay();
-
-    ServerSet serverSet = new StaticServerSet(hosts);
-    serverSet.monitor(monitor);
-  }
-
-  @Test
-  public void testMonitorEmpty() throws Exception {
-    ImmutableSet<ServiceInstance> hosts = ImmutableSet.of();
-    monitor.onChange(hosts);
-
-    control.replay();
-
-    ServerSet serverSet = new StaticServerSet(hosts);
-    serverSet.monitor(monitor);
-  }
-
-  @Test
-  public void testJoin() throws Exception {
-    // Ensure join/update calls don't break.
-    ImmutableSet<ServiceInstance> hosts = ImmutableSet.of();
-
-    control.replay();
-
-    ServerSet serverSet = new StaticServerSet(hosts);
-    ServerSet.EndpointStatus status = serverSet.join(
-        InetSocketAddress.createUnresolved("host", 1000),
-        ImmutableMap.<String, InetSocketAddress>of(),
-        Status.ALIVE);
-    status.update(Status.DEAD);
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/zookeeper/ZooKeeperMapTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/zookeeper/ZooKeeperMapTest.java b/commons/src/test/java/org/apache/aurora/common/zookeeper/ZooKeeperMapTest.java
deleted file mode 100644
index 993ab64..0000000
--- a/commons/src/test/java/org/apache/aurora/common/zookeeper/ZooKeeperMapTest.java
+++ /dev/null
@@ -1,418 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.zookeeper;
-
-import java.util.AbstractMap.SimpleEntry;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.LinkedBlockingQueue;
-
-import com.google.common.base.Function;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-
-import org.apache.zookeeper.CreateMode;
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.ZooDefs;
-import org.apache.zookeeper.data.ACL;
-import org.junit.Before;
-import org.junit.Test;
-
-import org.apache.aurora.common.base.Command;
-import org.apache.aurora.common.collections.Pair;
-import org.apache.aurora.common.zookeeper.ZooKeeperMap.Listener;
-import org.apache.aurora.common.zookeeper.testing.BaseZooKeeperTest;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-public class ZooKeeperMapTest extends BaseZooKeeperTest {
-
-  private static final List<ACL> ACL = ZooDefs.Ids.OPEN_ACL_UNSAFE;
-  private static final Function<byte[], String> BYTES_TO_STRING =
-      new Function<byte[], String>() {
-        @Override
-        public String apply(byte[] from) {
-          return new String(from);
-        }};
-
-  private static class TestListener implements ZooKeeperMap.Listener<String> {
-    private final BlockingQueue<Pair<String, String>> queue =
-        new LinkedBlockingQueue<Pair<String, String>>();
-
-    public Pair<String, String> waitForUpdate() throws InterruptedException {
-      return queue.take();
-    }
-
-    @Override
-    public void nodeChanged(String name, String value) {
-      queue.offer(Pair.of(name, value));
-    }
-
-    @Override
-    public void nodeRemoved(String name) {
-      queue.offer(Pair.of(name, (String) null));
-    }
-  }
-
-  private ZooKeeperClient zkClient;
-  private BlockingQueue<Pair<String, String>> entryChanges;
-
-  @Before
-  public void mySetUp() throws Exception {
-    zkClient = createZkClient();
-    entryChanges = new LinkedBlockingQueue<Pair<String, String>>();
-  }
-
-  @Test(expected = KeeperException.NoNodeException.class)
-  public void testMissingPath() throws Exception {
-    makeMap("/twitter/doesnt/exist");
-  }
-
-  @Test(expected = KeeperException.class)
-  public void testZooKeeperUnavailableAtConstruction() throws Exception {
-    final String parentPath = "/twitter/path";
-    ZooKeeperUtils.ensurePath(zkClient, ACL, parentPath);
-
-    shutdownNetwork();  // Make zk unavailable.
-
-    makeUninitializedMap(parentPath);
-  }
-
-  @Test(expected = KeeperException.class)
-  public void testZooKeeperUnavailableAtInit() throws Exception {
-    final String parentPath = "/twitter/path";
-    ZooKeeperUtils.ensurePath(zkClient, ACL, parentPath);
-    ZooKeeperMap<String> zkMap = makeUninitializedMap(parentPath);
-
-    shutdownNetwork();  // Make zk unavailable.
-
-    zkMap.init();
-  }
-
-  @Test
-  public void testInitialization() throws Exception {
-    final String parentPath = "/twitter/path";
-    final String node = "node";
-    final String nodePath = parentPath + "/" + node;
-    final String data = "abcdefg";
-
-    ZooKeeperUtils.ensurePath(zkClient, ACL, parentPath);
-    zkClient.get().create(nodePath, data.getBytes(), ACL, CreateMode.PERSISTENT);
-    ZooKeeperMap<String> zkMap = makeUninitializedMap(parentPath);
-
-    // Map should be empty before initialization
-    assertTrue(zkMap.isEmpty());
-
-    zkMap.init();
-
-    // Now that we've initialized, the data should be synchronously reflected.
-    assertFalse(zkMap.isEmpty());
-    assertEquals(1, zkMap.size());
-    assertEquals(data, zkMap.get(node));
-  }
-
-  @Test
-  public void testEmptyStaticMap() throws Exception {
-    final String parentPath = "/twitter/path";
-    ZooKeeperUtils.ensurePath(zkClient, ACL, parentPath);
-    Map<String, String> zkMap = makeMap(parentPath);
-
-    assertEquals(0, zkMap.size());
-    assertTrue(zkMap.isEmpty());
-  }
-
-  @Test
-  public void testStaticMapWithValues() throws Exception {
-    final String parentPath = "/twitter/path";
-    final String node1 = "node1";
-    final String node2 = "node2";
-    final String nodePath1 = parentPath + "/" + node1;
-    final String nodePath2 = parentPath + "/" + node2;
-    final String data1 = "hello World!";
-    final String data2 = "evrver232&$";
-    ZooKeeperUtils.ensurePath(zkClient, ACL, parentPath);
-    zkClient.get().create(nodePath1, data1.getBytes(), ACL, CreateMode.PERSISTENT);
-    zkClient.get().create(nodePath2, data2.getBytes(), ACL, CreateMode.PERSISTENT);
-
-    Map<String, String> zkMap = makeMap(parentPath);
-
-    // Test all java.util.Map operations that are implemented.
-    assertTrue(zkMap.containsKey(node1));
-    assertTrue(zkMap.containsKey(node2));
-    assertTrue(zkMap.containsValue(data1));
-    assertTrue(zkMap.containsValue(data2));
-    assertEquals(ImmutableSet.of(new SimpleEntry<String, String>(node1, data1),
-        new SimpleEntry<String, String>(node2, data2)), zkMap.entrySet());
-    assertEquals(data1, zkMap.get(node1));
-    assertEquals(data2, zkMap.get(node2));
-    assertFalse(zkMap.isEmpty());
-    assertEquals(ImmutableSet.of(node1, node2),
-        zkMap.keySet());
-    assertEquals(2, zkMap.size());
-  }
-
-  @Test
-  public void testChangingChildren() throws Exception {
-    final String parentPath = "/twitter/path";
-    final String node1 = "node1";
-    final String node2 = "node2";
-    final String nodePath1 = parentPath + "/" + node1;
-    final String nodePath2 = parentPath + "/" + node2;
-    final String data1 = "wefwe";
-    final String data2 = "rtgrtg";
-
-    ZooKeeperUtils.ensurePath(zkClient, ACL, parentPath);
-    zkClient.get().create(nodePath1, data1.getBytes(), ACL, CreateMode.PERSISTENT);
-
-    Map<String, String> zkMap = makeMap(parentPath);
-    assertEquals(1, zkMap.size());
-    assertEquals(data1, zkMap.get(node1));
-    assertEquals(null, zkMap.get(node2));
-
-    // Make sure the map is updated when a child is added.
-    zkClient.get().create(nodePath2, data2.getBytes(), ACL, CreateMode.PERSISTENT);
-    waitForEntryChange(node2, data2);
-    assertEquals(2, zkMap.size());
-    assertEquals(data1, zkMap.get(node1));
-    assertEquals(data2, zkMap.get(node2));
-
-    // Make sure the map is updated when a child is deleted.
-    zkClient.get().delete(nodePath1, -1);
-    waitForEntryChange(node1, null);
-    assertEquals(1, zkMap.size());
-    assertEquals(null, zkMap.get(node1));
-    assertEquals(data2, zkMap.get(node2));
-  }
-
-  @Test
-  public void testChangingChildValues() throws Exception {
-    final String parentPath = "/twitter/path";
-    final String node = "node";
-    final String nodePath = parentPath + "/" + node;
-
-    final String data1 = "";
-    final String data2 = "abc";
-    final String data3 = "lalala";
-
-    ZooKeeperUtils.ensurePath(zkClient, ACL, parentPath);
-    zkClient.get().create(nodePath, data1.getBytes(), ACL, CreateMode.PERSISTENT);
-
-    TestListener testListener = new TestListener();
-    Map<String, String> zkMap = makeMap(parentPath, testListener);
-
-    assertEquals(Pair.of(node, data1), testListener.waitForUpdate());
-
-    assertEquals(1, zkMap.size());
-    assertEquals(data1, zkMap.get(node));
-
-    zkClient.get().setData(nodePath, data2.getBytes(), -1);
-    waitForEntryChange(node, data2);
-    assertEquals(1, zkMap.size());
-
-    assertEquals(Pair.of(node, data2), testListener.waitForUpdate());
-
-    zkClient.get().setData(nodePath, data3.getBytes(), -1);
-    waitForEntryChange(node, data3);
-    assertEquals(1, zkMap.size());
-
-    assertEquals(Pair.of(node, data3), testListener.waitForUpdate());
-  }
-
-  @Test
-  public void testRemoveParentNode() throws Exception {
-    final String parentPath = "/twitter/path";
-    final String node = "node";
-    final String nodePath = parentPath + "/" + node;
-    final String data = "testdata";
-
-    ZooKeeperUtils.ensurePath(zkClient, ACL, parentPath);
-    zkClient.get().create(nodePath, data.getBytes(), ACL, CreateMode.PERSISTENT);
-
-    TestListener testListener = new TestListener();
-    Map<String, String> zkMap = makeMap(parentPath, testListener);
-    assertEquals(1, zkMap.size());
-    assertEquals(data, zkMap.get(node));
-
-    assertEquals(Pair.of(node, data), testListener.waitForUpdate());
-
-    zkClient.get().delete(nodePath, -1);
-    zkClient.get().delete(parentPath, -1);
-
-    assertEquals(Pair.of(node, null), testListener.waitForUpdate());
-
-    waitForEntryChange(node, null);
-    assertEquals(0, zkMap.size());
-    assertTrue(zkMap.isEmpty());
-
-    // Recreate our node, make sure the map observes it.
-    ZooKeeperUtils.ensurePath(zkClient, ACL, parentPath);
-    zkClient.get().create(nodePath, data.getBytes(), ACL, CreateMode.PERSISTENT);
-    waitForEntryChange(node, data);
-  }
-
-  @Test
-  public void testSessionExpireLogic() throws Exception {
-    final String parentPath = "/twitter/path";
-    final String node1 = "node1";
-    final String nodePath1 = parentPath + "/" + node1;
-    final String data1 = "testdata";
-
-    ZooKeeperUtils.ensurePath(zkClient, ACL, parentPath);
-    zkClient.get().create(nodePath1, data1.getBytes(), ACL, CreateMode.PERSISTENT);
-
-    Map<String, String> zkMap = makeMap(parentPath);
-    assertEquals(1, zkMap.size());
-    assertEquals(data1, zkMap.get(node1));
-
-    expireSession(zkClient);
-    assertEquals(1, zkMap.size());
-    assertEquals(data1, zkMap.get(node1));
-
-    final String node2 = "node2";
-    final String nodePath2 = parentPath + "/" + node2;
-    final String data2 = "testdata2";
-    zkClient = createZkClient();
-    zkClient.get().create(nodePath2, data2.getBytes(), ACL, CreateMode.PERSISTENT);
-
-    waitForEntryChange(node2, data2);
-    assertEquals(2, zkMap.size());
-    assertEquals(data2, zkMap.get(node2));
-  }
-
-  @Test
-  public void testStaticCreate() throws Exception {
-    String parentPath = "/twitter/path";
-    String node = "node";
-    String nodePath = parentPath + "/" + node;
-    String data = "DaTa";
-
-    ZooKeeperUtils.ensurePath(zkClient, ACL, parentPath);
-    zkClient.get().create(nodePath, data.getBytes(), ACL, CreateMode.PERSISTENT);
-
-    Map<String, String> zkMap = ZooKeeperMap.create(zkClient, parentPath, BYTES_TO_STRING);
-    assertEquals(1, zkMap.size());
-    assertEquals(data, zkMap.get(node));
-  }
-
-  private static void checkUnsupported(Command test) {
-    try {
-      test.execute();
-      fail("Expected UnsupportedOperationException to be thrown.");
-    } catch (UnsupportedOperationException e) {
-      // expected
-    }
-  }
-
-  @Test
-  public void testReadOnly() throws Exception {
-    String parentPath = "/twitter/path";
-    final String node = "node";
-    String nodePath = parentPath + "/" + node;
-    String data = "DaTa";
-
-    ZooKeeperUtils.ensurePath(zkClient, ACL, parentPath);
-    zkClient.get().create(nodePath, data.getBytes(), ACL, CreateMode.PERSISTENT);
-
-    final Map<String, String> zkMap = ZooKeeperMap.create(zkClient, parentPath, BYTES_TO_STRING);
-    checkUnsupported(new Command() {
-      @Override public void execute() {
-        zkMap.clear();
-      }
-    });
-    checkUnsupported(new Command() {
-      @Override public void execute() {
-        zkMap.remove(node);
-      }
-    });
-    checkUnsupported(new Command() {
-      @Override public void execute() {
-        zkMap.put("othernode", "othervalue");
-      }
-    });
-    checkUnsupported(new Command() {
-      @Override public void execute() {
-        zkMap.putAll(ImmutableMap.of("othernode", "othervalue"));
-      }
-    });
-    checkUnsupported(new Command() {
-      @Override public void execute() {
-        zkMap.keySet().iterator().remove();
-      }
-    });
-    checkUnsupported(new Command() {
-      @Override public void execute() {
-        zkMap.values().iterator().remove();
-      }
-    });
-    checkUnsupported(new Command() {
-      @Override public void execute() {
-        zkMap.entrySet().iterator().remove();
-      }
-    });
-
-    // Ensure contents didn't change
-    assertEquals(1, zkMap.size());
-    assertEquals(data, zkMap.get(node));
-  }
-
-  private void waitForEntryChange(String key, String value) throws Exception {
-    Pair<String, String> expectedEntry = Pair.of(key, value);
-    while (true) {
-      Pair<String, String> nextEntry = entryChanges.take();
-      if (expectedEntry.equals(nextEntry)) {
-        return;
-      }
-    }
-  }
-
-  private Map<String, String> makeMap(String path) throws Exception {
-    return makeMap(path, ZooKeeperMap.<String>noopListener());
-  }
-
-  private Map<String, String> makeMap(String path, ZooKeeperMap.Listener<String> listener)
-      throws Exception {
-
-    ZooKeeperMap<String> zkMap = makeUninitializedMap(path, listener);
-    zkMap.init();
-    return zkMap;
-  }
-
-  private ZooKeeperMap<String> makeUninitializedMap(String path) throws Exception {
-    return makeUninitializedMap(path, ZooKeeperMap.<String>noopListener());
-  }
-
-  private ZooKeeperMap<String> makeUninitializedMap(String path, Listener<String> listener)
-      throws Exception {
-
-    return new ZooKeeperMap<String>(zkClient, path, BYTES_TO_STRING, listener) {
-      @Override void putEntry(String key, String value) {
-        super.putEntry(key, value);
-        recordEntryChange(key);
-      }
-
-      @Override void removeEntry(String key) {
-        super.removeEntry(key);
-        recordEntryChange(key);
-      }
-
-      private void recordEntryChange(String key) {
-        entryChanges.offer(Pair.of(key, get(key)));
-      }
-    };
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/zookeeper/ZooKeeperNodeTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/zookeeper/ZooKeeperNodeTest.java b/commons/src/test/java/org/apache/aurora/common/zookeeper/ZooKeeperNodeTest.java
deleted file mode 100644
index fd1bb22..0000000
--- a/commons/src/test/java/org/apache/aurora/common/zookeeper/ZooKeeperNodeTest.java
+++ /dev/null
@@ -1,297 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.zookeeper;
-
-import java.util.List;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.apache.zookeeper.CreateMode;
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.KeeperException.NoNodeException;
-import org.apache.zookeeper.Watcher;
-import org.apache.zookeeper.ZooDefs;
-import org.apache.zookeeper.ZooKeeper;
-import org.apache.zookeeper.data.ACL;
-import org.apache.zookeeper.data.Stat;
-import org.easymock.Capture;
-import org.junit.Before;
-import org.junit.Test;
-
-import org.apache.aurora.common.base.Closure;
-import org.apache.aurora.common.base.Closures;
-import org.apache.aurora.common.base.Command;
-import org.apache.aurora.common.testing.easymock.EasyMockTest;
-import org.apache.aurora.common.zookeeper.ZooKeeperNode.NodeDeserializer;
-import org.apache.aurora.common.zookeeper.testing.BaseZooKeeperTest;
-
-import static org.easymock.EasyMock.aryEq;
-import static org.easymock.EasyMock.capture;
-import static org.easymock.EasyMock.eq;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.isA;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertSame;
-
-public class ZooKeeperNodeTest {
-  public static class LightWeightTests extends EasyMockTest {
-    private ZooKeeperClient zooKeeperClient;
-    private ZooKeeper zk;
-    private NodeDeserializer<String> deserializer;
-    private Closure<String> dataUpdateListener;
-    private ZooKeeperNode<String> node;
-
-    @Before
-    public void setUp() {
-      zooKeeperClient = createMock(ZooKeeperClient.class);
-      zk = createMock(ZooKeeper.class);
-      deserializer = createMock(new Clazz<NodeDeserializer<String>>() { });
-      dataUpdateListener = createMock(new Clazz<Closure<String>>() { });
-      node = new ZooKeeperNode<String>(zooKeeperClient, "/foo", deserializer, dataUpdateListener);
-    }
-
-    @Test
-    public void testWatchersReused() throws Exception {
-      // 1st init with initial no node exception
-      expect(zooKeeperClient.registerExpirationHandler(isA(Command.class))).andReturn(null);
-      expect(zooKeeperClient.get()).andReturn(zk);
-      Capture<Watcher> dataWatcher1 = createCapture();
-      expect(zk.getData(eq("/foo"), capture(dataWatcher1), isA(Stat.class)))
-          .andThrow(new NoNodeException()); // Force an existence watch to be set
-      dataUpdateListener.execute(null);
-
-      expect(zooKeeperClient.get()).andReturn(zk);
-      Capture<Watcher> existenceWatcher1 = createCapture();
-      expect(zk.exists(eq("/foo"), capture(existenceWatcher1))).andReturn(new Stat());
-
-      expect(zooKeeperClient.get()).andReturn(zk);
-      Capture<Watcher> dataWatcher2 = createCapture();
-      expect(zk.getData(eq("/foo"), capture(dataWatcher2), isA(Stat.class)))
-          .andReturn("bob".getBytes());
-      expect(deserializer.deserialize(aryEq("bob".getBytes()), isA(Stat.class))).andReturn("fred");
-      dataUpdateListener.execute("fred");
-
-      // 2nd init with initial no node exception
-      expect(zooKeeperClient.registerExpirationHandler(isA(Command.class))).andReturn(null);
-      expect(zooKeeperClient.get()).andReturn(zk);
-      Capture<Watcher> dataWatcher3 = createCapture();
-      expect(zk.getData(eq("/foo"), capture(dataWatcher3), isA(Stat.class)))
-          .andThrow(new NoNodeException()); // Force an existence watch to be set
-      dataUpdateListener.execute(null);
-
-      expect(zooKeeperClient.get()).andReturn(zk);
-      Capture<Watcher> existenceWatcher2 = createCapture();
-      expect(zk.exists(eq("/foo"), capture(existenceWatcher2))).andReturn(new Stat());
-
-      expect(zooKeeperClient.get()).andReturn(zk);
-      Capture<Watcher> dataWatcher4 = createCapture();
-      expect(zk.getData(eq("/foo"), capture(dataWatcher4), isA(Stat.class)))
-          .andReturn("bip".getBytes());
-      expect(deserializer.deserialize(aryEq("bip".getBytes()), isA(Stat.class))).andReturn("frog");
-      dataUpdateListener.execute("frog");
-
-      control.replay();
-
-      node.init();
-      node.init();
-
-      assertSame(dataWatcher1.getValue(), dataWatcher2.getValue());
-      assertSame(dataWatcher2.getValue(), dataWatcher3.getValue());
-      assertSame(dataWatcher3.getValue(), dataWatcher4.getValue());
-
-      assertSame(existenceWatcher1.getValue(), existenceWatcher2.getValue());
-    }
-  }
-
-  public static class HeavyWeightTests extends BaseZooKeeperTest {
-
-    private static final List<ACL> ACL = ZooDefs.Ids.OPEN_ACL_UNSAFE;
-
-    private ZooKeeperClient zkClient;
-
-    private static class Listener<T> implements Closure<T> {
-      // We use AtomicReference as a wrapper since LinkedBlockingQueue does not allow null values.
-      private final BlockingQueue<AtomicReference<T>> queue =
-          new LinkedBlockingQueue<AtomicReference<T>>();
-
-      public void execute(T item) {
-        queue.offer(new AtomicReference<T>(item));
-      }
-
-      public T waitForUpdate() throws InterruptedException {
-        return queue.take().get();
-      }
-    }
-
-    private String nodePath;
-
-    @Before
-    public void mySetUp() throws Exception {
-      zkClient = createZkClient();
-      ZooKeeperUtils.ensurePath(zkClient, ACL, "/twitter");
-      nodePath = "/twitter/node";
-    }
-
-    @Test
-    public void testZooKeeperUnavailableAtConstruction() throws Exception {
-      shutdownNetwork();  // Make zk unavailable.
-
-      // Should be fine.
-      makeUninitializedNode(nodePath, Closures.<String>noop());
-    }
-
-    @Test(expected = KeeperException.class)
-    public void testZooKeeperUnavailableAtInit() throws Exception {
-      ZooKeeperNode zkNode = makeUninitializedNode(nodePath, Closures.<String>noop());
-
-      shutdownNetwork();  // Make zk unavailable.
-
-      zkNode.init();
-    }
-
-    @Test
-    public void testInitialization() throws Exception {
-      String data = "abcdefg";
-      zkClient.get().create(nodePath, data.getBytes(), ACL, CreateMode.PERSISTENT);
-      ZooKeeperNode zkNode = makeUninitializedNode(nodePath, Closures.<String>noop());
-
-      // get() should return null before initialization
-      assertEquals(null, zkNode.get());
-
-      zkNode.init();
-
-      // Now that init has been called, the data should be synchronously reflected.
-      assertEquals(data, zkNode.get());
-    }
-
-    @Test
-    public void testInitialEmptyNode() throws Exception {
-      Listener<String> listener = new Listener<String>();
-      ZooKeeperNode<String> zkNode = makeUninitializedNode(nodePath, listener);
-
-      assertEquals(null, zkNode.get());
-      zkNode.init();
-      assertEquals(null, listener.waitForUpdate());
-
-      String data = "abcdefg";
-      zkClient.get().create(nodePath, data.getBytes(), ACL, CreateMode.PERSISTENT);
-      assertEquals(data, listener.waitForUpdate());
-    }
-
-    @Test
-    public void testChangingData() throws Exception {
-      String data1 = "test_data";
-      zkClient.get().create(nodePath, data1.getBytes(), ACL, CreateMode.PERSISTENT);
-      Listener<String> listener = new Listener<String>();
-      TestDeserializer deserializer = new TestDeserializer();
-      makeNode(deserializer, nodePath, listener);
-
-      assertEquals(data1, listener.waitForUpdate());
-      assertNotNull(deserializer.getStat());
-      assertEquals(0, deserializer.getStat().getVersion());
-      String data2 = "BLAH";
-      zkClient.get().setData(nodePath, data2.getBytes(), -1);
-      assertEquals(data2, listener.waitForUpdate());
-      assertEquals(1, deserializer.getStat().getVersion());
-    }
-
-    @Test
-    public void testRemoveNode() throws Exception {
-      String data = "testdata";
-      zkClient.get().create(nodePath, data.getBytes(), ACL, CreateMode.PERSISTENT);
-      Listener<String> listener = new Listener<String>();
-      TestDeserializer deserializer = new TestDeserializer();
-      makeNode(deserializer, nodePath, listener);
-
-      assertEquals(data, listener.waitForUpdate());
-      assertNotNull(deserializer.getStat());
-      assertEquals(0, deserializer.getStat().getVersion());
-
-      zkClient.get().delete(nodePath, -1);
-      assertEquals(null, listener.waitForUpdate());
-      assertEquals(0, deserializer.getStat().getVersion());
-
-      zkClient.get().create(nodePath, data.getBytes(), ACL, CreateMode.PERSISTENT);
-      assertEquals(data, listener.waitForUpdate());
-      assertEquals(0, deserializer.getStat().getVersion());
-    }
-
-    @Test
-    public void testSessionExpireLogic() throws Exception {
-      String data1 = "testdata";
-      zkClient.get().create(nodePath, data1.getBytes(), ACL, CreateMode.PERSISTENT);
-      Listener<String> listener = new Listener<String>();
-      TestDeserializer deserializer = new TestDeserializer();
-      makeNode(deserializer, nodePath, listener);
-
-      assertEquals(data1, listener.waitForUpdate());
-      assertNotNull(deserializer.getStat());
-      assertEquals(0, deserializer.getStat().getVersion());
-
-      expireSession(zkClient);
-      assertEquals(data1, listener.waitForUpdate());
-
-      String data2 = "avewf";
-      zkClient = createZkClient();
-      zkClient.get().setData(nodePath, data2.getBytes(), -1);
-      assertEquals(data2, listener.waitForUpdate());
-      assertEquals(1, deserializer.getStat().getVersion());
-    }
-
-    @Test
-    public void testStaticCreate() throws Exception {
-      String data = "stuff";
-      zkClient.get().create(nodePath, data.getBytes(), ACL, CreateMode.PERSISTENT);
-      ZooKeeperNode<String> zkNode = ZooKeeperNode.create(zkClient, nodePath, new TestDeserializer());
-      assertEquals(data, zkNode.get());
-    }
-
-    private ZooKeeperNode<String> makeNode(TestDeserializer deserializer, String path,
-        Closure<String> listener) throws Exception {
-      ZooKeeperNode<String> zkNode = makeUninitializedNode(deserializer, path, listener);
-      zkNode.init();
-      return zkNode;
-    }
-
-    private ZooKeeperNode<String> makeUninitializedNode(String path, Closure<String> listener)
-        throws Exception {
-      return makeUninitializedNode(new TestDeserializer(), path, listener);
-    }
-
-    private ZooKeeperNode<String> makeUninitializedNode(
-        ZooKeeperNode.NodeDeserializer<String> deserializer, String path, Closure<String> listener)
-        throws Exception {
-      // we test deserializertionWithPair primarily because it is deserializertionally a proper
-      // superset of deserializertionWithByteArray
-      return new ZooKeeperNode<String>(zkClient, path, deserializer, listener);
-    }
-
-    // helper to test Stat population and retrieval
-    private static final class TestDeserializer implements ZooKeeperNode.NodeDeserializer<String> {
-      private Stat stat = null;
-
-      @Override
-      public String deserialize(byte[] data, Stat stat) {
-        this.stat = stat;
-        return new String(data);
-      }
-
-      Stat getStat() {
-        return stat;
-      }
-    }
-  }
-}


[20/21] aurora git commit: Remove unused classes from commons fork.

Posted by wf...@apache.org.
http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/io/Base64ZlibCodec.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/io/Base64ZlibCodec.java b/commons/src/main/java/org/apache/aurora/common/io/Base64ZlibCodec.java
deleted file mode 100644
index ed36e2a..0000000
--- a/commons/src/main/java/org/apache/aurora/common/io/Base64ZlibCodec.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.io;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.UnsupportedEncodingException;
-import java.io.Writer;
-import java.nio.charset.Charset;
-import java.util.zip.DeflaterOutputStream;
-import java.util.zip.GZIPInputStream;
-import java.util.zip.InflaterInputStream;
-
-import com.google.common.base.Preconditions;
-import com.google.common.base.Throwables;
-import com.google.common.io.ByteStreams;
-
-import org.apache.commons.codec.binary.Base64;
-import org.apache.commons.codec.binary.Base64OutputStream;
-
-/**
- * Utility class providing encoding and decoding methods to and from a string to a utf-8 encoded,
- * zlib compressed, Base64 encoded representation of the string. For wider compatibility, the
- * decoder can also automatically recognize GZIP (instead of plain zlib) compressed data too and
- * decode it accordingly.
- *
- * @author Attila Szegedi
- */
-public final class Base64ZlibCodec {
-  /**
-   * Thrown to indicate invalid data while decoding or unzipping.
-   *
-   * @author Attila Szegedi
-   */
-  public static class InvalidDataException extends Exception {
-    private static final long serialVersionUID = 1L;
-
-    public InvalidDataException(String message) {
-      super(message);
-    }
-
-    public InvalidDataException(String message, Throwable cause) {
-      super(message, cause);
-    }
-  }
-
-  /**
-   * Text encoding used by the Base64 output stream.
-   */
-  public static final String BASE64_TEXT_ENCODING = "ASCII";
-  private static final int ESTIMATED_PLAINTEXT_TO_ENCODED_RATIO = 4;
-
-  // Prefix all Base64-encoded, zlib compressed data must have
-  private static final byte[] ZLIB_HEADER_PREFIX = new byte[] { 120 };
-  // Prefix all Base64-encoded, GZIP compressed data must have
-  private static final byte[] GZIP_HEADER_PREFIX = new byte[] {31, -117, 8, 0, 0, 0, 0, 0, 0 };
-  private static final int DIAGNOSTIC_PREFIX_LENGTH = 16;
-  // Text encoding for char-to-byte transformation before compressing a stack trace
-  private static final Charset TEXT_ENCODING = com.google.common.base.Charsets.UTF_8;
-
-  private Base64ZlibCodec() {
-    // Utility class
-  }
-
-  /**
-   * Decodes a string. In addition to zlib, it also automatically detects GZIP compressed data and
-   * adjusts accordingly.
-   *
-   * @param encoded the encoded string, represented as a byte array of ASCII-encoded characters
-   * @return the decoded string
-   * @throws InvalidDataException if the string can not be decoded.
-   */
-  public static byte[] decode(String encoded) throws InvalidDataException {
-    Preconditions.checkNotNull(encoded);
-    return decompress(new Base64().decode(encoded));
-  }
-
-  private static byte[] decompress(byte[] compressed) throws InvalidDataException {
-    byte[] bytes;
-    try {
-      final InputStream bin = new ByteArrayInputStream(compressed);
-      final InputStream zin;
-      if (startsWith(compressed, GZIP_HEADER_PREFIX)) {
-        zin = new GZIPInputStream(bin);
-      } else if (startsWith(compressed, ZLIB_HEADER_PREFIX)) {
-        zin = new InflaterInputStream(bin);
-      } else {
-        throw new Base64ZlibCodec.InvalidDataException("Value doesn't start with either GZIP or zlib header");
-      }
-      try {
-        bytes = ByteStreams.toByteArray(zin);
-      } finally {
-        zin.close();
-      }
-    } catch (IOException e) {
-      throw new Base64ZlibCodec.InvalidDataException("zlib/GZIP decoding error", e);
-    }
-    return bytes;
-  }
-
-  private static boolean startsWith(byte[] value, byte[] prefix) {
-    final int pl = prefix.length;
-    if (value.length < pl) {
-      return false;
-    }
-    for (int i = 0; i < pl; ++i) {
-      if (value[i] != prefix[i]) {
-        return false;
-      }
-    }
-    return true;
-  }
-
-  /**
-   * Encodes a set of bytes.
-   *
-   * @param plain the non-encoded bytes
-   * @return the encoded string
-   */
-  public static String encode(byte[] plain) {
-    final ByteArrayOutputStream out = new ByteArrayOutputStream(plain.length
-        / ESTIMATED_PLAINTEXT_TO_ENCODED_RATIO);
-    final OutputStream w = getDeflatingEncodingStream(out);
-    try {
-      w.write(plain);
-      w.close();
-      return out.toString(BASE64_TEXT_ENCODING);
-    } catch (UnsupportedEncodingException e) {
-      throw reportUnsupportedEncoding();
-    } catch (IOException e) {
-      throw Throwables.propagate(e);
-    }
-  }
-
-  private static OutputStream getDeflatingEncodingStream(OutputStream out) {
-    return new DeflaterOutputStream(new Base64OutputStream(out, true,
-        Integer.MAX_VALUE, null));
-  }
-
-  /**
-   * Returns a writer that writes through to the specified output stream, utf-8 encoding,
-   * zlib compressing, and Base64 encoding its input along the way.
-   *
-   * @param out the output stream that receives the final output
-   * @return a writer for the input
-   */
-  public static Writer getEncodingWriter(OutputStream out) {
-    return new OutputStreamWriter(getDeflatingEncodingStream(out), TEXT_ENCODING);
-  }
-
-  private static AssertionError reportUnsupportedEncoding() {
-    return new AssertionError(String.format("JVM doesn't support the %s encoding", TEXT_ENCODING));
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/io/JsonCodec.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/io/JsonCodec.java b/commons/src/main/java/org/apache/aurora/common/io/JsonCodec.java
deleted file mode 100644
index 1b955db..0000000
--- a/commons/src/main/java/org/apache/aurora/common/io/JsonCodec.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.io;
-
-import java.io.FilterOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-import java.util.BitSet;
-
-import com.google.common.base.Preconditions;
-import com.google.gson.ExclusionStrategy;
-import com.google.gson.FieldAttributes;
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-
-/**
- * A {@code Codec} that can encode and decode objects to and from JSON using the GSON library
- * (which in turn will use reflection). The codec uses the UTF-8 encoding.
- *
- * @author Attila Szegedi
- */
-public class JsonCodec<T> implements Codec<T> {
-
-  private static final String ENCODING = "utf-8";
-
-  private final Class<T> clazz;
-  private final Gson gson;
-
-  /**
-   * Creates a new JSON codec instance for objects of the specified class.
-   *
-   * @param clazz the class of the objects the created codec is for.
-   * @return a newly constructed JSON codec instance for objects of the requested class.
-   */
-  public static <T> JsonCodec<T> create(Class<T> clazz) {
-    return new JsonCodec<T>(clazz, DefaultGsonHolder.instance);
-  }
-
-  /**
-   * Creates a new JSON codec instance for objects of the specified class and the specified Gson
-   * instance. You can use this method if you need to customize the behavior of the Gson
-   * serializer.
-   *
-   * @param clazz the class of the objects the created codec is for.
-   * @param gson the Gson instance to use for serialization/deserialization.
-   * @return a newly constructed JSON codec instance for objects of the requested class.
-   */
-  public static <T> JsonCodec<T> create(Class<T> clazz, Gson gson) {
-    return new JsonCodec<T>(clazz, gson);
-  }
-
-  private JsonCodec(Class<T> clazz, Gson gson) {
-    Preconditions.checkNotNull(clazz);
-    Preconditions.checkNotNull(gson);
-    this.clazz = clazz;
-    this.gson = gson;
-  }
-
-  private static final class DefaultGsonHolder {
-    static final Gson instance = new Gson();
-  }
-
-  /**
-   * Returns a Gson exclusion strategy that excludes Thrift synthetic fields from JSON
-   * serialization. You can pass it to a {@link GsonBuilder} to construct a customized {@link Gson}
-   * instance to use with {@link JsonCodec#create(Class, Gson)}.
-   *
-   * @return a Gson exclusion strategy for thrift synthetic fields.
-   */
-  public static ExclusionStrategy getThriftExclusionStrategy() {
-    return ThriftExclusionStrategy.instance;
-  }
-
-  private static final class ThriftExclusionStrategy implements ExclusionStrategy {
-    static final ExclusionStrategy instance = new ThriftExclusionStrategy();
-
-    public boolean shouldSkipClass(Class<?> clazz) {
-      return false;
-    }
-
-    public boolean shouldSkipField(FieldAttributes f) {
-      // Exclude Thrift synthetic fields
-      return f.getDeclaredClass() == BitSet.class && f.getName().equals("__isset_bit_vector");
-    }
-  }
-
-  @Override
-  public T deserialize(InputStream source) throws IOException {
-    return gson.fromJson(new InputStreamReader(source, ENCODING), clazz);
-  }
-
-  @Override
-  public void serialize(T item, OutputStream sink) throws IOException {
-    final Writer w = new OutputStreamWriter(new UnflushableOutputStream(sink), ENCODING);
-    gson.toJson(item, clazz, w);
-    w.flush();
-  }
-
-  private static class UnflushableOutputStream extends FilterOutputStream {
-    UnflushableOutputStream(OutputStream out) {
-      super(out);
-    }
-
-    @Override
-    public void flush() throws IOException {
-      // Intentionally do nothing
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/io/Streamer.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/io/Streamer.java b/commons/src/main/java/org/apache/aurora/common/io/Streamer.java
deleted file mode 100644
index 9026760..0000000
--- a/commons/src/main/java/org/apache/aurora/common/io/Streamer.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.io;
-
-import com.google.common.base.Predicate;
-import org.apache.aurora.common.base.Closure;
-
-/**
- * Encapsulates iteration over a typed data stream that can be filtered.
- *
- * @author John Sirois
- */
-public interface Streamer<T> {
-
-  /**
-   * Processes a stream fully.  This may cause a database query to be executed, a file to be read
-   * or even just call {@link Iterable#iterator()} depending on the implementation.  Implementations
-   * guaranty that any resources allocated opening the stream will be closed whether or not process
-   * completes normally.
-   *
-   * @param work a closure over the work to be done for each item in the stream.
-   */
-  void process(Closure<T> work);
-
-  /**
-   * Returns a {@code Streamer} that will process the same stream as this streamer, but will stop
-   * processing when encountering the first item for which {@code cond} is true.
-   *
-   * @param cond a predicate that returns {@code false} as long as the stream should keep being
-   *     processed.
-   * @return a streamer that will process items until the condition triggers.
-   */
-  Streamer<T> endOn(Predicate<T> cond);
-
-  /**
-   * Returns a {@code Streamer} that will process the same stream as this streamer, but with any
-   * items failing the filter to be omitted from processing.
-   * @param filter a predicate that returns {@code true} if an item in the stream should be
-   *     processed
-   * @return a filtered streamer
-   */
-  Streamer<T> filter(Predicate<T> filter);
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/logging/BufferedLog.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/logging/BufferedLog.java b/commons/src/main/java/org/apache/aurora/common/logging/BufferedLog.java
deleted file mode 100644
index a83895d..0000000
--- a/commons/src/main/java/org/apache/aurora/common/logging/BufferedLog.java
+++ /dev/null
@@ -1,278 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.logging;
-
-import com.google.common.base.Preconditions;
-import com.google.common.base.Predicate;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Lists;
-import com.google.common.util.concurrent.ThreadFactoryBuilder;
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-import org.apache.aurora.common.stats.StatImpl;
-import org.apache.aurora.common.stats.Stats;
-
-import java.util.List;
-import java.util.Timer;
-import java.util.TimerTask;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.logging.Logger;
-
-/**
- * Log that buffers requests before sending them to a wrapped log.
- *
- * @author William Farner
- */
-public class BufferedLog<T, R> implements Log<T, Void> {
-  private static final Logger LOG = Logger.getLogger(BufferedLog.class.getName());
-
-  private static final ExecutorService DEFAULT_EXECUTOR_SERVICE =
-      Executors.newSingleThreadExecutor(
-            new ThreadFactoryBuilder().setDaemon(true).setNameFormat("Log Pusher-%d").build());
-  private static final int DEFAULT_MAX_BUFFER_SIZE = 100000;
-
-  // TODO(William Farner): Change to use a ScheduledExecutorService instead of a timer.
-  private final TimerTask logPusher = new TimerTask() {
-          @Override public void run() {
-            flush();
-          }
-        };
-
-  // Local buffer of log messages.
-  private final List<T> localBuffer = Lists.newLinkedList();
-
-  // The log that is being buffered.
-  private Log<T, R> bufferedLog;
-
-  // Filter to determine when a log request should be retried.
-  private Predicate<R> retryFilter = null;
-
-  // Maximum number of log entries that can be buffered before truncation (lost messages).
-  private int maxBufferSize = DEFAULT_MAX_BUFFER_SIZE;
-
-  // Maximum buffer length before attempting to submit.
-  private int chunkLength;
-
-  // Maximum time for a message to sit in the buffer before attempting to flush.
-  private Amount<Integer, Time> flushInterval;
-
-  // Service to handle flushing the log.
-  private ExecutorService logSubmitService = DEFAULT_EXECUTOR_SERVICE;
-
-  private BufferedLog() {
-    // Created through builder.
-
-    Stats.export(new StatImpl<Integer>("scribe_buffer_size") {
-        public Integer read() { return getBacklog(); }
-      });
-  }
-
-  public static <T, R> Builder<T, R> builder() {
-    return new Builder<T, R>();
-  }
-
-  /**
-   * Starts the log submission service by scheduling a timer to periodically submit messages.
-   */
-  private void start() {
-    long flushIntervalMillis = flushInterval.as(Time.MILLISECONDS);
-
-    new Timer(true).scheduleAtFixedRate(logPusher, flushIntervalMillis, flushIntervalMillis);
-  }
-
-  /**
-   * Gets the current number of messages in the local buffer.
-   *
-   * @return The number of backlogged messages.
-   */
-  protected int getBacklog() {
-    synchronized (localBuffer) {
-      return localBuffer.size();
-    }
-  }
-
-  /**
-   * Stores a log entry, flushing immediately if the buffer length limit is exceeded.
-   *
-   * @param entry Entry to log.
-   */
-  @Override
-  public Void log(T entry) {
-    synchronized (localBuffer) {
-      localBuffer.add(entry);
-
-      if (localBuffer.size() >= chunkLength) {
-        logSubmitService.submit(logPusher);
-      }
-    }
-
-    return null;
-  }
-
-  @Override
-  public Void log(List<T> entries) {
-    for (T entry : entries) log(entry);
-
-    return null;
-  }
-
-  @Override
-  public void flush() {
-    List<T> buffer = copyBuffer();
-    if (buffer.isEmpty()) return;
-
-    R result = bufferedLog.log(buffer);
-
-    // Restore the buffer if the write was not successful.
-    if (retryFilter != null && retryFilter.apply(result)) {
-      LOG.warning("Log request failed, restoring spooled messages.");
-      restoreToLocalBuffer(buffer);
-    }
-  }
-
-  /**
-   * Creats a snapshot of the local buffer and clears the local buffer.
-   *
-   * @return A snapshot of the local buffer.
-   */
-  private List<T> copyBuffer() {
-    synchronized (localBuffer) {
-      List<T> bufferCopy = ImmutableList.copyOf(localBuffer);
-      localBuffer.clear();
-      return bufferCopy;
-    }
-  }
-
-  /**
-   * Restores log entries back to the local buffer.  This can be used to commit entries back to the
-   * buffer after a flush operation failed.
-   *
-   * @param buffer The log entries to restore.
-   */
-  private void restoreToLocalBuffer(List<T> buffer) {
-    synchronized (localBuffer) {
-      int restoreRecords = Math.min(buffer.size(), maxBufferSize - localBuffer.size());
-
-      if (restoreRecords != buffer.size()) {
-        LOG.severe((buffer.size() - restoreRecords) + " log records truncated!");
-
-        if (restoreRecords == 0) return;
-      }
-
-      localBuffer.addAll(0, buffer.subList(buffer.size() - restoreRecords, buffer.size()));
-    }
-  }
-
-  /**
-   * Configures a BufferedLog object.
-   *
-   * @param <T> Log message type.
-   * @param <R> Log result type.
-   */
-  public static class Builder<T, R> {
-    private final BufferedLog<T, R> instance;
-
-    public Builder() {
-      instance = new BufferedLog<T, R>();
-    }
-
-    /**
-     * Specifies the log that should be buffered.
-     *
-     * @param bufferedLog Log to buffer requests to.
-     * @return A reference to the builder.
-     */
-    public Builder<T, R> buffer(Log<T, R> bufferedLog) {
-      instance.bufferedLog = bufferedLog;
-      return this;
-    }
-
-    /**
-     * Adds a custom retry filter that will be used to determine whether a log result {@code R}
-     * should be used to indicate that a log request should be retried.  Log submit retry behavior
-     * is not defined when the filter throws uncaught exceptions.
-     *
-     * @param retryFilter Filter to determine whether to retry.
-     * @return A reference to the builder.
-     */
-    public Builder<T, R> withRetryFilter(Predicate<R> retryFilter) {
-      instance.retryFilter = retryFilter;
-      return this;
-    }
-
-    /**
-     * Specifies the maximum allowable buffer size, after which log records will be dropped to
-     * conserve memory.
-     *
-     * @param maxBufferSize Maximum buffer size.
-     * @return A reference to the builder.
-     */
-    public Builder<T, R> withMaxBuffer(int maxBufferSize) {
-      instance.maxBufferSize = maxBufferSize;
-      return this;
-    }
-
-    /**
-     * Specifies the desired number of log records to submit in each request.
-     *
-     * @param chunkLength Maximum number of records to accumulate before trying to submit.
-     * @return A reference to the builder.
-     */
-    public Builder<T, R> withChunkLength(int chunkLength) {
-      instance.chunkLength = chunkLength;
-      return this;
-    }
-
-    /**
-     * Specifies the maximum amount of time that a log entry may wait in the buffer before an
-     * attempt is made to flush the buffer.
-     *
-     * @param flushInterval Log flush interval.
-     * @return A reference to the builder.
-     */
-    public Builder<T, R> withFlushInterval(Amount<Integer, Time> flushInterval) {
-      instance.flushInterval = flushInterval;
-      return this;
-    }
-
-    /**
-     * Specifies the executor service to use for (synchronously or asynchronously) sending
-     * log entries.
-     *
-     * @param logSubmitService Log submit executor service.
-     * @return A reference to the builder.
-     */
-    public Builder<T, R> withExecutorService(ExecutorService logSubmitService) {
-      instance.logSubmitService = logSubmitService;
-      return this;
-    }
-
-    /**
-     * Creates the buffered log.
-     *
-     * @return The prepared buffered log.
-     */
-    public BufferedLog<T, R> build() {
-      Preconditions.checkArgument(instance.chunkLength > 0);
-      Preconditions.checkArgument(instance.flushInterval.as(Time.MILLISECONDS) > 0);
-      Preconditions.checkNotNull(instance.logSubmitService);
-      Preconditions.checkArgument(instance.chunkLength <= instance.maxBufferSize);
-
-      instance.start();
-
-      return instance;
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/logging/LogUtil.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/logging/LogUtil.java b/commons/src/main/java/org/apache/aurora/common/logging/LogUtil.java
deleted file mode 100644
index 5f97cb2..0000000
--- a/commons/src/main/java/org/apache/aurora/common/logging/LogUtil.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.logging;
-
-import com.google.common.annotations.VisibleForTesting;
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.SystemUtils;
-
-import java.io.File;
-import java.util.logging.LogManager;
-import java.util.logging.Logger;
-
-/**
- * Logging utility functions.
- *
- * @author William Farner
- */
-public class LogUtil {
-
-  private static final Logger LOG = Logger.getLogger(LogUtil.class.getName());
-
-  private static final String LOG_MANAGER_FILE_PROP = "java.util.logging.FileHandler.pattern";
-
-  @VisibleForTesting
-  static final File DEFAULT_LOG_DIR = new File("/var/log");
-
-  /**
-   * Gets the log directory as configured with the log manager.  This will attempt to expand any
-   * directory wildcards that are included in log file property.
-   *
-   * @return The configured log directory.
-   */
-  public static File getLogManagerLogDir() {
-    return getLogManagerLogDir(LogManager.getLogManager().getProperty(LOG_MANAGER_FILE_PROP));
-  }
-
-  /**
-   * Gets the log directory as specified in a log file pattern.  This will attempt to expand any
-   * directory wildcards that are included in log file property.
-   *
-   * @param logFilePattern The pattern to extract the log directory from.
-   * @return The configured log directory.
-   */
-  public static File getLogManagerLogDir(String logFilePattern) {
-    if (StringUtils.isEmpty(logFilePattern)) {
-      LOG.warning("Could not find log dir in logging property " + LOG_MANAGER_FILE_PROP
-                  + ", reading from " + DEFAULT_LOG_DIR);
-      return DEFAULT_LOG_DIR;
-    }
-
-    String logDir = expandWildcard(logFilePattern, "%t", SystemUtils.JAVA_IO_TMPDIR);
-    logDir = expandWildcard(logDir, "%h", SystemUtils.USER_HOME);
-    File parent = new File(logDir).getParentFile();
-    return parent == null ? new File(".") : parent;
-  }
-
-  /**
-   * Expands a directory path wildcard within a file pattern string.
-   * Correctly handles cases where the replacement string does and does not contain a trailing
-   * slash.
-   *
-   * @param pattern File pattern string, which may or may not contain a wildcard.
-   * @param dirWildcard Wildcard string to expand.
-   * @param replacement Path component to expand wildcard to.
-   * @return {@code pattern} with all instances of {@code dirWildcard} replaced with
-   *     {@code replacement}.
-   */
-  private static String expandWildcard(String pattern, String dirWildcard, String replacement) {
-    String replace = dirWildcard;
-    if (replacement.charAt(replacement.length() - 1) == '/') {
-      replace += '/';
-    }
-    return pattern.replaceAll(replace, replacement);
-  }
-
-  private LogUtil() {
-    // Utility class.
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/logging/julbridge/JULBridgeHandler.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/logging/julbridge/JULBridgeHandler.java b/commons/src/main/java/org/apache/aurora/common/logging/julbridge/JULBridgeHandler.java
deleted file mode 100644
index 8a9e18e..0000000
--- a/commons/src/main/java/org/apache/aurora/common/logging/julbridge/JULBridgeHandler.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.logging.julbridge;
-
-import java.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.logging.Formatter;
-import java.util.logging.Handler;
-import java.util.logging.LogRecord;
-
-import javax.annotation.Nullable;
-
-import org.apache.log4j.Level;
-import org.apache.log4j.LogManager;
-import org.apache.log4j.Logger;
-import org.apache.log4j.spi.LocationInfo;
-import org.apache.log4j.spi.LoggerRepository;
-import org.apache.log4j.spi.LoggingEvent;
-import org.apache.log4j.spi.ThrowableInformation;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * JUL Handler to convert JUL {@link LogRecord} messages into Log4j's {@link LoggingEvent} messages,
- * and route them to a Log4J logger with the same name as the JUL logger.
- */
-public class JULBridgeHandler extends Handler {
-  private static final String UNKNOWN_LOGGERNAME = "unknown";
-
-  /**
-   * Converts a JUL log record into a Log4J logging event.
-   *
-   * @param record the JUL log record to convert
-   * @param logger the Log4J logger to use for the logging event
-   * @param level the Log4J level to use for the logging event
-   * @param useExtendedLocationInfo if false, do no try to get source file and line informations
-   * @return a Log4J logging event
-   */
-  static LoggingEvent toLoggingEvent(LogRecord record, Logger logger, Level level,
-      boolean useExtendedLocationInfo) {
-
-    LocationInfo locationInfo = useExtendedLocationInfo
-        ? new LocationInfo(new Throwable(), record.getSourceClassName())
-        : new LocationInfo("?", record.getSourceClassName(), record.getSourceMethodName(), "?");
-
-    // Getting thread name from thread id? complicated...
-    String threadName = String.valueOf(record.getThreadID());
-    ThrowableInformation throwableInformation = record.getThrown() == null
-        ? null
-        : new ThrowableInformation(record.getThrown());
-
-    return new LoggingEvent(
-        record.getSourceClassName(),
-        logger,
-        record.getMillis(),
-        level,
-        formatMessage(record),
-        threadName,
-        throwableInformation,
-        null /* ndc */,
-        locationInfo,
-        null /* properties */);
-  }
-
-  /**
-   * Formats a log record message in a way similar to {@link Formatter#formatMessage(LogRecord)}.
-   *
-   * If the record contains a resource bundle, a lookup is done to find a localized version.
-   *
-   * If the record contains parameters, the message is formatted using
-   * {@link MessageFormat#format(String, Object...)}
-   *
-   * @param record the log record used to format the message
-   * @return a formatted string
-   */
-  static String formatMessage(LogRecord record) {
-    String message = record.getMessage();
-
-    // Look for a resource bundle
-    java.util.ResourceBundle catalog = record.getResourceBundle();
-    if (catalog != null) {
-      try {
-        message = catalog.getString(record.getMessage());
-      } catch (MissingResourceException e) {
-        // Not found? Fallback to original message string
-        message = record.getMessage();
-      }
-    }
-
-    Object parameters[] = record.getParameters();
-    if (parameters == null || parameters.length == 0) {
-      // No parameters? just return the message string
-      return message;
-    }
-
-    // Try formatting
-    try {
-      return MessageFormat.format(message, parameters);
-    } catch (IllegalArgumentException e) {
-      return message;
-    }
-  }
-
-  private final LoggerRepository loggerRepository;
-  private final boolean useExtendedLocationInfo;
-
-  /**
-   * Creates a new JUL handler. Equivalent to calling {@link #JULBridgeHandler(boolean)} passing
-   * <code>false</code> as argument.
-   */
-  public JULBridgeHandler() {
-    this(LogManager.getLoggerRepository(), false);
-  }
-
-  /**
-   * Creates a new JUL handler.
-   * Equivalent to calling {@link #JULBridgeHandler(LoggerRepository, boolean)} passing
-   * <code>LogManager.getLoggerRepository()</code> and <code>useExtendedLocationInfo</code> as
-   * arguments.
-   *
-   * @param useExtendedLocationInfo if true, try to add source filename and line info to log message
-   */
-  public JULBridgeHandler(boolean useExtendedLocationInfo) {
-    this(LogManager.getLoggerRepository(), useExtendedLocationInfo);
-  }
-
-  /**
-   * Creates a new JUL handler.
-   *
-   * @param loggerRepository Log4j logger repository where to get loggers from
-   * @param useExtendedLocationInfo if true, try to add source filename and line info to log message
-   * @throws NullPointerException if loggerRepository is null
-   */
-  public JULBridgeHandler(LoggerRepository loggerRepository, boolean useExtendedLocationInfo) {
-    this.loggerRepository = checkNotNull(loggerRepository);
-    this.useExtendedLocationInfo = useExtendedLocationInfo;
-  }
-
-  /**
-   * Gets a Log4J Logger with the same name as the logger name stored in the log record.
-   *
-   * @param record a JUL log record
-   * @return a Log4J logger with the same name, or name {@value #UNKNOWN_LOGGERNAME} if no name is
-   * present in the record.
-   */
-  Logger getLogger(LogRecord record) {
-    String loggerName = record.getLoggerName();
-    if (loggerName == null) {
-      loggerName = UNKNOWN_LOGGERNAME;
-    }
-
-    return loggerRepository.getLogger(loggerName);
-  }
-
-  /**
-   * Publishes the log record to a Log4J logger of the same name.
-   *
-   * Before formatting the message, level is converted and message is discarded if Log4j logger is
-   * not enabled for that level.
-   *
-   * @param record the record to publish
-   */
-  @Override
-  public void publish(@Nullable LogRecord record) {
-    // Ignore silently null records
-    if (record == null) {
-      return;
-    }
-
-    Logger log4jLogger = getLogger(record);
-    Level log4jLevel = JULBridgeLevelConverter.toLog4jLevel(record.getLevel());
-
-    if (log4jLogger.isEnabledFor(log4jLevel)) {
-      LoggingEvent event = toLoggingEvent(record, log4jLogger, log4jLevel, useExtendedLocationInfo);
-
-      log4jLogger.callAppenders(event);
-    }
-  }
-
-  @Override
-  public void flush() {}
-
-  @Override
-  public void close() {}
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/logging/julbridge/JULBridgeLevelConverter.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/logging/julbridge/JULBridgeLevelConverter.java b/commons/src/main/java/org/apache/aurora/common/logging/julbridge/JULBridgeLevelConverter.java
deleted file mode 100644
index 14bbd4c..0000000
--- a/commons/src/main/java/org/apache/aurora/common/logging/julbridge/JULBridgeLevelConverter.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.logging.julbridge;
-
-import java.util.logging.Level;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * An utility class to convert between JUL and Log4j Levels. Mapping is as follows:
- * <ul>
- * <li>FINEST <-> TRACE</li>
- * <li>FINER -> DEBUG</li>
- * <li>FINE <-> DEBUG</li>
- * <li>INFO <-> INFO</li>
- * <li>WARNING <-> WARN</li>
- * <li>SEVERE <-> ERROR</li>
- * <li>SEVERE <- FATAL</li>
- * </ul>
- *
- * Unknowns levels are mapped to FINE/DEBUG
- */
-public class JULBridgeLevelConverter {
-
-  private JULBridgeLevelConverter() {}
-
-  /**
-   * Converts a JUL level into a Log4j level.
-   *
-   * @param level the JUL level to convert
-   * @return a Log4j level
-   * @throws NullPointerException if level is null
-   */
-  public static org.apache.log4j.Level toLog4jLevel(Level level) {
-    checkNotNull(level);
-
-    if (level == Level.FINEST) {
-      return org.apache.log4j.Level.TRACE;
-    } else if (level == Level.FINER) {
-      return org.apache.log4j.Level.DEBUG;
-    } else if (level == Level.FINE) {
-      return org.apache.log4j.Level.DEBUG;
-    } else if (level == Level.INFO) {
-      return org.apache.log4j.Level.INFO;
-    } else if (level == Level.WARNING) {
-      return org.apache.log4j.Level.WARN;
-    } else if (level == Level.SEVERE) {
-      return org.apache.log4j.Level.ERROR;
-    } else if (level == Level.ALL) {
-      return org.apache.log4j.Level.ALL;
-    } else if (level == Level.OFF) {
-      return org.apache.log4j.Level.OFF;
-    }
-
-    return org.apache.log4j.Level.DEBUG;
-  }
-
-  /**
-   * Converts a Log4j level into a JUL level.
-   *
-   * @param level the Log4j level to convert
-   * @return a JUL level
-   * @throws NullPointerException if level is null
-   */
-  public static Level fromLog4jLevel(org.apache.log4j.Level level) {
-    checkNotNull(level);
-
-    if (level == org.apache.log4j.Level.TRACE) {
-      return Level.FINEST;
-    } else if (level == org.apache.log4j.Level.DEBUG) {
-      return Level.FINE;
-    } else if (level == org.apache.log4j.Level.INFO) {
-      return Level.INFO;
-    } else if (level == org.apache.log4j.Level.WARN) {
-      return Level.WARNING;
-    } else if (level == org.apache.log4j.Level.ERROR) {
-      return Level.SEVERE;
-    } else if (level == org.apache.log4j.Level.FATAL) {
-      return Level.SEVERE;
-    } else if (level == org.apache.log4j.Level.ALL) {
-      return Level.ALL;
-    } else if (level == org.apache.log4j.Level.OFF) {
-      return Level.OFF;
-    }
-
-    return Level.FINE;
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/logging/julbridge/JULBridgeLogManager.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/logging/julbridge/JULBridgeLogManager.java b/commons/src/main/java/org/apache/aurora/common/logging/julbridge/JULBridgeLogManager.java
deleted file mode 100644
index adf1a83..0000000
--- a/commons/src/main/java/org/apache/aurora/common/logging/julbridge/JULBridgeLogManager.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.logging.julbridge;
-
-import java.util.logging.LogManager;
-import java.util.logging.Logger;
-
-import org.apache.log4j.spi.LoggerRepository;
-
-/**
- * A JUL LogManager which takes over the logging configuration and redirects all messages to Log4j.
- *
- * The approach is inspired by the apache-jul-log4j-bridge project from Paul Smith
- * (<ps...@apache.org>) and available at <a
- * href="http://people.apache.org/~psmith/logging.apache.org/sandbox/jul-log4j-bridge/" />
- *
- * During initialization, it resets configuration and adds a default handler to the root logger to
- * perform the redirection. It also sets the root logger level to the Log4j repository threshold.
- * This implies that Log4j is properly configured before this manager is taking over.
- *
- * To install this log manager, simply add the following property to the java command line:
- * <code>-Djava.util.logging.manager=com.twitter.common.logging.julbridge.JULBridgeLogManager</code>
- *
- * It is possible to configure using extended location information (source filename and line info)
- * by adding the following property to the java command line:
- * <code>-Dcom.twitter.common.logging.julbridge.use-extended-location-info=true</code>
- *
- */
-public final class JULBridgeLogManager extends LogManager {
-  /**
-   * System property name to control if log messages sent from JUL to log4j should contain
-   * extended location information.
-   *
-   * Set @value to true to add source filename and line number to each message.
-   */
-  public static final String USE_EXTENDED_LOCATION_INFO_PROPERTYNAME =
-      "com.twitter.common.logging.julbridge.use-extended-location-info";
-
-  /*
-   * LogManager requires a public no-arg constructor to be present so a new instance can be created
-   * when configured using the system property. A private constructor will throw an exception.
-   */
-  public JULBridgeLogManager() {}
-
-  @Override
-  public void readConfiguration() {
-    assimilate(org.apache.log4j.LogManager.getLoggerRepository());
-  }
-
-  /**
-   * Assimilates an existing JUL log manager. Equivalent to calling
-   * {@link #assimilate(LoggerRepository)} with <code>LogManager.getLoggerRepository</code>.
-   */
-  public static void assimilate() {
-    assimilate(org.apache.log4j.LogManager.getLoggerRepository());
-  }
-
-  /**
-   * Assimilates an existing JUL log manager.
-   *
-   * It resets the manager configuration, and adds a bridge handler to the root logger. Messages are
-   * redirected to the specified Log4j logger repository.
-   *
-   * @param loggerRepository the Log4j logger repository to use to redirect messages
-   */
-  public static void assimilate(LoggerRepository loggerRepository) {
-    LogManager.getLogManager().reset();
-
-    boolean withExtendedLocationInfos =
-        Boolean.getBoolean(USE_EXTENDED_LOCATION_INFO_PROPERTYNAME);
-
-    Logger rootLogger = Logger.getLogger("");
-    rootLogger.setLevel(JULBridgeLevelConverter.fromLog4jLevel(loggerRepository.getThreshold()));
-    rootLogger.addHandler(new JULBridgeHandler(loggerRepository, withExtendedLocationInfos));
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/net/ProxyAuthorizer.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/net/ProxyAuthorizer.java b/commons/src/main/java/org/apache/aurora/common/net/ProxyAuthorizer.java
deleted file mode 100644
index c5126dc..0000000
--- a/commons/src/main/java/org/apache/aurora/common/net/ProxyAuthorizer.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net;
-
-import org.apache.commons.codec.binary.Base64;
-
-import java.net.HttpURLConnection;
-
-/**
- * Authorizes http connection for use over the proxy it is built with
- *
- * @author William Farner
- */
-public class ProxyAuthorizer {
-  private final ProxyConfig config;
-
-  private ProxyAuthorizer(ProxyConfig config) {
-    this.config = config;
-  }
-
-  public static ProxyAuthorizer adapt(ProxyConfig config) {
-    return new ProxyAuthorizer(config);
-  }
-
-  public void authorize(HttpURLConnection httpCon) {
-    httpCon.setRequestProperty("Proxy-Authorization", "Basic " +
-        new String(Base64.encodeBase64(new String(config.getProxyUser() + ":" +
-          config.getProxyPassword()).getBytes())).trim());
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/net/ProxyConfig.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/net/ProxyConfig.java b/commons/src/main/java/org/apache/aurora/common/net/ProxyConfig.java
deleted file mode 100644
index fa474b5..0000000
--- a/commons/src/main/java/org/apache/aurora/common/net/ProxyConfig.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net;
-
-import java.net.InetSocketAddress;
-import javax.annotation.Nullable;
-
-/**
- * Proxy configuration parameters: proxy address, username, and password.
- *
- * @author John Corwin
- */
-public interface ProxyConfig {
-  public InetSocketAddress getProxyAddress();
-
-  public @Nullable String getProxyUser();
-
-  public @Nullable String getProxyPassword();
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/net/UrlHelper.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/net/UrlHelper.java b/commons/src/main/java/org/apache/aurora/common/net/UrlHelper.java
deleted file mode 100644
index 3f06d63..0000000
--- a/commons/src/main/java/org/apache/aurora/common/net/UrlHelper.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net;
-
-import com.google.common.base.Joiner;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.Arrays;
-import java.util.List;
-import java.util.logging.Logger;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * @author William Farner
- */
-public class UrlHelper {
-
-  private static final Logger LOG = Logger.getLogger(UrlHelper.class.getName());
-
-  /**
-   * Gets the domain from {@code url}.
-   *
-   * @param url A url.
-   * @return The domain portion of the URL, or {@code null} if the url is invalid.
-   */
-  public static String getDomain(String url) {
-    try {
-      return getDomainChecked(url);
-    } catch (URISyntaxException e) {
-      LOG.finest("Malformed url: " + url);
-      return null;
-    }
-  }
-
-  /**
-   * Gets the domain from {@code uri}, and throws an exception if it's not a valid uri.
-   *
-   * @param url A url.
-   * @throws URISyntaxException if url is not a valid {@code URI}
-   * @return The domain portion of the given url, or {@code null} if the host is undefined.
-   */
-  public static String getDomainChecked(String url) throws URISyntaxException {
-    Preconditions.checkNotNull(url);
-    url = addProtocol(url);
-    return new URI(url).getHost();
-  }
-
-  /**
-   * Gets the path from {@code url}.
-   *
-   * @param url A url.
-   * @return The path portion of the URL, or {@code null} if the url is invalid.
-   */
-  public static String getPath(String url) {
-    Preconditions.checkNotNull(url);
-    url = addProtocol(url);
-    try {
-      return new URI(url).getPath();
-    } catch (URISyntaxException e) {
-      LOG.info("Malformed url: " + url);
-      return null;
-    }
-  }
-
-  /**
-   * Strips URL parameters from a url.
-   * This will remove anything after and including a question mark in the URL.
-   *
-   * @param url The URL to strip parameters from.
-   * @return The original URL with parameters stripped, which will be the original URL if no
-   *   parameters were found.
-   */
-  public static String stripUrlParameters(String url) {
-    Preconditions.checkNotNull(url);
-    int paramStartIndex = url.indexOf("?");
-    if (paramStartIndex == -1) {
-      return url;
-    } else {
-      return url.substring(0, paramStartIndex);
-    }
-  }
-
-  /**
-   * Convenience method that calls #stripUrlParameters(String) for a URL.
-   *
-   * @param url The URL to strip parameters from.
-   * @return The original URL with parameters stripped, which will be the original URL if no
-   *   parameters were found.
-   */
-  public static String stripUrlParameters(URL url) {
-    return stripUrlParameters(url.toString());
-  }
-
-  private static final Pattern URL_PROTOCOL_REGEX =
-      Pattern.compile("^https?://", Pattern.CASE_INSENSITIVE);
-
-  /**
-   * Checks whether a URL specifies its protocol, prepending http if it does not.
-   *
-   * @param url The URL to fix.
-   * @return The URL with the http protocol specified if no protocol was already specified.
-   */
-  public static String addProtocol(String url) {
-    Preconditions.checkNotNull(url);
-    Matcher matcher = URL_PROTOCOL_REGEX.matcher(url);
-    if (!matcher.find()) {
-      url = "http://" + url;
-    }
-    return url;
-  }
-
-  /**
-   * Gets the domain levels for a host.
-   * For example, sub1.sub2.domain.co.uk would return
-   * [sub1.sub2.domain.co.uk, sub2.domain.co.uk, domain.co.uk, co.uk, uk].
-   *
-   *
-   * @param host The host to peel subdomains off from.
-   * @return The domain levels in this host.
-   */
-  public static List<String> getDomainLevels(String host) {
-    Preconditions.checkNotNull(host);
-
-    // Automatically include www prefix if not present.
-    if (!host.startsWith("www")) {
-      host = "www." + host;
-    }
-
-    Joiner joiner = Joiner.on(".");
-    List<String> domainParts = Lists.newLinkedList(Arrays.asList(host.split("\\.")));
-    List<String> levels = Lists.newLinkedList();
-
-    while (!domainParts.isEmpty()) {
-      levels.add(joiner.join(domainParts));
-      domainParts.remove(0);
-    }
-
-    return levels;
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/net/UrlResolver.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/net/UrlResolver.java b/commons/src/main/java/org/apache/aurora/common/net/UrlResolver.java
deleted file mode 100644
index 96c5f07..0000000
--- a/commons/src/main/java/org/apache/aurora/common/net/UrlResolver.java
+++ /dev/null
@@ -1,446 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.concurrent.Callable;
-import java.util.concurrent.Executor;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.Semaphore;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.annotation.Nullable;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Functions;
-import com.google.common.base.Joiner;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-import com.google.common.util.concurrent.ListenableFutureTask;
-import com.google.common.util.concurrent.ThreadFactoryBuilder;
-
-import org.apache.aurora.common.base.ExceptionalFunction;
-import org.apache.aurora.common.net.UrlResolver.ResolvedUrl.EndState;
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-import org.apache.aurora.common.stats.PrintableHistogram;
-import org.apache.aurora.common.util.BackoffStrategy;
-import org.apache.aurora.common.util.Clock;
-import org.apache.aurora.common.util.TruncatedBinaryBackoff;
-import org.apache.aurora.common.util.caching.Cache;
-import org.apache.aurora.common.util.caching.LRUCache;
-
-/**
- * Class to aid in resolving URLs by following redirects, which can optionally be performed
- * asynchronously using a thread pool.
- *
- * @author William Farner
- */
-public class UrlResolver {
-  private static final Logger LOG = Logger.getLogger(UrlResolver.class.getName());
-
-  private static final String TWITTER_UA = "Twitterbot/0.1";
-  private static final UrlResolverUtil URL_RESOLVER =
-      new UrlResolverUtil(Functions.constant(TWITTER_UA));
-
-  private static final ExceptionalFunction<String, String, IOException> RESOLVER =
-      new ExceptionalFunction<String, String, IOException>() {
-        @Override public String apply(String url) throws IOException {
-          return URL_RESOLVER.getEffectiveUrl(url, null);
-        }
-      };
-
-  private static ExceptionalFunction<String, String, IOException>
-      getUrlResolver(final @Nullable ProxyConfig proxyConfig) {
-    if (proxyConfig != null) {
-      return new ExceptionalFunction<String, String, IOException>() {
-        @Override public String apply(String url) throws IOException {
-          return URL_RESOLVER.getEffectiveUrl(url, proxyConfig);
-        }
-      };
-    } else {
-      return RESOLVER;
-    }
-  }
-
-  private final ExceptionalFunction<String, String, IOException> resolver;
-  private final int maxRedirects;
-
-  // Tracks the number of active tasks (threads in use).
-  private final Semaphore poolEntrySemaphore;
-  private final Integer threadPoolSize;
-
-  // Helps with signaling the handler.
-  private final Executor handlerExecutor;
-
-  // Manages the thread pool and task execution.
-  private ExecutorService executor;
-
-  // Cache to store resolved URLs.
-  private final Cache<String, String> urlCache = LRUCache.<String, String>builder()
-      .maxSize(10000)
-      .makeSynchronized(true)
-      .build();
-
-  // Variables to track connection/request stats.
-  private AtomicInteger requestCount = new AtomicInteger(0);
-  private AtomicInteger cacheHits = new AtomicInteger(0);
-  private AtomicInteger failureCount = new AtomicInteger(0);
-  // Tracks the time (in milliseconds) required to resolve URLs.
-  private final PrintableHistogram urlResolutionTimesMs = new PrintableHistogram(
-      1, 5, 10, 25, 50, 75, 100, 150, 200, 250, 300, 500, 750, 1000, 1500, 2000);
-
-  private final Clock clock;
-  private final BackoffStrategy backoffStrategy;
-
-  @VisibleForTesting
-  UrlResolver(Clock clock, BackoffStrategy backoffStrategy,
-      ExceptionalFunction<String, String, IOException> resolver, int maxRedirects) {
-    this(clock, backoffStrategy, resolver, maxRedirects, null);
-  }
-
-  /**
-   * Creates a new asynchronous URL resolver.  A thread pool will be used to resolve URLs, and
-   * resolved URLs will be announced via {@code handler}.
-   *
-   * @param maxRedirects The maximum number of HTTP redirects to follow.
-   * @param threadPoolSize The number of threads to use for resolving URLs.
-   * @param proxyConfig The proxy settings with which to make the HTTP request, or null for the
-   *    default configured proxy.
-   */
-  public UrlResolver(int maxRedirects, int threadPoolSize, @Nullable ProxyConfig proxyConfig) {
-    this(Clock.SYSTEM_CLOCK,
-        new TruncatedBinaryBackoff(Amount.of(100L, Time.MILLISECONDS), Amount.of(1L, Time.SECONDS)),
-        getUrlResolver(proxyConfig), maxRedirects, threadPoolSize);
-  }
-
-  public UrlResolver(int maxRedirects, int threadPoolSize) {
-    this(maxRedirects, threadPoolSize, null);
-  }
-
-  private UrlResolver(Clock clock, BackoffStrategy backoffStrategy,
-      ExceptionalFunction<String, String, IOException> resolver, int maxRedirects,
-      @Nullable Integer threadPoolSize) {
-    this.clock = clock;
-    this.backoffStrategy = backoffStrategy;
-    this.resolver = resolver;
-    this.maxRedirects = maxRedirects;
-
-    if (threadPoolSize != null) {
-      this.threadPoolSize = threadPoolSize;
-      Preconditions.checkState(threadPoolSize > 0);
-      poolEntrySemaphore = new Semaphore(threadPoolSize);
-
-      // Start up the thread pool.
-      reset();
-
-      // Executor to send notifications back to the handler.  This also needs to be
-      // a daemon thread.
-      handlerExecutor =
-          Executors.newSingleThreadExecutor(new ThreadFactoryBuilder().setDaemon(true).build());
-    } else {
-      this.threadPoolSize = null;
-      poolEntrySemaphore = null;
-      handlerExecutor = null;
-    }
-  }
-
-  public Future<ResolvedUrl> resolveUrlAsync(final String url, final ResolvedUrlHandler handler) {
-    Preconditions.checkNotNull(
-        "Asynchronous URL resolution cannot be performed without a valid handler.", handler);
-
-    try {
-      poolEntrySemaphore.acquire();
-    } catch (InterruptedException e) {
-      LOG.log(Level.SEVERE, "Interrupted while waiting for thread to resolve URL: " + url, e);
-      return null;
-    }
-    final ListenableFutureTask<ResolvedUrl> future =
-        ListenableFutureTask.create(
-          new Callable<ResolvedUrl>() {
-            @Override public ResolvedUrl call() {
-              return resolveUrl(url);
-            }
-          });
-
-    future.addListener(new Runnable() {
-      @Override public void run() {
-        try {
-          handler.resolved(future);
-        } finally {
-          poolEntrySemaphore.release();
-        }
-      }
-    }, handlerExecutor);
-
-    executor.execute(future);
-    return future;
-  }
-
-  private void logThreadpoolInfo() {
-    LOG.info("Shutting down thread pool, available permits: "
-             + poolEntrySemaphore.availablePermits());
-    LOG.info("Queued threads? " + poolEntrySemaphore.hasQueuedThreads());
-    LOG.info("Queue length: " + poolEntrySemaphore.getQueueLength());
-  }
-
-  public void reset() {
-    Preconditions.checkState(threadPoolSize != null);
-    if (executor != null) {
-      Preconditions.checkState(executor.isShutdown(),
-          "The thread pool must be shut down before resetting.");
-      Preconditions.checkState(executor.isTerminated(), "There may still be pending async tasks.");
-    }
-
-    // Create a thread pool with daemon threads, so that they may be terminated when no
-    // application threads are running.
-    executor = Executors.newFixedThreadPool(threadPoolSize,
-        new ThreadFactoryBuilder().setDaemon(true).setNameFormat("UrlResolver[%d]").build());
-  }
-
-  /**
-   * Terminates the thread pool, waiting at most {@code waitSeconds} for active threads to complete.
-   * After this method is called, no more URLs may be submitted for resolution.
-   *
-   * @param waitSeconds The number of seconds to wait for active threads to complete.
-   */
-  public void clearAsyncTasks(int waitSeconds) {
-    Preconditions.checkState(threadPoolSize != null,
-        "finish() should not be called on a synchronous URL resolver.");
-
-    logThreadpoolInfo();
-    executor.shutdown(); // Disable new tasks from being submitted.
-    try {
-      // Wait a while for existing tasks to terminate
-      if (!executor.awaitTermination(waitSeconds, TimeUnit.SECONDS)) {
-        LOG.info("Pool did not terminate, forcing shutdown.");
-        logThreadpoolInfo();
-        List<Runnable> remaining = executor.shutdownNow();
-        LOG.info("Tasks still running: " + remaining);
-        // Wait a while for tasks to respond to being cancelled
-        if (!executor.awaitTermination(waitSeconds, TimeUnit.SECONDS)) {
-          LOG.warning("Pool did not terminate.");
-          logThreadpoolInfo();
-        }
-      }
-    } catch (InterruptedException e) {
-      LOG.log(Level.WARNING, "Interrupted while waiting for threadpool to finish.", e);
-      // (Re-)Cancel if current thread also interrupted
-      executor.shutdownNow();
-      // Preserve interrupt status
-      Thread.currentThread().interrupt();
-    }
-  }
-
-  /**
-   * Resolves a URL synchronously.
-   *
-   * @param url The URL to resolve.
-   * @return The resolved URL.
-   */
-  public ResolvedUrl resolveUrl(String url) {
-    ResolvedUrl resolvedUrl = new ResolvedUrl();
-    resolvedUrl.setStartUrl(url);
-
-    String cached = urlCache.get(url);
-    if (cached != null) {
-      cacheHits.incrementAndGet();
-      resolvedUrl.setNextResolve(cached);
-      resolvedUrl.setEndState(EndState.CACHED);
-      return resolvedUrl;
-    }
-
-    String currentUrl = url;
-    long backoffMs = 0L;
-    String next = null;
-    for (int i = 0; i < maxRedirects; i++) {
-      try {
-        next = resolveOnce(currentUrl);
-
-        // If there was a 4xx or a 5xx, we''ll get a null back, so we pretend like we never advanced
-        // to allow for a retry within the redirect limit.
-        // TODO(John Sirois): we really need access to the return code here to do the right thing; ie:
-        // retry for internal server errors but probably not for unauthorized
-        if (next == null) {
-          if (i < maxRedirects - 1) { // don't wait if we're about to exit the loop
-            backoffMs = backoffStrategy.calculateBackoffMs(backoffMs);
-            try {
-              clock.waitFor(backoffMs);
-            } catch (InterruptedException e) {
-              Thread.currentThread().interrupt();
-              throw new RuntimeException(
-                  "Interrupted waiting to retry a failed resolution for: " + currentUrl, e);
-            }
-          }
-          continue;
-        }
-
-        backoffMs = 0L;
-        if (next.equals(currentUrl)) {
-          // We've reached the end of the redirect chain.
-          resolvedUrl.setEndState(EndState.REACHED_LANDING);
-          urlCache.put(url, currentUrl);
-          for (String intermediateUrl : resolvedUrl.getIntermediateUrls()) {
-            urlCache.put(intermediateUrl, currentUrl);
-          }
-          return resolvedUrl;
-        } else if (!url.equals(next)) {
-          resolvedUrl.setNextResolve(next);
-        }
-        currentUrl = next;
-      } catch (IOException e) {
-        LOG.log(Level.INFO, "Failed to resolve url: " + url, e);
-        resolvedUrl.setEndState(EndState.ERROR);
-        return resolvedUrl;
-      }
-    }
-
-    resolvedUrl.setEndState(next == null || url.equals(currentUrl) ? EndState.ERROR
-        : EndState.REDIRECT_LIMIT);
-    return resolvedUrl;
-  }
-
-  /**
-   * Resolves a url, following at most one redirect.  Thread-safe.
-   *
-   * @param url The URL to resolve.
-   * @return The result of following the URL through at most one redirect or null if the url could
-   *     not be followed
-   * @throws IOException If an error occurs while resolving the URL.
-   */
-  private String resolveOnce(String url) throws IOException {
-    requestCount.incrementAndGet();
-
-    String resolvedUrl = urlCache.get(url);
-    if (resolvedUrl != null) {
-      cacheHits.incrementAndGet();
-      return resolvedUrl;
-    }
-
-    try {
-      long startTimeMs = System.currentTimeMillis();
-      resolvedUrl = resolver.apply(url);
-      if (resolvedUrl == null) {
-        return null;
-      }
-
-      urlCache.put(url, resolvedUrl);
-
-      synchronized (urlResolutionTimesMs) {
-        urlResolutionTimesMs.addValue(System.currentTimeMillis() - startTimeMs);
-      }
-      return resolvedUrl;
-    } catch (IOException e) {
-      failureCount.incrementAndGet();
-      throw e;
-    }
-  }
-
-  @Override
-  public String toString() {
-    return String.format("Cache: %s\nFailed requests: %d,\nResolution Times: %s",
-        urlCache, failureCount.get(),
-        urlResolutionTimesMs.toString());
-  }
-
-  /**
-   * Class to wrap the result of a URL resolution.
-   */
-  public static class ResolvedUrl {
-    public enum EndState {
-      REACHED_LANDING,
-      ERROR,
-      CACHED,
-      REDIRECT_LIMIT
-    }
-
-    private String startUrl;
-    private final List<String> resolveChain;
-    private EndState endState;
-
-    public ResolvedUrl() {
-      resolveChain = Lists.newArrayList();
-    }
-
-    @VisibleForTesting
-    public ResolvedUrl(EndState endState, String startUrl, String... resolveChain) {
-      this.endState = endState;
-      this.startUrl = startUrl;
-      this.resolveChain = Lists.newArrayList(resolveChain);
-    }
-
-    public String getStartUrl() {
-      return startUrl;
-    }
-
-    void setStartUrl(String startUrl) {
-      this.startUrl = startUrl;
-    }
-
-    /**
-     * Returns the last URL resolved following a redirect chain, or null if the startUrl is a
-     * landing URL.
-     */
-    public String getEndUrl() {
-      return resolveChain.isEmpty() ? null : Iterables.getLast(resolveChain);
-    }
-
-    void setNextResolve(String endUrl) {
-      this.resolveChain.add(endUrl);
-    }
-
-    /**
-     * Returns any immediate URLs encountered on the resolution chain.  If the startUrl redirects
-     * directly to the endUrl or they are the same the imtermediate URLs will be empty.
-     */
-    public Iterable<String> getIntermediateUrls() {
-      return resolveChain.size() <= 1 ? ImmutableList.<String>of()
-          : resolveChain.subList(0, resolveChain.size() - 1);
-    }
-
-    public EndState getEndState() {
-      return endState;
-    }
-
-    void setEndState(EndState endState) {
-      this.endState = endState;
-    }
-
-    public String toString() {
-      return String.format("%s -> %s [%s, %d redirects]",
-          startUrl, Joiner.on(" -> ").join(resolveChain), endState, resolveChain.size());
-    }
-  }
-
-  /**
-   * Interface to use for notifying the caller of resolved URLs.
-   */
-  public interface ResolvedUrlHandler {
-    /**
-     * Signals that a URL has been resolved to its target.  The implementation of this method must
-     * be thread safe.
-     *
-     * @param future The future that has finished resolving a URL.
-     */
-    public void resolved(Future<ResolvedUrl> future);
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/net/UrlResolverUtil.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/net/UrlResolverUtil.java b/commons/src/main/java/org/apache/aurora/common/net/UrlResolverUtil.java
deleted file mode 100644
index 4b95bb7..0000000
--- a/commons/src/main/java/org/apache/aurora/common/net/UrlResolverUtil.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net;
-
-import com.google.common.base.Function;
-import com.google.common.base.Functions;
-import com.google.common.base.Preconditions;
-import org.apache.aurora.common.base.MorePreconditions;
-import java.io.IOException;
-import java.net.HttpURLConnection;
-import java.net.Proxy;
-import java.net.Proxy.Type;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.Map;
-import java.util.logging.Logger;
-import javax.annotation.Nullable;
-
-/**
- * A utility that can resolve HTTP urls.
- *
- * @author John Sirois
- */
-class UrlResolverUtil {
-
-  private static final Logger LOG = Logger.getLogger(UrlResolverUtil.class.getName());
-
-  // Default user-agent string to user for HTTP requests.
-  private static final String DEFAULT_USER_AGENT = "Lynxy/6.6.6dev.8 libwww-FM/3.14159FM";
-
-  private static Map<String, String> checkNotBlank(Map<String, String> hostToUserAgent) {
-    Preconditions.checkNotNull(hostToUserAgent);
-    MorePreconditions.checkNotBlank(hostToUserAgent.entrySet());
-    return hostToUserAgent;
-  }
-
-  private final Function<? super URL, String> urlToUserAgent;
-
-  UrlResolverUtil(Map<String, String> hostToUserAgent) {
-    this(Functions.compose(Functions.forMap(checkNotBlank(hostToUserAgent), DEFAULT_USER_AGENT),
-        new Function<URL, String>() {
-          @Override public String apply(URL url) {
-            return url.getHost();
-          }
-        }));
-  }
-
-  UrlResolverUtil(Function<? super URL, String> urlToUserAgent) {
-    this.urlToUserAgent = Preconditions.checkNotNull(urlToUserAgent);
-  }
-
-  /**
-   * Returns the URL that {@code url} lands on, which will be the result of a 3xx redirect,
-   * or {@code url} if the url does not redirect using an HTTP 3xx response code.  If there is a
-   * non-2xx or 3xx HTTP response code null is returned.
-   *
-   * @param url The URL to follow.
-   * @return The redirected URL, or {@code url} if {@code url} returns a 2XX response, otherwise
-   *         null
-   * @throws java.io.IOException If an error occurs while trying to follow the url.
-   */
-  String getEffectiveUrl(String url, @Nullable ProxyConfig proxyConfig) throws IOException {
-    Preconditions.checkNotNull(url);
-    // Don't follow https.
-    if (url.startsWith("https://")) {
-      url = url.replace("https://", "http://");
-    } else if (!url.startsWith("http://")) {
-      url = "http://" + url;
-    }
-
-    URL urlObj = new URL(url);
-
-    HttpURLConnection con;
-    if (proxyConfig != null) {
-      Proxy proxy = new Proxy(Type.HTTP, proxyConfig.getProxyAddress());
-      con = (HttpURLConnection) urlObj.openConnection(proxy);
-      ProxyAuthorizer.adapt(proxyConfig).authorize(con);
-    } else {
-      con = (HttpURLConnection) urlObj.openConnection();
-    }
-    try {
-
-      // TODO(John Sirois): several commonly tweeted hosts 406 or 400 on HEADs and only work with GETs
-      // fix the call chain to be able to specify retry-with-GET
-      con.setRequestMethod("HEAD");
-
-      con.setUseCaches(true);
-      con.setConnectTimeout(5000);
-      con.setReadTimeout(5000);
-      con.setInstanceFollowRedirects(false);
-
-      // I hate to have to do this, but some URL shorteners don't respond otherwise.
-      con.setRequestProperty("User-Agent", urlToUserAgent.apply(urlObj));
-      try {
-        con.connect();
-      } catch (StringIndexOutOfBoundsException e) {
-        LOG.info("Got StringIndexOutOfBoundsException when fetching headers for " + url);
-        return null;
-      }
-
-      int responseCode = con.getResponseCode();
-      switch (responseCode / 100) {
-        case 2:
-          return url;
-        case 3:
-          String location = con.getHeaderField("Location");
-          if (location == null) {
-            if (responseCode != 304 /* not modified */) {
-              LOG.info(
-                  String.format("[%d] Location header was null for URL: %s", responseCode, url));
-            }
-            return url;
-          }
-
-          // HTTP 1.1 spec says this should be an absolute URI, but i see lots of instances where it
-          // is relative, so we need to check.
-          try {
-            String domain = UrlHelper.getDomainChecked(location);
-            if (domain == null || domain.isEmpty()) {
-              // This is a relative URI.
-              location = "http://" + UrlHelper.getDomain(url) + location;
-            }
-          } catch (URISyntaxException e) {
-            LOG.info("location contained an invalid URI: " + location);
-          }
-
-          return location;
-        default:
-          LOG.info("Failed to resolve url: " + url + " with: "
-                   + responseCode + " -> " + con.getResponseMessage());
-          return null;
-      }
-    } finally {
-      con.disconnect();
-    }
-  }
-}


[21/21] aurora git commit: Remove unused classes from commons fork.

Posted by wf...@apache.org.
Remove unused classes from commons fork.

Reviewed at https://reviews.apache.org/r/37872/


Project: http://git-wip-us.apache.org/repos/asf/aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/aurora/commit/356eeac9
Tree: http://git-wip-us.apache.org/repos/asf/aurora/tree/356eeac9
Diff: http://git-wip-us.apache.org/repos/asf/aurora/diff/356eeac9

Branch: refs/heads/master
Commit: 356eeac974bdf2d57399ab082e1419cf0dd7c24d
Parents: 06ddaad
Author: Bill Farner <wf...@apache.org>
Authored: Fri Aug 28 11:32:58 2015 -0700
Committer: Bill Farner <wf...@apache.org>
Committed: Fri Aug 28 11:32:58 2015 -0700

----------------------------------------------------------------------
 build.gradle                                    |    4 -
 .../application/http/DefaultQuitHandler.java    |   43 -
 .../common/application/http/GraphViewer.java    |   50 -
 .../application/http/HttpAssetConfig.java       |   51 -
 .../application/http/HttpFilterConfig.java      |   39 -
 .../application/http/HttpServletConfig.java     |   65 -
 .../common/application/http/Registration.java   |  155 --
 .../application/modules/LifecycleModule.java    |   26 -
 .../common/application/modules/LogModule.java   |  117 --
 .../application/modules/StatsExportModule.java  |   85 -
 .../application/modules/ThriftModule.java       |   41 -
 .../aurora/common/base/CachingSupplier.java     |   68 -
 .../base/CallableExceptionalSupplier.java       |   32 -
 .../org/apache/aurora/common/base/Either.java   |  358 ----
 .../common/base/ExceptionTransporter.java       |   84 -
 .../common/base/ExceptionalFunctions.java       |  153 --
 .../apache/aurora/common/base/SupplierE.java    |   25 -
 .../apache/aurora/common/collections/Bits.java  |  116 --
 .../webassets/bootstrap/BootstrapModule.java    |   90 -
 .../common/webassets/jquery/JQueryModule.java   |   36 -
 .../aurora/common/inject/DefaultProvider.java   |  166 --
 .../common/inject/ProviderMethodModule.java     |   32 -
 .../aurora/common/io/Base64ZlibCodec.java       |  169 --
 .../org/apache/aurora/common/io/JsonCodec.java  |  124 --
 .../org/apache/aurora/common/io/Streamer.java   |   54 -
 .../aurora/common/logging/BufferedLog.java      |  278 ---
 .../apache/aurora/common/logging/LogUtil.java   |   90 -
 .../logging/julbridge/JULBridgeHandler.java     |  196 --
 .../julbridge/JULBridgeLevelConverter.java      |   99 -
 .../logging/julbridge/JULBridgeLogManager.java  |   87 -
 .../aurora/common/net/ProxyAuthorizer.java      |   41 -
 .../apache/aurora/common/net/ProxyConfig.java   |   30 -
 .../org/apache/aurora/common/net/UrlHelper.java |  156 --
 .../apache/aurora/common/net/UrlResolver.java   |  446 ----
 .../aurora/common/net/UrlResolverUtil.java      |  148 --
 .../aurora/common/net/UrlTokenizerUtil.java     | 1905 ------------------
 .../common/net/http/GuiceServletConfig.java     |   41 -
 .../common/net/http/HttpServerDispatch.java     |  123 --
 .../net/http/JettyHttpServerDispatch.java       |  283 ---
 .../aurora/common/net/http/RequestLogger.java   |  130 --
 .../net/http/filters/AbstractHttpFilter.java    |   63 -
 .../net/http/filters/HttpStatsFilter.java       |  158 --
 .../common/net/http/handlers/ThriftServlet.java |   70 -
 .../loadbalancing/LeastConnectedStrategy.java   |  170 --
 .../common/net/loadbalancing/LoadBalancer.java  |   76 -
 .../net/loadbalancing/LoadBalancerImpl.java     |  122 --
 .../loadbalancing/LoadBalancingStrategy.java    |   79 -
 .../net/loadbalancing/MarkDeadStrategy.java     |  220 --
 .../MarkDeadStrategyWithHostCheck.java          |   98 -
 .../net/loadbalancing/RandomStrategy.java       |   57 -
 .../net/loadbalancing/RequestTracker.java       |   37 -
 .../net/loadbalancing/RoundRobinStrategy.java   |   49 -
 .../StaticLoadBalancingStrategy.java            |   61 -
 .../net/loadbalancing/SubsetStrategy.java       |   89 -
 .../loadbalancing/TrafficMonitorAdapter.java    |   68 -
 .../net/monitoring/ConnectionMonitor.java       |   36 -
 .../common/net/monitoring/TrafficMonitor.java   |  259 ---
 .../common/net/pool/ConnectionFactory.java      |   56 -
 .../aurora/common/net/pool/ConnectionPool.java  |  334 ---
 .../common/net/pool/DynamicHostSetUtil.java     |   46 -
 .../aurora/common/net/pool/DynamicPool.java     |  170 --
 .../apache/aurora/common/net/pool/MetaPool.java |  339 ----
 .../aurora/common/net/pool/ObjectPool.java      |   82 -
 .../net/pool/ResourceExhaustedException.java    |   27 -
 .../common/objectsize/ObjectSizeCalculator.java |  427 ----
 .../common/stats/ApproximateHistogram.java      |  563 ------
 .../apache/aurora/common/stats/CounterMap.java  |  138 --
 .../common/stats/CounterMapWithTopKey.java      |   89 -
 .../org/apache/aurora/common/stats/Elapsed.java |   81 -
 .../org/apache/aurora/common/stats/Entropy.java |   51 -
 .../apache/aurora/common/stats/Histogram.java   |   43 -
 .../apache/aurora/common/stats/Histograms.java  |   39 -
 .../aurora/common/stats/MovingAverage.java      |   68 -
 .../aurora/common/stats/MovingWindowDelta.java  |   96 -
 .../common/stats/NumericStatExporter.java       |  125 --
 .../aurora/common/stats/PipelineStats.java      |  134 --
 .../apache/aurora/common/stats/Precision.java   |   50 -
 .../aurora/common/stats/PrintableHistogram.java |   90 -
 .../aurora/common/stats/ReservoirSampler.java   |   97 -
 .../aurora/common/stats/Significance.java       |   59 -
 .../apache/aurora/common/stats/Statistics.java  |   93 -
 .../common/stats/StatisticsInterface.java       |   70 -
 .../apache/aurora/common/stats/Windowed.java    |  136 --
 .../common/stats/WindowedApproxHistogram.java   |  153 --
 .../aurora/common/stats/WindowedHistogram.java  |  110 -
 .../aurora/common/stats/WindowedStatistics.java |  173 --
 .../common/stats/testing/RealHistogram.java     |   42 -
 .../aurora/common/testing/TearDownRegistry.java |   51 -
 .../common/testing/mockito/MockitoTest.java     |   31 -
 .../org/apache/aurora/common/thrift/Config.java |  302 ---
 .../thrift/TResourceExhaustedException.java     |   39 -
 .../aurora/common/thrift/TTimeoutException.java |   38 -
 .../common/thrift/TTransportConnection.java     |   70 -
 .../org/apache/aurora/common/thrift/Thrift.java |  390 ----
 .../common/thrift/ThriftConnectionFactory.java  |  366 ----
 .../aurora/common/thrift/ThriftException.java   |   26 -
 .../aurora/common/thrift/ThriftFactory.java     |  653 ------
 .../aurora/common/thrift/callers/Caller.java    |   99 -
 .../common/thrift/callers/CallerDecorator.java  |   78 -
 .../common/thrift/callers/DeadlineCaller.java   |   93 -
 .../common/thrift/callers/DebugCaller.java      |   73 -
 .../common/thrift/callers/RetryingCaller.java   |  224 --
 .../thrift/callers/StatTrackingCaller.java      |  103 -
 .../common/thrift/callers/ThriftCaller.java     |  157 --
 .../TMonitoredNonblockingServerSocket.java      |   80 -
 .../thrift/monitoring/TMonitoredProcessor.java  |   62 -
 .../monitoring/TMonitoredServerSocket.java      |  111 -
 .../common/thrift/testing/MockTSocket.java      |   45 -
 .../common/thrift/testing/TestThriftTypes.java  |    7 +-
 .../apache/aurora/common/util/DateUtils.java    |   57 -
 .../apache/aurora/common/util/FileUtils.java    |   51 -
 .../apache/aurora/common/util/LowResClock.java  |  108 -
 .../apache/aurora/common/util/ParsingUtil.java  |   53 -
 .../apache/aurora/common/util/QueueDrainer.java |   53 -
 .../aurora/common/util/RangeNormalizer.java     |   88 -
 .../common/util/RateLimitedCommandExecutor.java |   88 -
 .../aurora/common/util/RetryingRunnable.java    |  131 --
 .../aurora/common/util/caching/Cache.java       |   46 -
 .../common/util/caching/CachingMethodProxy.java |  262 ---
 .../aurora/common/util/caching/LRUCache.java    |  170 --
 .../util/concurrent/BackingOffFutureTask.java   |   56 -
 .../util/concurrent/RetryingFutureTask.java     |   81 -
 .../logging/ResourceLoggingConfigurator.java    |   49 -
 .../util/logging/UnresettableLogManager.java    |   48 -
 .../common/zookeeper/CompoundServerSet.java     |  224 --
 .../common/zookeeper/DistributedLock.java       |   39 -
 .../common/zookeeper/DistributedLockImpl.java   |  286 ---
 .../aurora/common/zookeeper/Partitioner.java    |  172 --
 .../aurora/common/zookeeper/ServerSets.java     |   32 +-
 .../common/zookeeper/StaticServerSet.java       |  145 --
 .../aurora/common/zookeeper/ZooKeeperMap.java   |  411 ----
 .../aurora/common/zookeeper/ZooKeeperNode.java  |  349 ----
 .../http/graphview/dygraph-combined.js          |   14 -
 .../application/http/graphview/dygraph-extra.js |  367 ----
 .../application/http/graphview/grapher.js       |  365 ----
 .../application/http/graphview/graphview.html   |   84 -
 .../common/application/http/graphview/parser.js |  337 ----
 .../2.1.1/css/bootstrap-responsive.min.css      |   14 -
 .../bootstrap/2.1.1/css/bootstrap.min.css       |   14 -
 .../2.1.1/img/glyphicons-halflings-white.png    |  Bin 8777 -> 0 bytes
 .../2.1.1/img/glyphicons-halflings.png          |  Bin 12799 -> 0 bytes
 .../bootstrap/2.1.1/js/bootstrap.min.js         |   19 -
 .../2.3.2/css/bootstrap-responsive.min.css      |   14 -
 .../bootstrap/2.3.2/css/bootstrap.min.css       |   14 -
 .../2.3.2/img/glyphicons-halflings-white.png    |  Bin 8777 -> 0 bytes
 .../2.3.2/img/glyphicons-halflings.png          |  Bin 12799 -> 0 bytes
 .../bootstrap/2.3.2/js/bootstrap.min.js         |   19 -
 .../webassets/jquery/js/jquery-1.8.2.min.js     |   15 -
 .../modules/LifecycleModuleTest.java            |   33 +-
 .../aurora/common/base/CachingSupplierTest.java |   64 -
 .../apache/aurora/common/base/EitherTest.java   |  263 ---
 .../common/base/ExceptionTransporterTest.java   |   57 -
 .../common/base/ExceptionalFunctionsTest.java   |  166 --
 .../aurora/common/collections/BitsTest.java     |  299 ---
 .../common/inject/DefaultProviderTest.java      |   65 -
 .../aurora/common/io/Base64ZlibCodecTest.java   |   91 -
 .../apache/aurora/common/io/JsonCodecTest.java  |  104 -
 .../aurora/common/logging/BufferedLogTest.java  |  141 --
 .../aurora/common/logging/LogUtilTest.java      |   61 -
 .../logging/julbridge/JULBridgeHandlerTest.java |   94 -
 .../julbridge/JULBridgeLevelConverterTest.java  |   94 -
 .../julbridge/JULBridgeLogManagerTest.java      |   75 -
 .../apache/aurora/common/net/UrlHelperTest.java |  120 --
 .../aurora/common/net/UrlResolverTest.java      |  171 --
 .../aurora/common/net/UrlResolverUtilTest.java  |  162 --
 .../aurora/common/net/UrlTokenizerUtilTest.java |   94 -
 .../common/net/http/RequestLoggerTest.java      |  102 -
 .../filters/HttpStatsFilterIntegrationTest.java |  165 --
 .../net/http/filters/HttpStatsFilterTest.java   |  227 ---
 .../LeastConnectedStrategyTest.java             |  286 ---
 .../net/loadbalancing/LoadBalancerImplTest.java |  141 --
 .../net/loadbalancing/MarkDeadStrategyTest.java |  332 ---
 .../MarkDeadStrategyWithHostCheckTest.java      |  146 --
 .../net/loadbalancing/RandomStrategyTest.java   |   97 -
 .../loadbalancing/RoundRobinStrategyTest.java   |  104 -
 .../net/loadbalancing/SubsetStrategyTest.java   |   98 -
 .../net/monitoring/TrafficMonitorTest.java      |  122 --
 .../common/net/pool/ConnectionPoolTest.java     |  255 ---
 .../common/net/pool/DynamicHostSetUtilTest.java |   57 -
 .../aurora/common/net/pool/DynamicPoolTest.java |  168 --
 .../objectsize/ObjectSizeCalculatorTest.java    |  211 --
 .../common/stats/ApproximateHistogramTest.java  |  321 ---
 .../apache/aurora/common/stats/ElapsedTest.java |   83 -
 .../apache/aurora/common/stats/EntropyTest.java |   58 -
 .../common/stats/MergedHistogramTest.java       |   94 -
 .../aurora/common/stats/MovingAverageTest.java  |   83 -
 .../common/stats/MovingWindowDeltaTest.java     |   91 -
 .../common/stats/NumericStatExporterTest.java   |  144 --
 .../aurora/common/stats/PipelineStatsTest.java  |  147 --
 .../common/stats/PrintableHistogramTest.java    |   27 -
 .../common/stats/ReservoirSamplerTest.java      |   75 -
 .../aurora/common/stats/StatisticsTest.java     |  116 --
 .../common/stats/WindowedHistogramTest.java     |  234 ---
 .../aurora/common/stats/WindowedStatsTest.java  |  202 --
 .../aurora/common/stats/WindowedTest.java       |  110 -
 .../common/testing/TearDownRegistryTest.java    |   46 -
 .../thrift/ThriftConnectionFactoryTest.java     |  140 --
 .../aurora/common/thrift/ThriftFactoryTest.java |  242 ---
 .../apache/aurora/common/thrift/ThriftTest.java |  931 ---------
 .../thrift/callers/AbstractCallerTest.java      |   56 -
 .../thrift/callers/DeadlineCallerTest.java      |  119 --
 .../thrift/callers/RetryingCallerTest.java      |  150 --
 .../aurora/common/util/LowResClockTest.java     |  169 --
 .../aurora/common/util/QueueDrainerTest.java    |   59 -
 .../util/RateLimitedCommandExecutorTest.java    |  115 --
 .../util/caching/CachingMethodProxyTest.java    |  257 ---
 .../common/util/caching/LRUCacheTest.java       |   81 -
 .../common/zookeeper/CompoundServerSetTest.java |  233 ---
 .../common/zookeeper/DistributedLockTest.java   |  174 --
 .../common/zookeeper/PartitionerTest.java       |  159 --
 .../common/zookeeper/ServerSetImplTest.java     |  115 +-
 .../common/zookeeper/StaticServerSetTest.java   |   85 -
 .../common/zookeeper/ZooKeeperMapTest.java      |  418 ----
 .../common/zookeeper/ZooKeeperNodeTest.java     |  297 ---
 214 files changed, 18 insertions(+), 29580 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index 9444886..05cd36f 100644
--- a/build.gradle
+++ b/build.gradle
@@ -94,8 +94,6 @@ For more details, please see https://issues.apache.org/jira/browse/AURORA-1169
   ext.stringTemplateRev = '3.2.1'
   ext.zookeeperRev = '3.3.4'
   ext.jerseyRev = '1.18.1'
-  // This can be removed onced the mockito dep is gone
-  ext.objenesisRev = '1.3'
   ext.jsrRev = '2.0.1'
   ext.commonsLangRev = '2.6'
 
@@ -116,7 +114,6 @@ For more details, please see https://issues.apache.org/jira/browse/AURORA-1169
         force "org.hamcrest:hamcrest-core:1.3"
         force "org.apache.thrift:libthrift:${thriftRev}"
         force "org.slf4j:slf4j-jdk14:${slf4jRev}"
-        force "org.objenesis:objenesis:${objenesisRev}"
       }
     }
   }
@@ -174,7 +171,6 @@ project(':commons') {
     compile "org.antlr:stringtemplate:${stringTemplateRev}"
     compile "org.apache.zookeeper:zookeeper:${zookeeperRev}"
     compile "org.easymock:easymock:3.2"
-    compile "org.mockito:mockito-core:1.9.0"
     compile "org.slf4j:slf4j-jdk14:${slf4jRev}"
 
     // TODO(zmanji): Remove dependency on this old jetty package

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/application/http/DefaultQuitHandler.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/application/http/DefaultQuitHandler.java b/commons/src/main/java/org/apache/aurora/common/application/http/DefaultQuitHandler.java
deleted file mode 100644
index 6a48b84..0000000
--- a/commons/src/main/java/org/apache/aurora/common/application/http/DefaultQuitHandler.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.application.http;
-
-import java.util.logging.Logger;
-
-import com.google.inject.Inject;
-
-import org.apache.aurora.common.application.Lifecycle;
-
-/**
- * The default quit handler to use, which invokes {@link Lifecycle#shutdown()}.
- *
- * @author William Farner
- */
-public class DefaultQuitHandler implements Runnable {
-
-  private static final Logger LOG = Logger.getLogger(DefaultQuitHandler.class.getName());
-
-  private final Lifecycle lifecycle;
-
-  @Inject
-  public DefaultQuitHandler(Lifecycle lifecycle) {
-    this.lifecycle = lifecycle;
-  }
-
-  @Override
-  public void run() {
-    LOG.info("Instructing lifecycle to destroy.");
-    lifecycle.shutdown();
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/application/http/GraphViewer.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/application/http/GraphViewer.java b/commons/src/main/java/org/apache/aurora/common/application/http/GraphViewer.java
deleted file mode 100644
index f786f9e..0000000
--- a/commons/src/main/java/org/apache/aurora/common/application/http/GraphViewer.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.application.http;
-
-import com.google.inject.Binder;
-
-/**
- * A utility class to register the file resources for the graph viewer.
- */
-public final class GraphViewer {
-
-  private GraphViewer() {
-    // Utility class.
-  }
-
-  private static void registerJs(Binder binder, String assetName) {
-    Registration.registerHttpAsset(
-        binder,
-        "/graphview/" + assetName,
-        GraphViewer.class,
-        "graphview/" + assetName,
-        "application/javascript",
-        true);
-  }
-
-  /**
-   * Registers required resources with the binder.
-   *
-   * @param binder Binder to register with.
-   */
-  public static void registerResources(Binder binder) {
-    registerJs(binder, "dygraph-combined.js");
-    registerJs(binder, "dygraph-extra.js");
-    registerJs(binder, "grapher.js");
-    registerJs(binder, "parser.js");
-    Registration.registerHttpAsset(binder,
-        "/graphview", GraphViewer.class, "graphview/graphview.html", "text/html", false);
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/application/http/HttpAssetConfig.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/application/http/HttpAssetConfig.java b/commons/src/main/java/org/apache/aurora/common/application/http/HttpAssetConfig.java
deleted file mode 100644
index e2160e7..0000000
--- a/commons/src/main/java/org/apache/aurora/common/application/http/HttpAssetConfig.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.application.http;
-
-import java.net.URL;
-
-import com.google.common.io.Resources;
-
-import org.apache.aurora.common.net.http.handlers.AssetHandler;
-import org.apache.aurora.common.net.http.handlers.AssetHandler.StaticAsset;
-
-import static org.apache.aurora.common.base.MorePreconditions.checkNotBlank;
-
-/**
- * Configuration for a static HTTP-served asset.
- *
- * TODO(William Farner): Move this to a more appropriate package after initial AppLauncher check-in.
- *
- * @author William Farner
- */
-public class HttpAssetConfig {
-  public final String path;
-  public final AssetHandler handler;
-  public final boolean silent;
-
-  /**
-   * Creates a new asset configuration.
-   *
-   * @param path HTTP path the asset should be accessible from.
-   * @param asset Asset resource URL.
-   * @param contentType HTTP content-type to report for the asset.
-   * @param silent Whether the asset should be visible on the default index page.
-   */
-  public HttpAssetConfig(String path, URL asset, String contentType, boolean silent) {
-    this.path = checkNotBlank(path);
-    this.handler = new AssetHandler(
-        new StaticAsset(Resources.newInputStreamSupplier(asset), contentType, true));
-    this.silent = silent;
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/application/http/HttpFilterConfig.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/application/http/HttpFilterConfig.java b/commons/src/main/java/org/apache/aurora/common/application/http/HttpFilterConfig.java
deleted file mode 100644
index d096317..0000000
--- a/commons/src/main/java/org/apache/aurora/common/application/http/HttpFilterConfig.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.application.http;
-
-import javax.servlet.Filter;
-
-import org.apache.aurora.common.base.MorePreconditions;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * Configuration tuple for an HTTP filter.
- */
-public class HttpFilterConfig {
-  public final Class<? extends Filter> filterClass;
-  public final String pathSpec;
-
-  /**
-   * Creates a new filter configuration.
-   *
-   * @param filterClass Filter class.
-   * @param pathSpec Path spec that the filter should match.
-   */
-  public HttpFilterConfig(Class<? extends Filter> filterClass, String pathSpec) {
-    this.pathSpec = MorePreconditions.checkNotBlank(pathSpec);
-    this.filterClass = checkNotNull(filterClass);
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/application/http/HttpServletConfig.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/application/http/HttpServletConfig.java b/commons/src/main/java/org/apache/aurora/common/application/http/HttpServletConfig.java
deleted file mode 100644
index 4444e4c..0000000
--- a/commons/src/main/java/org/apache/aurora/common/application/http/HttpServletConfig.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.application.http;
-
-import javax.servlet.http.HttpServlet;
-
-import com.google.common.collect.ImmutableMap;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import static org.apache.aurora.common.base.MorePreconditions.checkNotBlank;
-
-/**
- * An {@link javax.servlet.http.HttpServlet} configuration used to mount HTTP handlers via
- * {@link Registration#registerServlet(com.google.inject.Binder, HttpServletConfig)}.
- *
- * TODO(William Farner): Move this to a more appropriate package after initial AppLauncher check-in.
- *
- */
-public class HttpServletConfig {
-  public final String path;
-  public final Class<? extends HttpServlet> handlerClass;
-  public final ImmutableMap<String, String> params;
-  public final boolean silent;
-
-  /**
-   * Creates a new servlet config.
-   *
-   * @param path the absolute path to mount the handler on
-   * @param servletClass the type of servlet that will render pages at {@code path}
-   * @param silent whether or not to display a link for this handler on the landing page
-   */
-  public HttpServletConfig(String path, Class<? extends HttpServlet> servletClass,
-      boolean silent) {
-    this(path, servletClass, ImmutableMap.<String, String>of(), silent);
-  }
-
-  /**
-   * Registers a new servlet config with servlet initialization parameters.
-   *
-   * @param path the absolute path to mount the handler on
-   * @param servletClass the type of servlet that will render pages at {@code path}
-   * @param params a map of servlet init parameters to initialize the servlet with
-   * @param silent whether or not to display a link for this handler on the landing page
-   */
-  public HttpServletConfig(String path, Class<? extends HttpServlet> servletClass,
-      ImmutableMap<String, String> params, boolean silent) {
-
-    this.path = checkNotBlank(path);
-    this.handlerClass = checkNotNull(servletClass);
-    this.params = checkNotNull(params);
-    this.silent = silent;
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/application/http/Registration.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/application/http/Registration.java b/commons/src/main/java/org/apache/aurora/common/application/http/Registration.java
deleted file mode 100644
index b66c8c8..0000000
--- a/commons/src/main/java/org/apache/aurora/common/application/http/Registration.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.application.http;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-import java.net.URL;
-
-import javax.servlet.Filter;
-import javax.servlet.http.HttpServlet;
-
-import com.google.common.io.Resources;
-import com.google.inject.Binder;
-import com.google.inject.BindingAnnotation;
-import com.google.inject.multibindings.Multibinder;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-/**
- * Utility class for registering HTTP servlets and assets.
- */
-public final class Registration {
-
-  private Registration() {
-    // Utility class.
-  }
-
-  /**
-   * Equivalent to
-   * {@code registerServlet(binder, new HttpServletConfig(path, servletClass, silent))}.
-   */
-  public static void registerServlet(Binder binder, String path,
-      Class<? extends HttpServlet> servletClass, boolean silent) {
-    registerServlet(binder, new HttpServletConfig(path, servletClass, silent));
-  }
-
-  /**
-   * Registers a binding for an {@link javax.servlet.http.HttpServlet} to be exported at a specified
-   * path.
-   *
-   * @param binder a guice binder to register the handler with
-   * @param config a servlet mounting specification
-   */
-  public static void registerServlet(Binder binder, HttpServletConfig config) {
-    Multibinder.newSetBinder(binder, HttpServletConfig.class).addBinding().toInstance(config);
-  }
-
-  /**
-   * A binding annotation applied to the set of additional index page links bound via
-   * {@link #Registration#registerEndpoint()}
-   */
-  @BindingAnnotation
-  @Target({FIELD, PARAMETER, METHOD})
-  @Retention(RUNTIME)
-  public @interface IndexLink { }
-
-  /**
-   * Gets the multibinder used to bind links on the root servlet.
-   * The resulting {@link java.util.Set} is bound with the {@link IndexLink} annotation.
-   *
-   * @param binder a guice binder to associate the multibinder with.
-   * @return The multibinder to bind index links against.
-   */
-  public static Multibinder<String> getEndpointBinder(Binder binder) {
-    return Multibinder.newSetBinder(binder, String.class, IndexLink.class);
-  }
-
-  /**
-   * Registers a link to display on the root servlet.
-   *
-   * @param binder a guice binder to register the link with.
-   * @param endpoint Endpoint URI to include.
-   */
-  public static void registerEndpoint(Binder binder, String endpoint) {
-    getEndpointBinder(binder).addBinding().toInstance(endpoint);
-  }
-
-  /**
-   * Registers a binding for a URL asset to be served by the HTTP server, with an optional
-   * entity tag for cache control.
-   *
-   * @param binder a guice binder to register the handler with
-   * @param servedPath Path to serve the resource from in the HTTP server.
-   * @param asset Resource to be served.
-   * @param assetType MIME-type for the asset.
-   * @param silent Whether the server should hide this asset on the index page.
-   */
-  public static void registerHttpAsset(Binder binder, String servedPath, URL asset,
-      String assetType, boolean silent) {
-    Multibinder.newSetBinder(binder, HttpAssetConfig.class).addBinding().toInstance(
-        new HttpAssetConfig(servedPath, asset, assetType, silent));
-  }
-
-  /**
-   * Registers a binding for a classpath resource to be served by the HTTP server, using a resource
-   * path relative to a class.
-   *
-   * @param binder a guice binder to register the handler with
-   * @param servedPath Path to serve the asset from in the HTTP server.
-   * @param contextClass Context class for defining the relative path to the asset.
-   * @param assetRelativePath Path to the served asset, relative to {@code contextClass}.
-   * @param assetType MIME-type for the asset.
-   * @param silent Whether the server should hide this asset on the index page.
-   */
-  public static void registerHttpAsset(
-      Binder binder,
-      String servedPath,
-      Class<?> contextClass,
-      String assetRelativePath,
-      String assetType,
-      boolean silent) {
-
-    registerHttpAsset(binder, servedPath, Resources.getResource(contextClass, assetRelativePath),
-        assetType, silent);
-  }
-
-  /**
-   * Gets the multibinder used to bind HTTP filters.
-   *
-   * @param binder a guice binder to associate the multibinder with.
-   * @return The multibinder to bind HTTP filter configurations against.
-   */
-  public static Multibinder<HttpFilterConfig> getFilterBinder(Binder binder) {
-    return Multibinder.newSetBinder(binder, HttpFilterConfig.class);
-  }
-
-  /**
-   * Registers an HTTP servlet filter.
-   *
-   * @param binder a guice binder to register the filter with.
-   * @param filterClass Filter class to register.
-   * @param pathSpec Path spec that the filter should be activated on.
-   */
-  public static void registerServletFilter(
-      Binder binder,
-      Class<? extends Filter> filterClass,
-      String pathSpec) {
-
-    getFilterBinder(binder).addBinding().toInstance(new HttpFilterConfig(filterClass, pathSpec));
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/application/modules/LifecycleModule.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/application/modules/LifecycleModule.java b/commons/src/main/java/org/apache/aurora/common/application/modules/LifecycleModule.java
index b3e59e7..6414208 100644
--- a/commons/src/main/java/org/apache/aurora/common/application/modules/LifecycleModule.java
+++ b/commons/src/main/java/org/apache/aurora/common/application/modules/LifecycleModule.java
@@ -120,32 +120,6 @@ public class LifecycleModule extends AbstractModule {
   }
 
   /**
-   * Binds a service runner that will start and stop a local service.
-   *
-   * @param binder Binder to bind against.
-   * @param launcher Launcher class for a service.
-   */
-  public static void bindServiceRunner(Binder binder, Class<? extends ServiceRunner> launcher) {
-    runnerBinder(binder).addBinding().to(launcher);
-    binder.bind(launcher).in(Singleton.class);
-  }
-
-  /**
-   * Binds a local service instance, without attaching an explicit lifecycle.
-   *
-   * @param binder Binder to bind against.
-   * @param service Local service instance to bind.
-   */
-  public static void bindLocalService(Binder binder, final LocalServiceRegistry.LocalService service) {
-    runnerBinder(binder).addBinding().toInstance(
-        new ServiceRunner() {
-          @Override public LocalServiceRegistry.LocalService launch() {
-            return service;
-          }
-        });
-  }
-
-  /**
    * Adds a startup action to the startup registry binding.
    *
    * @param binder Binder to bind against.

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/application/modules/LogModule.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/application/modules/LogModule.java b/commons/src/main/java/org/apache/aurora/common/application/modules/LogModule.java
deleted file mode 100644
index 107e3aa..0000000
--- a/commons/src/main/java/org/apache/aurora/common/application/modules/LogModule.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.application.modules;
-
-import java.io.File;
-import java.util.logging.Logger;
-
-import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
-import com.google.inject.AbstractModule;
-import com.google.inject.Inject;
-import com.google.inject.TypeLiteral;
-import com.google.inject.name.Named;
-import com.google.inject.name.Names;
-
-import org.apache.aurora.common.args.Arg;
-import org.apache.aurora.common.args.CmdLine;
-import org.apache.aurora.common.args.constraints.CanRead;
-import org.apache.aurora.common.args.constraints.Exists;
-import org.apache.aurora.common.args.constraints.IsDirectory;
-import org.apache.aurora.common.base.Command;
-import org.apache.aurora.common.logging.LogUtil;
-import org.apache.aurora.common.logging.RootLogConfig;
-import org.apache.aurora.common.logging.RootLogConfig.Configuration;
-import org.apache.aurora.common.net.http.handlers.LogPrinter;
-import org.apache.aurora.common.stats.StatImpl;
-import org.apache.aurora.common.stats.Stats;
-
-/**
- * Binding module for logging-related bindings, such as the log directory.
- *
- * This module uses a single optional command line argument 'log_dir'.  If unset, the logging
- * directory will be auto-discovered via:
- * {@link LogUtil#getLogManagerLogDir()}.
- *
- * Bindings provided by this module:
- * <ul>
- *   <li>{@code @Named(LogPrinter.LOG_DIR_KEY) File} - Log directory.
- *   <li>{@code Optional&lt;RootLogConfig.Configuraton&gt;} - If glog is enabled the configuration
- *       used.
- * </ul>
- *
- * Default bindings that may be overridden:
- * <ul>
- *   <li>Log directory: directory where application logs are written.  May be overridden by binding
- *       to: {@code bind(File.class).annotatedWith(Names.named(LogPrinter.LOG_DIR_KEY))}.
- * </ul>
- *
- * @author William Farner
- */
-public class LogModule extends AbstractModule {
-
-  private static final Logger LOG = Logger.getLogger(LogModule.class.getName());
-
-  @Exists
-  @CanRead
-  @IsDirectory
-  @CmdLine(name = "log_dir",
-           help = "The directory where application logs are written.")
-  private static final Arg<File> LOG_DIR = Arg.create(null);
-
-  @CmdLine(name = "use_glog",
-           help = "True to use the new glog-based configuration for the root logger.")
-  private static final Arg<Boolean> USE_GLOG = Arg.create(true);
-
-  @Override
-  protected void configure() {
-    // Bind the default log directory.
-    bind(File.class).annotatedWith(Names.named(LogPrinter.LOG_DIR_KEY)).toInstance(getLogDir());
-
-    LifecycleModule.bindStartupAction(binder(), ExportLogDir.class);
-
-    Configuration configuration = null;
-    if (USE_GLOG.get()) {
-      configuration = RootLogConfig.configurationFromFlags();
-      configuration.apply();
-    }
-    bind(new TypeLiteral<Optional<Configuration>>() { })
-        .toInstance(Optional.fromNullable(configuration));
-  }
-
-  private File getLogDir() {
-    File logDir = LOG_DIR.get();
-    if (logDir == null) {
-      logDir = LogUtil.getLogManagerLogDir();
-      LOG.info("From logging properties, parsed log directory " + logDir.getAbsolutePath());
-    }
-    return logDir;
-  }
-
-  public static final class ExportLogDir implements Command {
-    private final File logDir;
-
-    @Inject ExportLogDir(@Named(LogPrinter.LOG_DIR_KEY) final File logDir) {
-      this.logDir = Preconditions.checkNotNull(logDir);
-    }
-
-    @Override public void execute() {
-      Stats.exportStatic(new StatImpl<String>("logging_dir") {
-        @Override public String read() {
-          return logDir.getAbsolutePath();
-        }
-      });
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/application/modules/StatsExportModule.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/application/modules/StatsExportModule.java b/commons/src/main/java/org/apache/aurora/common/application/modules/StatsExportModule.java
deleted file mode 100644
index ba93d4c..0000000
--- a/commons/src/main/java/org/apache/aurora/common/application/modules/StatsExportModule.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.application.modules;
-
-import java.util.Map;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ThreadFactory;
-
-import com.google.common.base.Preconditions;
-import com.google.common.util.concurrent.ThreadFactoryBuilder;
-import com.google.inject.AbstractModule;
-import com.google.inject.Inject;
-import com.google.inject.Key;
-import com.google.inject.TypeLiteral;
-
-import org.apache.aurora.common.application.ShutdownRegistry;
-import org.apache.aurora.common.args.Arg;
-import org.apache.aurora.common.args.CmdLine;
-import org.apache.aurora.common.base.Closure;
-import org.apache.aurora.common.base.Command;
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-import org.apache.aurora.common.stats.NumericStatExporter;
-
-/**
- * Module to enable periodic exporting of registered stats to an external service.
- *
- * This modules supports a single command line argument, {@code stat_export_interval}, which
- * controls the export interval (defaulting to 1 minute).
- *
- * Bindings required by this module:
- * <ul>
- *   <li>{@code @ShutdownStage ShutdownRegistry} - Shutdown action registry.
- * </ul>
- *
- * @author William Farner
- */
-public class StatsExportModule extends AbstractModule {
-
-  @CmdLine(name = "stat_export_interval",
-           help = "Amount of time to wait between stat exports.")
-  private static final Arg<Amount<Long, Time>> EXPORT_INTERVAL =
-      Arg.create(Amount.of(1L, Time.MINUTES));
-
-  @Override
-  protected void configure() {
-    requireBinding(Key.get(new TypeLiteral<Closure<Map<String, ? extends Number>>>() { }));
-    LifecycleModule.bindStartupAction(binder(), StartCuckooExporter.class);
-  }
-
-  public static final class StartCuckooExporter implements Command {
-
-    private final Closure<Map<String, ? extends Number>> statSink;
-    private final ShutdownRegistry shutdownRegistry;
-
-    @Inject StartCuckooExporter(
-        Closure<Map<String, ? extends Number>> statSink,
-        ShutdownRegistry shutdownRegistry) {
-
-      this.statSink = Preconditions.checkNotNull(statSink);
-      this.shutdownRegistry = Preconditions.checkNotNull(shutdownRegistry);
-    }
-
-    @Override public void execute() {
-      ThreadFactory threadFactory =
-          new ThreadFactoryBuilder().setNameFormat("CuckooExporter-%d").setDaemon(true).build();
-
-      final NumericStatExporter exporter = new NumericStatExporter(statSink,
-          Executors.newScheduledThreadPool(1, threadFactory), EXPORT_INTERVAL.get());
-
-      exporter.start(shutdownRegistry);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/application/modules/ThriftModule.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/application/modules/ThriftModule.java b/commons/src/main/java/org/apache/aurora/common/application/modules/ThriftModule.java
deleted file mode 100644
index 55236df..0000000
--- a/commons/src/main/java/org/apache/aurora/common/application/modules/ThriftModule.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.application.modules;
-
-import com.google.inject.AbstractModule;
-import com.google.inject.multibindings.Multibinder;
-import com.google.inject.name.Names;
-
-import org.apache.aurora.common.application.http.Registration;
-import org.apache.aurora.common.net.http.handlers.ThriftServlet;
-import org.apache.aurora.common.net.monitoring.TrafficMonitor;
-
-/**
- * Binding module for thrift traffic monitor servlets, to ensure an empty set is available for
- * the thrift traffic monitor servlet.
- *
- * @author William Farner
- */
-public class ThriftModule extends AbstractModule {
-  @Override
-  protected void configure() {
-    // Make sure that there is at least an empty set bound to client andserver monitors.
-    Multibinder.newSetBinder(binder(), TrafficMonitor.class,
-        Names.named(ThriftServlet.THRIFT_CLIENT_MONITORS));
-    Multibinder.newSetBinder(binder(), TrafficMonitor.class,
-        Names.named(ThriftServlet.THRIFT_SERVER_MONITORS));
-
-    Registration.registerServlet(binder(), "/thrift", ThriftServlet.class, false);
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/base/CachingSupplier.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/base/CachingSupplier.java b/commons/src/main/java/org/apache/aurora/common/base/CachingSupplier.java
deleted file mode 100644
index 3a1511d..0000000
--- a/commons/src/main/java/org/apache/aurora/common/base/CachingSupplier.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.base;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
-
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-import org.apache.aurora.common.util.Clock;
-
-/**
- * A supplier that caches responses from an underling supplier, expiring the cached value after
- * a fixed expiration time.
- *
- * @param <T> Supplied value type.
- *
- * @author William Farner
- */
-public class CachingSupplier<T> implements Supplier<T> {
-
-  private final Supplier<T> wrapped;
-  private final long expirationNanos;
-  private final Clock clock;
-
-  private long lastFetchNanos = -1;
-  private T cachedValue;
-
-  /**
-   * Creates a new caching supplier.
-   *
-   * @param wrapped The supplier to delegate fetches to.
-   * @param expiration The maximum amount of time that a response from {@code supplier} will be
-   *   cached for.  The expiration must be positive.
-   */
-  public CachingSupplier(Supplier<T> wrapped, Amount<Long, Time> expiration) {
-    this(wrapped, expiration, Clock.SYSTEM_CLOCK);
-  }
-
-  @VisibleForTesting
-  CachingSupplier(Supplier<T> wrapped, Amount<Long, Time> expiration, Clock clock) {
-    this.wrapped = Preconditions.checkNotNull(wrapped);
-    this.expirationNanos = Preconditions.checkNotNull(expiration).as(Time.NANOSECONDS);
-    Preconditions.checkArgument(expiration.getValue() > 0, "Expiration must be positive.");
-    this.clock = Preconditions.checkNotNull(clock);
-  }
-
-  @Override
-  public synchronized T get() {
-    if ((lastFetchNanos == -1) || (clock.nowNanos() - lastFetchNanos > expirationNanos)) {
-      cachedValue = wrapped.get();
-      lastFetchNanos = clock.nowNanos();
-    }
-
-    return cachedValue;
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/base/CallableExceptionalSupplier.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/base/CallableExceptionalSupplier.java b/commons/src/main/java/org/apache/aurora/common/base/CallableExceptionalSupplier.java
deleted file mode 100644
index b4f2d53..0000000
--- a/commons/src/main/java/org/apache/aurora/common/base/CallableExceptionalSupplier.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.base;
-
-import java.util.concurrent.Callable;
-
-/**
- * A supplier that may also be called.
- *
- * @param <T> The supplier type.
- * @param <E> Supplier exception type.
- *
- * @author John Sirois
- */
-public abstract class CallableExceptionalSupplier<T, E extends Exception>
-    implements ExceptionalSupplier<T, E>, Callable<T> {
-
-  @Override public T call() throws Exception {
-    return get();
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/base/Either.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/base/Either.java b/commons/src/main/java/org/apache/aurora/common/base/Either.java
deleted file mode 100644
index a746e72..0000000
--- a/commons/src/main/java/org/apache/aurora/common/base/Either.java
+++ /dev/null
@@ -1,358 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.base;
-
-import javax.annotation.Nullable;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Optional;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-
-/**
- * A value of one of two possible types.
- *
- * <p>Often Either processing is used as an alternative exception flow control.  In these uses the
- * left type represents failure by convention and the right type the success path result.
- *
- * @param <L> The left type.
- * @param <R> The right type.
- */
-public final class Either<L, R> {
-  private final Optional<L> left;
-  private final Optional<R> right;
-
-  private Either(Optional<L> left, Optional<R> right) {
-    this.left = left;
-    this.right = right;
-  }
-
-  /**
-   * Turns a left into a right and vice-versa.
-   *
-   * @return A new swapped either instance.
-   */
-  public Either<R, L> swap() {
-    return new Either<R, L>(right, left);
-  }
-
-  /**
-   * Returns an optional the will be {@link Optional#isPresent() present} is this is a left
-   * instance.
-   *
-   * @return An optional value for the left.
-   */
-  public Optional<L> left() {
-    return left;
-  }
-
-  /**
-   * Returns an optional the will be {@link Optional#isPresent() present} is this is a right
-   * instance.
-   *
-   * @return An optional value for the right.
-   */
-  public Optional<R> right() {
-    return right;
-  }
-
-  /**
-   * Returns {@code true} if this is a left instance.
-   *
-   * @return {@code true} if this is a left.
-   */
-  public boolean isLeft() {
-    return left().isPresent();
-  }
-
-  /**
-   * Returns {@code true} if this is a right instance.
-   *
-   * @return {@code true} if this is a right.
-   */
-  public boolean isRight() {
-    return right().isPresent();
-  }
-
-  /**
-   * Returns the underlying value if this is a left; otherwise, throws.
-   *
-   * @return The underlying value.
-   * @throws IllegalStateException if this is a right instance.
-   */
-  public L getLeft() {
-    return left().get();
-  }
-
-  /**
-   * Returns the underlying value if this is a right; otherwise, throws.
-   *
-   * @return The underlying value.
-   * @throws IllegalStateException if this is a right instance.
-   */
-  public R getRight() {
-    return right().get();
-  }
-
-  /**
-   * If this is a left, maps its value into a new left; otherwise just returns this right.
-   *
-   * @param transformer The transformation to apply to the left value.
-   * @param <M> The type a left value will be mapped to.
-   * @return The mapped left or else the right.
-   */
-  public <M> Either<M, R> mapLeft(Function<? super L, M> transformer) {
-    if (isLeft()) {
-      return left(transformer.apply(getLeft()));
-    } else {
-      @SuppressWarnings("unchecked") // I am a right so my left is never accessible
-      Either<M, R> self = (Either<M, R>) this;
-      return self;
-    }
-  }
-
-  /**
-   * If this is a right, maps its value into a new right; otherwise just returns this left.
-   *
-   * @param transformer The transformation to apply to the left value.
-   * @param <M> The type a right value will be mapped to.
-   * @return The mapped right or else the left.
-   */
-  public <M> Either<L, M> mapRight(Function<? super R, M> transformer) {
-    if (isRight()) {
-      return right(transformer.apply(getRight()));
-    } else {
-      @SuppressWarnings("unchecked") // I am a left so my right is never accessible
-      Either<L, M> self = (Either<L, M>) this;
-      return self;
-    }
-  }
-
-  /**
-   * Can transform either a left or a right into a result.
-   *
-   * @param <L> The left type.
-   * @param <R> The right type.
-   * @param <T> The transformation result type.
-   */
-  public abstract static class Transformer<L, R, T> implements Function<Either<L, R>, T> {
-
-    /**
-     * Maps left values to a result.
-     *
-     * @param left the left value to map.
-     * @return The mapped value.
-     */
-    public abstract T mapLeft(L left);
-
-    /**
-     * Maps right values to a result.
-     *
-     * @param right the right value to map.
-     * @return The mapped value.
-     */
-    public abstract T mapRight(R right);
-
-    @Override
-    public final T apply(Either<L, R> either) {
-      return either.map(this);
-    }
-  }
-
-  /**
-   * Creates a transformer from left and right transformation functions.
-   *
-   * @param leftTransformer A transformer to process left values.
-   * @param rightTransformer A transformer to process right values.
-   * @param <L> The left type.
-   * @param <R> The right type.
-   * @param <T> The transformation result type.
-   * @return A new transformer composed of left and right transformer functions.
-   */
-  public static <L, R, T> Transformer<L, R, T> transformer(
-      final Function<? super L, T> leftTransformer,
-      final Function<? super R, T> rightTransformer) {
-
-    return new Transformer<L, R, T>() {
-      @Override public T mapLeft(L item) {
-        return leftTransformer.apply(item);
-      }
-      @Override public T mapRight(R item) {
-        return rightTransformer.apply(item);
-      }
-    };
-  }
-
-  /**
-   * Transforms this either instance to a value regardless of whether it is a left or a right.
-   *
-   * @param transformer The transformer to map this either instance.
-   * @param <T> The type the transformer produces.
-   * @return A value mapped by the transformer from this left or right instance.
-   */
-  public <T> T map(final Transformer<? super L, ? super R, T> transformer) {
-    if (isLeft()) {
-      return transformer.mapLeft(getLeft());
-    } else {
-      return transformer.mapRight(getRight());
-    }
-  }
-
-  @Override
-  public boolean equals(@Nullable Object o) {
-    if (!(o instanceof Either)) {
-      return false;
-    }
-    Either<?, ?> other = (Either<?, ?>) o;
-    return Objects.equal(left, other.left)
-        && Objects.equal(right, other.right);
-  }
-
-  @Override
-  public int hashCode() {
-    return Objects.hashCode(left, right);
-  }
-
-  @Override
-  public String toString() {
-    if (isLeft()) {
-      return String.format("Left(%s)", getLeft());
-    } else {
-      return String.format("Right(%s)", getRight());
-    }
-  }
-
-  /**
-   * Creates a left either instance.
-   *
-   * @param value The left value to wrap - may not be null.
-   * @param <L> The left type.
-   * @param <R> The right type.
-   * @return A left either instance wrapping {@code value}.
-   */
-  public static <L, R> Either<L, R> left(L value) {
-    return new Either<L, R>(Optional.of(value), Optional.<R>absent());
-  }
-
-  /**
-   * Creates a right either instance.
-   *
-   * @param value The right value to wrap - may not be null.
-   * @param <L> The left type.
-   * @param <R> The right type.
-   * @return A right either instance wrapping {@code value}.
-   */
-  public static <L, R> Either<L, R> right(R value) {
-    return new Either<L, R>(Optional.<L>absent(), Optional.of(value));
-  }
-
-  /**
-   * Extracts all the lefts from a sequence of eithers lazily.
-   *
-   * @param results A sequence of either's to process.
-   * @param <L> The left type.
-   * @param <R> The right type.
-   * @return A lazy iterable that will produce the lefts present in results in order.
-   */
-  public static <L, R> Iterable<L> lefts(Iterable<Either<L, R>> results) {
-    return Optional.presentInstances(Iterables.transform(results,
-        new Function<Either<L, R>, Optional<L>>() {
-          @Override public Optional<L> apply(Either<L, R> item) {
-            return item.left();
-          }
-        }));
-  }
-
-  /**
-   * Extracts all the rights from a sequence of eithers lazily.
-   *
-   * @param results A sequence of either's to process.
-   * @param <L> The left type.
-   * @param <R> The right type.
-   * @return A lazy iterable that will produce the rights present in results in order.
-   */
-  public static <L, R> Iterable<R> rights(Iterable<Either<L, R>> results) {
-    return Optional.presentInstances(Iterables.transform(results,
-        new Function<Either<L, R>, Optional<R>>() {
-          @Override public Optional<R> apply(Either<L, R> item) {
-            return item.right();
-          }
-        }));
-  }
-
-  /**
-   * A convenience method equivalent to calling {@code guard(work, exceptionType)}.
-   */
-  public static <X extends Exception, R> Either<X, R> guard(
-      Class<X> exceptionType,
-      ExceptionalSupplier<R, X> work) {
-
-    @SuppressWarnings("unchecked")
-    Either<X, R> either = guard(work, exceptionType);
-    return either;
-  }
-
-  /**
-   * A convenience method equivalent to calling
-   * {@code guard(Lists.asList(execpetionType, rest), work)}.
-   */
-  public static <X extends Exception, R> Either<X, R> guard(
-      ExceptionalSupplier<R, X> work,
-      Class<? extends X> exceptionType,
-      Class<? extends X>... rest) {
-
-    return guard(Lists.asList(exceptionType, rest), work);
-  }
-
-  /**
-   * Thrown when guarded work throws an unguarded exception.  The {@link #getCause() cause} will
-   * contain the original unguarded exception.
-   */
-  public static class UnguardedException extends RuntimeException {
-    public UnguardedException(Throwable cause) {
-      super(cause);
-    }
-  }
-
-  /**
-   * Converts work that can throw exceptions into an either with a left exception base type.  This
-   * can be useful to fold an exception throwing library call into an either processing style
-   * pipeline.
-   *
-   * @param exceptionTypes The expected exception types.
-   * @param work The work to perform to get a result produce an error.
-   * @param <X> The base error type.
-   * @param <R> The success type.
-   * @return An either wrapping the result of performing {@code work}.
-   * @throws UnguardedException if work throws an unguarded exception type.
-   */
-  public static <X extends Exception, R> Either<X, R> guard(
-      Iterable<Class<? extends X>> exceptionTypes,
-      ExceptionalSupplier<R, X> work) {
-
-    try {
-      return right(work.get());
-    // We're explicitly dealing with generic exception types here by design.
-    // SUPPRESS CHECKSTYLE RegexpSinglelineJava
-    } catch (Exception e) {
-      for (Class<? extends X> exceptionType : exceptionTypes) {
-        if (exceptionType.isInstance(e)) {
-          X exception = exceptionType.cast(e);
-          return left(exception);
-        }
-      }
-      throw new UnguardedException(e);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/base/ExceptionTransporter.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/base/ExceptionTransporter.java b/commons/src/main/java/org/apache/aurora/common/base/ExceptionTransporter.java
deleted file mode 100644
index e5cb60d..0000000
--- a/commons/src/main/java/org/apache/aurora/common/base/ExceptionTransporter.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.base;
-
-import com.google.common.base.Function;
-
-/**
- * A utility for transporting checked exceptions across boundaries that do not allow for checked
- * exception propagation.
- *
- * @param <E> The type of checked exception the ExceptionTransported can transport
- *
- * @author John Sirois
- */
-public class ExceptionTransporter<E extends Exception> {
-
-  /**
-   * An exception wrapper used to transport checked exceptions.  Never leaves an
-   * {@link ExceptionTransporter#guard(com.google.common.base.Function)} call.
-   */
-  private static final class TransportingException extends RuntimeException {
-    private TransportingException(Exception cause) {
-      super("It is a usage error to see this message!", cause);
-    }
-  }
-
-  /**
-   * Guards a unit of work that internally can generate checked exceptions.  Callers wrap up the
-   * work in a function that rethrows any checked exceptions using the supplied
-   * ExceptionTransporter.  Guard will ensure the original exception is unwrapped an re-thrown.
-   *
-   * @param work The unit of work that guards its checked exceptions.
-   * @param <T> The type returned by the unit of work when it successfully completes.
-   * @param <X> The type of checked exception that the unit of work wishes to guard.
-   * @return the result of the unit of work if no excpetions are thrown
-   * @throws X when the unit of work uses the ExceptionTransporter to throw a checked exception
-   */
-  public static <T, X extends Exception> T guard(Function<ExceptionTransporter<X>, T> work)
-    throws X {
-
-    try {
-      return work.apply(new ExceptionTransporter<X>());
-    } catch (TransportingException e) {
-      @SuppressWarnings("unchecked")
-      X cause = (X) e.getCause();
-      throw cause;
-    }
-  }
-
-  /**
-   * Throws the given {@code checked} exception across a boundary that does not allow checked
-   * exceptions.  Although a RuntimeException is returned by this method signature, the method never
-   * actually completes normally.  The return type does allow the following usage idiom however:
-   * <pre>
-   * public String apply(ExceptionTransporter transporter) {
-   *   try {
-   *     return doChecked();
-   *   } catch (CheckedException e) {
-   *     // Although transport internally throws and does not return, we satisfy the compiler that
-   *     // our method returns a value or throws by pretending to throw the RuntimeException that
-   *     // never actually gets returned by transporter.transport(...)
-   *     throw transporter.transport(e);
-   *   }
-   * }
-   * </pre>
-   *
-   * @param checked The checked exception to transport.
-   * @return A RuntimeException that can be thrown to satisfy the compiler at the call site
-   */
-  public RuntimeException transport(E checked) {
-    throw new TransportingException(checked);
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/base/ExceptionalFunctions.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/base/ExceptionalFunctions.java b/commons/src/main/java/org/apache/aurora/common/base/ExceptionalFunctions.java
deleted file mode 100644
index f06c66c..0000000
--- a/commons/src/main/java/org/apache/aurora/common/base/ExceptionalFunctions.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.base;
-
-import com.google.common.collect.ImmutableList;
-
-/**
- * Utility functions for working with exceptional functions.
- *
- * @author John Sirois
- */
-public final class ExceptionalFunctions {
-
-  private ExceptionalFunctions() {
-    // utility
-  }
-
-  /**
-   * Returns an {@link ExceptionalSupplier}/{@link java.util.concurrent.Callable} object that will
-   * return the result of {@code function} applied to {@code argument}.  Evaluation is lazy and
-   * un-memoized.
-   */
-  public static <S, T, E extends Exception> CallableExceptionalSupplier<T, E> curry(
-      final ExceptionalFunction<S, T, E> function, final S argument) {
-
-    return new CallableExceptionalSupplier<T, E>() {
-      @Override
-      public T get() throws E {
-        return function.apply(argument);
-      }
-    };
-  }
-
-  /**
-   * Returns an ExceptionalFunction that is a composition of multiple ExceptionalFunctions.
-   */
-  public static <T, E extends Exception> ExceptionalFunction<T, T, E> compose(
-      final Iterable<ExceptionalFunction<T, T, E>> functions) {
-    return new ExceptionalFunction<T, T, E>() {
-      @Override
-      public T apply(T input) throws E {
-        T result = input;
-        for (ExceptionalFunction<T, T, E> f : functions) {
-          result = f.apply(result);
-        }
-        return result;
-      }
-    };
-  }
-
-  /**
-   * Returns a List of ExceptionalFunctions from variable number of ExceptionalFunctions.
-   */
-  public static <T, E extends Exception> ExceptionalFunction<T, T, E> compose(
-      ExceptionalFunction<T, T, E> function, ExceptionalFunction<T, T, E>... functions) {
-    return compose(ImmutableList.<ExceptionalFunction<T, T, E>>builder()
-        .add(function)
-        .add(functions)
-        .build());
-  }
-
-  /**
-   * Returns a new ExceptionalFunction which composes two ExceptionalFunctions of compatible types.
-   *
-   * @param second function to apply to result of first.
-   * @param first function to apply to input item.
-   * @param <A> input type of first.
-   * @param <B> input type of second.
-   * @param <C> output type of second.
-   * @param <E> exception type.
-   * @return new composed ExceptionalFunction.
-   */
-  public static <A, B, C, E extends Exception> ExceptionalFunction<A, C, E> compose(
-      final ExceptionalFunction<B, C, ? extends E> second,
-      final ExceptionalFunction<A, ? extends B, ? extends E> first) {
-    return new ExceptionalFunction<A, C, E>() {
-      @Override
-      public C apply(A item) throws E {
-        return second.apply(first.apply(item));
-      }
-    };
-  }
-
-  /**
-   * Builds an ExceptionalFunction from {@link com.google.common.base.Function}.
-   *
-   * @param function guava Function.
-   * @param <S> input type.
-   * @param <T> output type.
-   * @param <E> exception type.
-   * @return new ExceptionalFunction.
-   */
-  public static <S, T, E extends Exception> ExceptionalFunction<S, T, E> forFunction(
-      final com.google.common.base.Function<S, T> function) {
-    return new ExceptionalFunction<S, T, E>() {
-      @Override
-      public T apply(S item) {
-        return function.apply(item);
-      }
-    };
-  }
-
-  /**
-   * Builds an ExceptionalFunction from a return value. The returned ExceptionalFunction will always
-   * return the given value.
-   *
-   * @param value value to return.
-   * @param <S> input type.
-   * @param <T> output type.
-   * @param <E> exception type.
-   * @return new ExceptionalFunction.
-   */
-  public static <S, T, E extends Exception> ExceptionalFunction<S, T, E> constant(
-      final T value) {
-    return new ExceptionalFunction<S, T, E>() {
-      @Override
-      public T apply(S item) throws E {
-        return value;
-      }
-    };
-  }
-
-  /**
-   * Builds an ExceptionalFunction from an Exception. The returned ExceptionalFunction will always
-   * throw the given Exception.
-   *
-   * @param exception exception to throw.
-   * @param <S> input type.
-   * @param <T> output type.
-   * @param <E> exception type.
-   * @return new ExceptionalFunction.
-   */
-  public static <S, T, E extends Exception> ExceptionalFunction<S, T, E> forException(
-      final E exception) {
-    return new ExceptionalFunction<S, T, E>() {
-      @Override
-      public T apply(S item) throws E {
-        throw exception;
-      }
-    };
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/base/SupplierE.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/base/SupplierE.java b/commons/src/main/java/org/apache/aurora/common/base/SupplierE.java
deleted file mode 100644
index ecad43e..0000000
--- a/commons/src/main/java/org/apache/aurora/common/base/SupplierE.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.base;
-
-/**
- * A convenience typedef for suppliers that throw multiple exception types.
- *
- * @param <T> The supplied type.
- *
- * @author John Sirois
- */
-public interface SupplierE<T> extends ExceptionalSupplier<T, Exception> {
-  // typedef
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/collections/Bits.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/collections/Bits.java b/commons/src/main/java/org/apache/aurora/common/collections/Bits.java
deleted file mode 100644
index f07e04a..0000000
--- a/commons/src/main/java/org/apache/aurora/common/collections/Bits.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.collections;
-
-import com.google.common.base.Preconditions;
-
-/**
- * Convenience class for doing bit-level operations on ints and longs.
- *
- * @author William Farner
- */
-public final class Bits {
-
-  private static final int LSB = 0;
-  private static final int INT_MSB = 31;
-  private static final int LONG_MSB = 63;
-
-  private Bits() {
-    // Utility.
-  }
-
-  /**
-   * Tests whether a bit is set in an int value.
-   *
-   * @param value The bit field to test.
-   * @param bit The index of the bit to test, where bit 0 is the LSB.
-   * @return {@code true} if the bit is set, {@code false} otherwise.
-   */
-  public static boolean isBitSet(int value, int bit) {
-    Preconditions.checkState(bit >= LSB);
-    Preconditions.checkState(bit <= INT_MSB);
-    int mask = 1 << bit;
-    return (value & mask) != 0;
-  }
-
-  /**
-   * Tests whether a bit is set in a long value.
-   *
-   * @param value The bit field to test.
-   * @param bit The index of the bit to test, where bit 0 is the LSB.
-   * @return {@code true} if the bit is set, {@code false} otherwise.
-   */
-  public static boolean isBitSet(long value, int bit) {
-    Preconditions.checkState(bit >= LSB);
-    Preconditions.checkState(bit <= LONG_MSB);
-    long mask = 1L << bit;
-    return (value & mask) != 0;
-  }
-
-  /**
-   * Sets a bit in an int value.
-   *
-   * @param value The bit field to modify.
-   * @param bit The index of the bit to set, where bit 0 is the LSB.
-   * @return The original value, with the indexed bit set.
-   */
-  public static int setBit(int value, int bit) {
-    Preconditions.checkState(bit >= LSB);
-    Preconditions.checkState(bit <= INT_MSB);
-    int mask = 1 << bit;
-    return value | mask;
-  }
-
-  /**
-   * Sets a bit in a long value.
-   *
-   * @param value The bit field to modify.
-   * @param bit The index of the bit to set, where bit 0 is the LSB.
-   * @return The original value, with the indexed bit set.
-   */
-  public static long setBit(long value, int bit) {
-    Preconditions.checkState(bit >= LSB);
-    Preconditions.checkState(bit <= LONG_MSB);
-    long mask = 1L << bit;
-    return value | mask;
-  }
-
-  /**
-   * Clears a bit in an int value.
-   *
-   * @param value The bit field to modify.
-   * @param bit The index of the bit to clear, where bit 0 is the LSB.
-   * @return The original value, with the indexed bit clear.
-   */
-  public static int clearBit(int value, int bit) {
-    Preconditions.checkState(bit >= LSB);
-    Preconditions.checkState(bit <= INT_MSB);
-    int mask = ~setBit(0, bit);
-    return value & mask;
-  }
-
-  /**
-   * Clears a bit in a long value.
-   *
-   * @param value The bit field to modify.
-   * @param bit The index of the bit to clear, where bit 0 is the LSB.
-   * @return The original value, with the indexed bit clear.
-   */
-  public static long clearBit(long value, int bit) {
-    Preconditions.checkState(bit >= LSB);
-    Preconditions.checkState(bit <= LONG_MSB);
-    long mask = ~setBit(0L, bit);
-    return value & mask;
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/common/webassets/bootstrap/BootstrapModule.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/common/webassets/bootstrap/BootstrapModule.java b/commons/src/main/java/org/apache/aurora/common/common/webassets/bootstrap/BootstrapModule.java
deleted file mode 100644
index 9cb6f54..0000000
--- a/commons/src/main/java/org/apache/aurora/common/common/webassets/bootstrap/BootstrapModule.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.common.webassets.bootstrap;
-
-import com.google.common.io.Resources;
-import com.google.common.net.MediaType;
-import com.google.inject.AbstractModule;
-
-import org.apache.aurora.common.application.http.Registration;
-
-/**
- * A binding module to register bootstrap HTTP assets.
- */
-public final class BootstrapModule extends AbstractModule {
-  /**
-   * Enum for available Bootstrap versions to choose from.
-   */
-  public enum BootstrapVersion {
-    VERSION_2_1_1 ("2.1.1"),
-    VERSION_2_3_2 ("2.3.2");
-
-    private final String version;
-
-    BootstrapVersion(String s) {
-      version = s;
-    }
-  }
-
-  private final String version;
-
-  /**
-   * Default constructor.
-   */
-  public BootstrapModule() {
-    this(BootstrapVersion.VERSION_2_1_1);
-  }
-
-  /**
-   * BootstrapModule Constructor.
-   *
-   * @param version supplies the bootstrap version to select.
-   */
-  public BootstrapModule(BootstrapVersion version) {
-    this.version = version.version;
-  }
-
-  private void register(String mountPath, String resourcePath, String contentType) {
-    Registration.registerHttpAsset(
-        binder(),
-        "/" + mountPath,
-        Resources.getResource(BootstrapModule.class, resourcePath),
-        contentType,
-        true);
-  }
-
-  @Override
-  protected void configure() {
-    register(
-        "css/bootstrap-responsive.min.css",
-        version + "/css/bootstrap-responsive.min.css",
-        MediaType.CSS_UTF_8.toString());
-    register(
-        "css/bootstrap.min.css",
-        version + "/css/bootstrap.min.css",
-        MediaType.CSS_UTF_8.toString());
-    register(
-        "img/glyphicons-halflings-white.png",
-        version + "/img/glyphicons-halflings-white.png",
-        MediaType.PNG.toString());
-    register(
-        "img/glyphicons-halflings.png",
-        version + "/img/glyphicons-halflings.png",
-        MediaType.PNG.toString());
-    register(
-        "js/bootstrap.min.js",
-        version + "/js/bootstrap.min.js",
-        MediaType.JAVASCRIPT_UTF_8.toString());
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/common/webassets/jquery/JQueryModule.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/common/webassets/jquery/JQueryModule.java b/commons/src/main/java/org/apache/aurora/common/common/webassets/jquery/JQueryModule.java
deleted file mode 100644
index a8e4524..0000000
--- a/commons/src/main/java/org/apache/aurora/common/common/webassets/jquery/JQueryModule.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.common.webassets.jquery;
-
-import com.google.common.io.Resources;
-import com.google.common.net.MediaType;
-import com.google.inject.AbstractModule;
-
-import org.apache.aurora.common.application.http.Registration;
-
-/**
- * A binding module to register jQuery HTTP assets.
- */
-public final class JQueryModule extends AbstractModule {
-
-  @Override
-  protected void configure() {
-    Registration.registerHttpAsset(
-        binder(),
-        "/js/jquery.min.js",
-        Resources.getResource(JQueryModule.class, "js/jquery-1.8.2.min.js"),
-        MediaType.JAVASCRIPT_UTF_8.toString(),
-        true);
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/inject/DefaultProvider.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/inject/DefaultProvider.java b/commons/src/main/java/org/apache/aurora/common/inject/DefaultProvider.java
deleted file mode 100644
index 38fbe4d..0000000
--- a/commons/src/main/java/org/apache/aurora/common/inject/DefaultProvider.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.inject;
-
-import com.google.common.base.Preconditions;
-import com.google.inject.AbstractModule;
-import com.google.inject.Binder;
-import com.google.inject.Inject;
-import com.google.inject.Injector;
-import com.google.inject.Key;
-import com.google.inject.Provider;
-import com.google.inject.TypeLiteral;
-import com.google.inject.name.Named;
-import com.google.inject.name.Names;
-
-/**
- * Provider that has a default value which can be overridden.
- *
- * The intended use of this class is:
- * <pre>
- * Default installer:
- *   bind(DefaultProvider.makeDefaultKey(Runnable.class, "mykey").toInstance(defaultRunnable);
- *   DefaultProvider.bindOrElse(Runnable.class, "mykey", binder());
- *
- * Custom override:
- *     bind(DefaultProvider.makeCustomKey(Runnable.class, "mykey")).toInstance(myCustomRunnable);
- *
- * Injection:
- *     {@literal Inject} Named("myKey") Runnable runnable;
- *
- * </pre>
- *
- * @param <T> the type of object this provides
- *
- * @author William Farner
- * @author John Sirois
- */
-public class DefaultProvider<T> implements Provider<T> {
-  private static final String DEFAULT_BINDING_KEY_SUFFIX = "_default";
-  private static final String CUSTOM_BINDING_KEY_SUFFIX = "_custom";
-
-  private final Key<T> defaultProviderKey;
-  private final Key<T> customProviderKey;
-
-  private Injector injector;
-
-  public DefaultProvider(Key<T> defaultProviderKey, Key<T> customProviderKey) {
-    this.defaultProviderKey = Preconditions.checkNotNull(defaultProviderKey);
-    this.customProviderKey = Preconditions.checkNotNull(customProviderKey);
-    Preconditions.checkArgument(!defaultProviderKey.equals(customProviderKey));
-  }
-
-  @Inject
-  public void setInjector(Injector injector) {
-    this.injector = injector;
-  }
-
-  @Override
-  public T get() {
-     Preconditions.checkNotNull(injector);
-     return injector.getBindings().containsKey(customProviderKey)
-         ? injector.getInstance(customProviderKey)
-         : injector.getInstance(defaultProviderKey);
-  }
-
-  /**
-   * Creates a DefaultProvider and installs a new module to {@code binder}, which will serve as
-   * an indirection layer for swapping the default binding with a custom one.
-   *
-   * @param customBinding The custom binding key.
-   * @param defaultBinding The default binding key.
-   * @param exposedBinding The exposed binding key.
-   * @param binder The binder to install bindings to.
-   * @param <T> The type of binding to make.
-   */
-  public static <T> void bindOrElse(final Key<T> customBinding, final Key<T> defaultBinding,
-      final Key<T> exposedBinding, Binder binder) {
-    Preconditions.checkNotNull(customBinding);
-    Preconditions.checkNotNull(defaultBinding);
-    Preconditions.checkNotNull(exposedBinding);
-    Preconditions.checkArgument(!customBinding.equals(defaultBinding)
-        && !customBinding.equals(exposedBinding));
-
-    binder.install(new AbstractModule() {
-      @Override protected void configure() {
-        Provider<T> defaultProvider = new DefaultProvider<T>(defaultBinding, customBinding);
-        requestInjection(defaultProvider);
-        bind(exposedBinding).toProvider(defaultProvider);
-      }
-    });
-  }
-
-  /**
-   * Convenience function for creating and installing a DefaultProvider.  This will use internal
-   * suffixes to create names for the custom and default bindings.  When bound this way, callers
-   * should use one of the functions such as {@link #makeDefaultBindingKey(String)} to set default
-   * and custom bindings.
-   *
-   * @param type The type of object to bind.
-   * @param exposedKey The exposed key.
-   * @param binder The binder to install to.
-   * @param <T> The type of binding to make.
-   */
-  public static <T> void bindOrElse(TypeLiteral<T> type, String exposedKey, Binder binder) {
-    bindOrElse(Key.get(type, Names.named(makeCustomBindingKey(exposedKey))),
-        Key.get(type, Names.named(makeDefaultBindingKey(exposedKey))),
-        Key.get(type, Names.named(exposedKey)),
-        binder);
-  }
-
-  /**
-   * Convenience method for calls to {@link #bindOrElse(TypeLiteral, String, Binder)}, that are not
-   * binding a parameterized type.
-   *
-   * @param type The class of the object to bind.
-   * @param exposedKey The exposed key.
-   * @param binder The binder to install to.
-   * @param <T> The type of binding to make.
-   */
-  public static <T> void bindOrElse(Class<T> type, String exposedKey, Binder binder) {
-    bindOrElse(TypeLiteral.get(type), exposedKey, binder);
-  }
-
-  public static String makeDefaultBindingKey(String rootKey) {
-    return rootKey + DEFAULT_BINDING_KEY_SUFFIX;
-  }
-
-  public static Named makeDefaultBindingName(String rootKey) {
-    return Names.named(makeDefaultBindingKey(rootKey));
-  }
-
-  public static <T> Key<T> makeDefaultKey(TypeLiteral<T> type, String rootKey) {
-    return Key.get(type, makeDefaultBindingName(rootKey));
-  }
-
-  public static <T> Key<T> makeDefaultKey(Class<T> type, String rootKey) {
-    return makeDefaultKey(TypeLiteral.get(type), rootKey);
-  }
-
-  public static String makeCustomBindingKey(String rootKey) {
-    return rootKey + CUSTOM_BINDING_KEY_SUFFIX;
-  }
-
-  public static Named makeCustomBindingName(String rootKey) {
-    return Names.named(makeCustomBindingKey(rootKey));
-  }
-
-  public static <T> Key<T> makeCustomKey(Class<T> type, String rootKey) {
-    return Key.get(type, makeCustomBindingName(rootKey));
-  }
-
-  public static <T> Key<T> makeCustomKey(TypeLiteral<T> type, String rootKey) {
-    return Key.get(type, makeCustomBindingName(rootKey));
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/inject/ProviderMethodModule.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/inject/ProviderMethodModule.java b/commons/src/main/java/org/apache/aurora/common/inject/ProviderMethodModule.java
deleted file mode 100644
index 7543ff1..0000000
--- a/commons/src/main/java/org/apache/aurora/common/inject/ProviderMethodModule.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.inject;
-
-import com.google.inject.AbstractModule;
-
-/**
- * A convenience base class for modules that do all their binding via provider methods.
- *
- * @author John Sirois
- */
-public abstract class ProviderMethodModule extends AbstractModule {
-
-  /**
-   * Does no binding; subclasses should implement provider methods.
-   */
-  @Override
-  protected final void configure() {
-    // noop
-  }
-}


[17/21] aurora git commit: Remove unused classes from commons fork.

Posted by wf...@apache.org.
http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/net/monitoring/TrafficMonitor.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/net/monitoring/TrafficMonitor.java b/commons/src/main/java/org/apache/aurora/common/net/monitoring/TrafficMonitor.java
deleted file mode 100644
index fba1e4b..0000000
--- a/commons/src/main/java/org/apache/aurora/common/net/monitoring/TrafficMonitor.java
+++ /dev/null
@@ -1,259 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net.monitoring;
-
-import java.util.Map;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ScheduledThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicLong;
-
-import javax.annotation.concurrent.GuardedBy;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Predicate;
-import com.google.common.cache.CacheBuilder;
-import com.google.common.cache.CacheLoader;
-import com.google.common.cache.LoadingCache;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Iterables;
-import com.google.common.util.concurrent.ThreadFactoryBuilder;
-
-import org.apache.aurora.common.base.MorePreconditions;
-import org.apache.aurora.common.net.loadbalancing.RequestTracker;
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-import org.apache.aurora.common.util.Clock;
-import org.apache.aurora.common.util.concurrent.ExecutorServiceShutdown;
-
-/**
- * Monitors activity on established connections between two hosts.  This can be used for a server
- * to track inbound clients, or for a client to track requests sent to different servers.
- *
- * The monitor will retain information for hosts that may no longer be active, but will expunge
- * information for hosts that have been idle for more than five minutes.
- *
- * @author William Farner
- */
-public class TrafficMonitor<K> implements ConnectionMonitor<K>, RequestTracker<K> {
-
-  @VisibleForTesting
-  static final Amount<Long, Time> DEFAULT_GC_INTERVAL = Amount.of(5L, Time.MINUTES);
-
-  @GuardedBy("this")
-  private final LoadingCache<K, TrafficInfo> trafficInfos;
-
-  private final String serviceName;
-  private final Amount<Long, Time> gcInterval;
-
-  private AtomicLong lifetimeRequests = new AtomicLong();
-  private final Clock clock;
-  private final ScheduledExecutorService gcExecutor;
-
-  /**
-   * Creates a new traffic monitor using the default cleanup interval.
-   *
-   * @param serviceName Name of the service to monitor, used for creating variable names.
-   */
-  public TrafficMonitor(final String serviceName) {
-    this(serviceName, DEFAULT_GC_INTERVAL);
-  }
-
-  /**
-   * Creates a new traffic monitor with a custom cleanup interval.
-   *
-   * @param serviceName Service name for the monitor.
-   * @param gcInterval Interval on which the remote host garbage collector should run.
-   */
-  public TrafficMonitor(final String serviceName, Amount<Long, Time> gcInterval) {
-    this(serviceName, gcInterval, Clock.SYSTEM_CLOCK);
-  }
-
-  /**
-   * Convenience method to create a typed traffic monitor.
-   *
-   * @param serviceName Service name for the monitor.
-   * @param <T> Monitor type.
-   * @return A new traffic monitor.
-   */
-  public static <T> TrafficMonitor<T> create(String serviceName) {
-    return new TrafficMonitor<T>(serviceName);
-  }
-
-  @VisibleForTesting
-  TrafficMonitor(final String serviceName, Clock clock) {
-    this(serviceName, DEFAULT_GC_INTERVAL, clock);
-  }
-
-  private TrafficMonitor(final String serviceName, Amount<Long, Time> gcInterval, Clock clock) {
-    this.serviceName = MorePreconditions.checkNotBlank(serviceName);
-    this.clock = Preconditions.checkNotNull(clock);
-    Preconditions.checkNotNull(gcInterval);
-    Preconditions.checkArgument(gcInterval.getValue() > 0, "GC interval must be > zero.");
-    this.gcInterval = gcInterval;
-
-    trafficInfos = CacheBuilder.newBuilder().build(new CacheLoader<K, TrafficInfo>() {
-      @Override public TrafficInfo load(K key) {
-        return new TrafficInfo(key);
-      }
-    });
-
-    Runnable gc = new Runnable() {
-        @Override public void run() { gc(); }
-    };
-
-    gcExecutor = new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder().setDaemon(true)
-        .setNameFormat("TrafficMonitor-gc-%d").build());
-    gcExecutor.scheduleAtFixedRate(gc, gcInterval.as(Time.SECONDS), gcInterval.as(Time.SECONDS),
-        TimeUnit.SECONDS);
-  }
-
-  /**
-   * Gets the name of the service that this monitor is monitoring.
-   *
-   * @return Monitor's service name.
-   */
-  public String getServiceName() {
-    return serviceName;
-  }
-
-  /**
-   * Gets the total number of requests that this monitor has observed, for all remote hosts.
-   *
-   * @return Total number of requests observed.
-   */
-  public long getLifetimeRequestCount() {
-    return lifetimeRequests.get();
-  }
-
-  /**
-   * Fetches all current traffic information.
-   *
-   * @return A map from the host key type to information about that host.
-   */
-  public synchronized Map<K, TrafficInfo> getTrafficInfo() {
-    return ImmutableMap.copyOf(trafficInfos.asMap());
-  }
-
-  @Override
-  public synchronized void connected(K key) {
-    Preconditions.checkNotNull(key);
-
-    trafficInfos.getUnchecked(key).incConnections();
-  }
-
-  @Override
-  public synchronized void released(K key) {
-    Preconditions.checkNotNull(key);
-
-    TrafficInfo info = trafficInfos.getUnchecked(key);
-
-    Preconditions.checkState(info.getConnectionCount() > 0, "Double release detected!");
-    info.decConnections();
-  }
-
-  @Override
-  public void requestResult(K key, RequestResult result, long requestTimeNanos) {
-    Preconditions.checkNotNull(key);
-
-    lifetimeRequests.incrementAndGet();
-    trafficInfos.getUnchecked(key).addResult(result);
-  }
-
-  @VisibleForTesting
-  synchronized void gc() {
-    Iterables.removeIf(trafficInfos.asMap().entrySet(),
-        new Predicate<Map.Entry<K, TrafficInfo>>() {
-          @Override public boolean apply(Map.Entry<K, TrafficInfo> clientInfo) {
-            if (clientInfo.getValue().connections.get() > 0) return false;
-
-            long idlePeriod = clock.nowNanos() - clientInfo.getValue().getLastActiveTimestamp();
-
-            return idlePeriod > gcInterval.as(Time.NANOSECONDS);
-          }
-        });
-  }
-
-  /**
-   * Shuts down TrafficMonitor by stopping background gc task.
-   */
-  public void shutdown() {
-    new ExecutorServiceShutdown(gcExecutor, Amount.of(0L, Time.SECONDS)).execute();
-  }
-
-  /**
-   * Information about traffic obsserved to/from a specific host.
-   */
-  public class TrafficInfo {
-    private final K key;
-    private AtomicInteger requestSuccesses = new AtomicInteger();
-    private AtomicInteger requestFailures = new AtomicInteger();
-    private AtomicInteger connections = new AtomicInteger();
-    private AtomicLong lastActive = new AtomicLong();
-
-    TrafficInfo(K key) {
-      this.key = key;
-      pulse();
-    }
-
-    void pulse() {
-      lastActive.set(clock.nowNanos());
-    }
-
-    public K getKey() {
-      return key;
-    }
-
-    void addResult(RequestResult result) {
-      pulse();
-      switch (result) {
-        case SUCCESS:
-          requestSuccesses.incrementAndGet();
-          break;
-        case FAILED:
-        case TIMEOUT:
-          requestFailures.incrementAndGet();
-          break;
-      }
-    }
-
-    public int getRequestSuccessCount() {
-      return requestSuccesses.get();
-    }
-
-    public int getRequestFailureCount() {
-      return requestFailures.get();
-    }
-
-    int incConnections() {
-      pulse();
-      return connections.incrementAndGet();
-    }
-
-    int decConnections() {
-      pulse();
-      return connections.decrementAndGet();
-    }
-
-    public int getConnectionCount() {
-      return connections.get();
-    }
-
-    public long getLastActiveTimestamp() {
-      return lastActive.get();
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/net/pool/ConnectionFactory.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/net/pool/ConnectionFactory.java b/commons/src/main/java/org/apache/aurora/common/net/pool/ConnectionFactory.java
deleted file mode 100644
index cdaaeab..0000000
--- a/commons/src/main/java/org/apache/aurora/common/net/pool/ConnectionFactory.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net.pool;
-
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-
-/**
- * A factory for connections that also dictates policy for the size of the connection population.
- *
- * <p>TODO(John Sirois): separate concerns - mixing in willCreate/null protocol is already tangling
- * implementation code
- *
- * @author John Sirois
- */
-public interface ConnectionFactory<S extends Connection<?, ?>> {
-
-  /**
-   * Checks whether this factory might create a connection if requested.
-   *
-   * @return {@code} true if this factory might create a connection at this point in time; ie
-   * a call to {@link #create} might not have returned {@code null}.  May return true to multiple
-   * threads if concurrently creating connections.
-   */
-  boolean mightCreate();
-
-  /**
-   * Attempts to create a new connection within the given timeout and subject to this factory's
-   * connection population size policy.
-   *
-   * @param timeout the maximum amount of time to wait
-   * @return a new connection or null if there are too many connections already
-   * @throws Exception if there was a problem creating the connection or establishing the connection
-   *     takes too long
-   */
-  S create(Amount<Long, Time> timeout) throws Exception;
-
-  /**
-   * Destroys a connection.  It is an error to attempt to destroy a connection this factory did
-   * not {@link #create}
-   *
-   * @param connection The connection to destroy.
-   */
-  void destroy(S connection);
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/net/pool/ConnectionPool.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/net/pool/ConnectionPool.java b/commons/src/main/java/org/apache/aurora/common/net/pool/ConnectionPool.java
deleted file mode 100644
index 316bf2b..0000000
--- a/commons/src/main/java/org/apache/aurora/common/net/pool/ConnectionPool.java
+++ /dev/null
@@ -1,334 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net.pool;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
-import com.google.common.util.concurrent.ThreadFactoryBuilder;
-import org.apache.aurora.common.base.Supplier;
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-import org.apache.aurora.common.stats.Stats;
-import org.apache.aurora.common.stats.StatsProvider;
-
-import java.util.Set;
-import java.util.concurrent.Executor;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.concurrent.locks.Condition;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * A generic connection pool that delegates growth policy to a {@link ConnectionFactory} and
- * connection choice to a supplied strategy.
- *
- * <p>TODO(John Sirois): implement a reaper to clean up connections that may become invalid when not in
- * use.
- *
- * <p> TODO(John Sirois): take a ShutdownRegistry and register a close command
- *
- * @author John Sirois
- */
-public final class ConnectionPool<S extends Connection<?, ?>> implements ObjectPool<S> {
-
-  private static final Logger LOG = Logger.getLogger(ConnectionPool.class.getName());
-
-  private final Set<S> leasedConnections =
-      Sets.newSetFromMap(Maps.<S, Boolean>newIdentityHashMap());
-  private final Set<S> availableConnections = Sets.newHashSet();
-  private final Lock poolLock;
-  private final Condition available;
-
-  private final ConnectionFactory<S> connectionFactory;
-  private final Executor executor;
-
-  private volatile boolean closed;
-  private final AtomicLong connectionsCreated;
-  private final AtomicLong connectionsDestroyed;
-  private final AtomicLong connectionsReturned;
-
-  /**
-   * Creates a connection pool with a connection picker that selects the first item in the set of
-   * available connections, exporting statistics to stats provider {@link Stats#STATS_PROVIDER}.
-   *
-   * @param connectionFactory Factory to create and destroy connections.
-   */
-  public ConnectionPool(ConnectionFactory<S> connectionFactory) {
-    this(connectionFactory, Stats.STATS_PROVIDER);
-  }
-
-  /**
-   * Creates a connection pool with a connection picker that selects the first item in the set of
-   * available connections and uses the supplied StatsProvider to register stats with.
-   *
-   * @param connectionFactory Factory to create and destroy connections.
-   * @param statsProvider Stats export provider.
-   */
-  public ConnectionPool(ConnectionFactory<S> connectionFactory, StatsProvider statsProvider) {
-    this(Executors.newCachedThreadPool(
-        new ThreadFactoryBuilder()
-            .setNameFormat("CP-" + connectionFactory + "[%d]")
-            .setDaemon(true)
-            .build()),
-        new ReentrantLock(true), connectionFactory, statsProvider);
-  }
-
-  @VisibleForTesting
-  ConnectionPool(Executor executor, Lock poolLock, ConnectionFactory<S> connectionFactory,
-      StatsProvider statsProvider) {
-    Preconditions.checkNotNull(executor);
-    Preconditions.checkNotNull(poolLock);
-    Preconditions.checkNotNull(connectionFactory);
-    Preconditions.checkNotNull(statsProvider);
-
-    this.executor = executor;
-    this.poolLock = poolLock;
-    available = poolLock.newCondition();
-    this.connectionFactory = connectionFactory;
-
-    String cfName = Stats.normalizeName(connectionFactory.toString());
-    statsProvider.makeGauge("cp_leased_connections_" + cfName,
-        new Supplier<Integer>() {
-      @Override public Integer get() {
-        return leasedConnections.size();
-      }
-    });
-    statsProvider.makeGauge("cp_available_connections_" + cfName,
-        new Supplier<Integer>() {
-          @Override public Integer get() {
-            return availableConnections.size();
-          }
-        });
-    this.connectionsCreated =
-        statsProvider.makeCounter("cp_created_connections_" + cfName);
-    this.connectionsDestroyed =
-        statsProvider.makeCounter("cp_destroyed_connections_" + cfName);
-    this.connectionsReturned =
-        statsProvider.makeCounter("cp_returned_connections_" + cfName);
-  }
-
-  @Override
-  public String toString() {
-    return "CP-" + connectionFactory;
-  }
-
-  @Override
-  public S get() throws ResourceExhaustedException, TimeoutException {
-    checkNotClosed();
-    poolLock.lock();
-    try {
-      return leaseConnection(NO_TIMEOUT);
-    } finally {
-      poolLock.unlock();
-    }
-  }
-
-  @Override
-  public S get(Amount<Long, Time> timeout)
-      throws ResourceExhaustedException, TimeoutException {
-
-    checkNotClosed();
-    Preconditions.checkNotNull(timeout);
-    if (timeout.getValue() == 0) {
-      return get();
-    }
-
-    try {
-      long start = System.nanoTime();
-      long timeBudgetNs = timeout.as(Time.NANOSECONDS);
-      if (poolLock.tryLock(timeBudgetNs, TimeUnit.NANOSECONDS)) {
-        try {
-          timeBudgetNs -= (System.nanoTime() - start);
-          return leaseConnection(Amount.of(timeBudgetNs, Time.NANOSECONDS));
-        } finally {
-          poolLock.unlock();
-        }
-      } else {
-        throw new TimeoutException("Timed out waiting for pool lock");
-      }
-    } catch (InterruptedException e) {
-      throw new TimeoutException("Interrupted waiting for pool lock");
-    }
-  }
-
-  private S leaseConnection(Amount<Long, Time> timeout) throws ResourceExhaustedException,
-      TimeoutException {
-    S connection = getConnection(timeout);
-    if (connection == null) {
-      throw new ResourceExhaustedException("Connection pool resources exhausted");
-    }
-    return leaseConnection(connection);
-  }
-
-  @Override
-  public void release(S connection) {
-    release(connection, false);
-  }
-
-  /**
-   * Equivalent to releasing a Connection with isValid() == false.
-   * @see ObjectPool#remove(Object)
-   */
-  @Override
-  public void remove(S connection) {
-    release(connection, true);
-  }
-
-  // TODO(John Sirois): release could block indefinitely if someone is blocked in get() on a create
-  // connection - reason about this and potentially submit release to our executor
-  private void release(S connection, boolean remove) {
-    poolLock.lock();
-    try {
-      if (!leasedConnections.remove(connection)) {
-        throw new IllegalArgumentException("Connection not controlled by this connection pool: "
-                                           + connection);
-      }
-
-      if (!closed && !remove && connection.isValid()) {
-        addConnection(connection);
-        connectionsReturned.incrementAndGet();
-      } else {
-        connectionFactory.destroy(connection);
-        connectionsDestroyed.incrementAndGet();
-      }
-    } finally {
-      poolLock.unlock();
-    }
-  }
-
-  @Override
-  public void close() {
-    poolLock.lock();
-    try {
-      for (S availableConnection : availableConnections) {
-        connectionFactory.destroy(availableConnection);
-      }
-    } finally {
-      closed = true;
-      poolLock.unlock();
-    }
-  }
-
-  private void checkNotClosed() {
-    Preconditions.checkState(!closed);
-  }
-
-  private S leaseConnection(S connection) {
-    leasedConnections.add(connection);
-    return connection;
-  }
-
-  // TODO(John Sirois): pool growth is serialized by poolLock currently - it seems like this could be
-  // fixed but there may be no need - do gedankanalysis
-  private S getConnection(final Amount<Long, Time> timeout) throws ResourceExhaustedException,
-      TimeoutException {
-    if (availableConnections.isEmpty()) {
-      if (leasedConnections.isEmpty()) {
-        // Completely empty pool
-        try {
-          return createConnection(timeout);
-        } catch (Exception e) {
-          throw new ResourceExhaustedException("failed to create a new connection", e);
-        }
-      } else {
-        // If the pool is allowed to grow - let the connection factory race a release
-        if (connectionFactory.mightCreate()) {
-          executor.execute(new Runnable() {
-            @Override public void run() {
-              try {
-                // The connection timeout is not needed here to honor the callers get requested
-                // timeout, but we don't want to have an infinite timeout which could exhaust a
-                // thread pool over many backgrounded create calls
-                S connection = createConnection(timeout);
-                if (connection != null) {
-                  addConnection(connection);
-                } else {
-                  LOG.log(Level.WARNING, "Failed to create a new connection for a waiting client " +
-                      "due to maximum pool size or timeout");
-                }
-              } catch (Exception e) {
-                LOG.log(Level.WARNING, "Failed to create a new connection for a waiting client", e);
-              }
-            }
-          });
-        }
-
-        try {
-          // We wait for a returned/new connection here in loops to guard against the
-          // "spurious wakeups" that are documented can occur with Condition.await()
-          if (timeout.getValue() == 0) {
-            while(availableConnections.isEmpty()) {
-              available.await();
-            }
-          } else {
-            long timeRemainingNs = timeout.as(Time.NANOSECONDS);
-            while(availableConnections.isEmpty()) {
-              long start = System.nanoTime();
-              if (!available.await(timeRemainingNs, TimeUnit.NANOSECONDS)) {
-                throw new TimeoutException(
-                    "timeout waiting for a connection to be released to the pool");
-              } else {
-                timeRemainingNs -= (System.nanoTime() - start);
-              }
-            }
-            if (availableConnections.isEmpty()) {
-              throw new TimeoutException(
-                  "timeout waiting for a connection to be released to the pool");
-            }
-          }
-        } catch (InterruptedException e) {
-          throw new TimeoutException("Interrupted while waiting for a connection.");
-        }
-      }
-    }
-
-    return getAvailableConnection();
-  }
-
-  private S getAvailableConnection() {
-    S connection = (availableConnections.size() == 1)
-        ? Iterables.getOnlyElement(availableConnections)
-        : availableConnections.iterator().next();
-    if (!availableConnections.remove(connection)) {
-      throw new IllegalArgumentException("Connection picked not in pool: " + connection);
-    }
-    return connection;
-  }
-
-  private S createConnection(Amount<Long, Time> timeout) throws Exception {
-    S connection = connectionFactory.create(timeout);
-    if (connection != null) {
-      connectionsCreated.incrementAndGet();
-    }
-    return connection;
-  }
-
-  private void addConnection(S connection) {
-    poolLock.lock();
-    try {
-      availableConnections.add(connection);
-      available.signal();
-    } finally {
-      poolLock.unlock();
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/net/pool/DynamicHostSetUtil.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/net/pool/DynamicHostSetUtil.java b/commons/src/main/java/org/apache/aurora/common/net/pool/DynamicHostSetUtil.java
deleted file mode 100644
index 4f75893..0000000
--- a/commons/src/main/java/org/apache/aurora/common/net/pool/DynamicHostSetUtil.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net.pool;
-
-import com.google.common.collect.ImmutableSet;
-
-import org.apache.aurora.common.base.Command;
-
-/**
- * Utility methods for dealing with dynamic sets of hosts.
- */
-public final class DynamicHostSetUtil {
-
-  /**
-   * Gets a snapshot of a set of dynamic hosts (e.g. a ServerSet) and returns a readable copy of
-   * the underlying actual endpoints.
-   *
-   * @param hostSet The hostSet to snapshot.
-   * @throws DynamicHostSet.MonitorException if there was a problem obtaining the snapshot.
-   */
-  public static <T> ImmutableSet<T> getSnapshot(DynamicHostSet<T> hostSet) throws DynamicHostSet.MonitorException {
-    final ImmutableSet.Builder<T> snapshot = ImmutableSet.builder();
-    Command unwatch = hostSet.watch(new DynamicHostSet.HostChangeMonitor<T>() {
-      @Override public void onChange(ImmutableSet<T> hostSet) {
-        snapshot.addAll(hostSet);
-      }
-    });
-    unwatch.execute();
-    return snapshot.build();
-  }
-
-  private DynamicHostSetUtil() {
-    // utility
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/net/pool/DynamicPool.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/net/pool/DynamicPool.java b/commons/src/main/java/org/apache/aurora/common/net/pool/DynamicPool.java
deleted file mode 100644
index 2fd6046..0000000
--- a/commons/src/main/java/org/apache/aurora/common/net/pool/DynamicPool.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net.pool;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Function;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Predicate;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
-import org.apache.aurora.common.base.Closure;
-import org.apache.aurora.common.net.loadbalancing.LoadBalancer;
-
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-import org.apache.aurora.common.zookeeper.ServerSet;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.TimeoutException;
-
-/**
- * An ObjectPool that maintains a set of connections for a set of service endpoints defined by a
- * {@link ServerSet}.
- *
- * @param <H> The type that contains metadata information about hosts, such as liveness and address.
- * @param <T> The raw connection type that is being pooled.
- * @param <E> The type that identifies the endpoint of the pool, such as an address.
- * @author John Sirois
- */
-public class DynamicPool<H, T, E> implements ObjectPool<Connection<T, E>> {
-
-  private final MetaPool<T, E> pool;
-
-  /**
-   * Creates a new ServerSetConnectionPool and blocks on an initial read and constructions of pools
-   * for the given {@code serverSet}.
-   *
-   * @param hostSet the dynamic set of available servers to pool connections for
-   * @param endpointPoolFactory a factory that can generate a connection pool for an endpoint
-   * @param loadBalancer Load balancer to manage request flow.
-   * @param onBackendsChosen A callback to notify of chosen backends.
-   * @param restoreInterval the interval after connection errors start occurring for a target to
-   *     begin checking to see if it has come back to a healthy state
-   * @param endpointExtractor Function that transforms a service instance into an endpoint instance.
-   * @param livenessChecker Filter that will determine whether a host indicates itself as available.
-   * @throws DynamicHostSet.MonitorException if there is a problem monitoring the host set
-   */
-  public DynamicPool(DynamicHostSet<H> hostSet,
-      Function<E, ObjectPool<Connection<T, E>>> endpointPoolFactory,
-      LoadBalancer<E> loadBalancer,
-      Closure<Collection<E>> onBackendsChosen,
-      Amount<Long, Time> restoreInterval,
-      Function<H, E> endpointExtractor,
-      Predicate<H> livenessChecker)
-      throws DynamicHostSet.MonitorException {
-    Preconditions.checkNotNull(hostSet);
-    Preconditions.checkNotNull(endpointPoolFactory);
-
-    pool = new MetaPool<T, E>(loadBalancer, onBackendsChosen, restoreInterval);
-
-    // TODO(John Sirois): consider an explicit start/stop
-    hostSet.monitor(new PoolMonitor<H, Connection<T, E>>(endpointPoolFactory, endpointExtractor,
-        livenessChecker) {
-      @Override protected void onPoolRebuilt(Set<ObjectPool<Connection<T, E>>> deadPools,
-          Map<E, ObjectPool<Connection<T, E>>> livePools) {
-        poolRebuilt(deadPools, livePools);
-      }
-    });
-  }
-
-  @VisibleForTesting
-  void poolRebuilt(Set<ObjectPool<Connection<T, E>>> deadPools,
-      Map<E, ObjectPool<Connection<T, E>>> livePools) {
-
-    pool.setBackends(livePools);
-
-    for (ObjectPool<Connection<T, E>> deadTargetPool : deadPools) {
-      deadTargetPool.close();
-    }
-  }
-
-  @Override
-  public Connection<T, E> get() throws ResourceExhaustedException, TimeoutException {
-    return pool.get();
-  }
-
-  @Override
-  public Connection<T, E> get(Amount<Long, Time> timeout)
-      throws ResourceExhaustedException, TimeoutException {
-    return pool.get(timeout);
-  }
-
-  @Override
-  public void release(Connection<T, E> connection) {
-    pool.release(connection);
-  }
-
-  @Override
-  public void remove(Connection<T, E> connection) {
-    pool.remove(connection);
-  }
-
-  @Override
-  public void close() {
-    pool.close();
-  }
-
-  private abstract class PoolMonitor<H, S extends Connection<?, ?>>
-      implements DynamicHostSet.HostChangeMonitor<H> {
-
-    private final Function<E, ObjectPool<S>> endpointPoolFactory;
-    private final Function<H, E> endpointExtractor;
-    private final Predicate<H> livenessTest;
-
-    public PoolMonitor(Function<E, ObjectPool<S>> endpointPoolFactory,
-        Function<H, E> endpointExtractor,
-        Predicate<H> livenessTest) {
-      this.endpointPoolFactory = endpointPoolFactory;
-      this.endpointExtractor = endpointExtractor;
-      this.livenessTest = livenessTest;
-    }
-
-    private final Map<E, ObjectPool<S>> endpointPools = Maps.newHashMap();
-
-    @Override
-    public synchronized void onChange(ImmutableSet<H> serverSet) {
-      // TODO(John Sirois): change onChange to pass the delta data since its already computed by
-      // ServerSet
-
-      Map<E, H> newEndpoints =
-          Maps.uniqueIndex(Iterables.filter(serverSet, livenessTest), endpointExtractor);
-
-      Set<E> deadEndpoints = ImmutableSet.copyOf(
-          Sets.difference(endpointPools.keySet(), newEndpoints.keySet()));
-      Set<ObjectPool<S>> deadPools = Sets.newHashSet();
-      for (E endpoint : deadEndpoints) {
-        ObjectPool<S> deadPool = endpointPools.remove(endpoint);
-        deadPools.add(deadPool);
-      }
-
-      Set<E> addedEndpoints = ImmutableSet.copyOf(
-          Sets.difference(newEndpoints.keySet(), endpointPools.keySet()));
-      for (E endpoint : addedEndpoints) {
-        ObjectPool<S> endpointPool = endpointPoolFactory.apply(endpoint);
-        endpointPools.put(endpoint, endpointPool);
-      }
-
-      onPoolRebuilt(deadPools, ImmutableMap.copyOf(endpointPools));
-    }
-
-    protected abstract void onPoolRebuilt(Set<ObjectPool<S>> deadPools,
-        Map<E, ObjectPool<S>> livePools);
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/net/pool/MetaPool.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/net/pool/MetaPool.java b/commons/src/main/java/org/apache/aurora/common/net/pool/MetaPool.java
deleted file mode 100644
index df1bd96..0000000
--- a/commons/src/main/java/org/apache/aurora/common/net/pool/MetaPool.java
+++ /dev/null
@@ -1,339 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net.pool;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeoutException;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReadWriteLock;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.util.concurrent.ThreadFactoryBuilder;
-
-import org.apache.aurora.common.base.Closure;
-import org.apache.aurora.common.base.Command;
-import org.apache.aurora.common.net.loadbalancing.LoadBalancer;
-import org.apache.aurora.common.net.loadbalancing.LoadBalancingStrategy.ConnectionResult;
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-
-/**
- * A connection pool that picks connections from a set of backend pools.  Backend pools are selected
- * from randomly initially but then as they are used they are ranked according to how many
- * connections they have available and whether or not the last used connection had an error or not.
- * In this way, backends that are responsive should get selected in preference to those that are
- * not.
- *
- * <p>Non-responsive backends are monitored after a configurable period in a background thread and
- * if a connection can be obtained they start to float back up in the rankings.  In this way,
- * backends that are initially non-responsive but later become responsive should end up getting
- * selected.
- *
- * <p> TODO(John Sirois): take a ShutdownRegistry and register a close command
- *
- * @author John Sirois
- */
-public class MetaPool<T, E> implements ObjectPool<Connection<T, E>> {
-
-  private final Command stopBackendRestorer;
-
-  private Map<E, ObjectPool<Connection<T, E>>> backends = null;
-
-  // Locks to guard mutation of the backends set.
-  private final Lock backendsReadLock;
-  private final Lock backendsWriteLock;
-
-  private final Closure<Collection<E>> onBackendsChosen;
-
-  private final LoadBalancer<E> loadBalancer;
-
-  /**
-   * Creates a connection pool with no backends.  Backends may be added post-creation by calling
-   * {@link #setBackends(java.util.Map)}
-   *
-   * @param loadBalancer the load balancer to distribute requests among backends.
-   * @param onBackendsChosen a callback to notify whenever the {@code loadBalancer} chooses a new
-   *     set of backends to restrict its call distribution to
-   * @param restoreInterval the interval after a backend goes dead to begin checking the backend to
-   *     see if it has come back to a healthy state
-   */
-  public MetaPool(LoadBalancer<E> loadBalancer,
-      Closure<Collection<E>> onBackendsChosen, Amount<Long, Time> restoreInterval) {
-    this(ImmutableMap.<E, ObjectPool<Connection<T, E>>>of(), loadBalancer,
-        onBackendsChosen, restoreInterval);
-  }
-
-  /**
-   * Creates a connection pool that balances connections across multiple backend pools.
-   *
-   * @param backends the connection pools for the backends
-   * @param onBackendsChosen a callback to notify whenever the {@code loadBalancer} chooses a new
-   *     set of backends to restrict its call distribution to
-   * @param loadBalancer the load balancer to distribute requests among backends.
-   * @param restoreInterval the interval after a backend goes dead to begin checking the backend to
-   *     see if it has come back to a healthy state
-   */
-  public MetaPool(
-      ImmutableMap<E, ObjectPool<Connection<T, E>>> backends,
-      LoadBalancer<E> loadBalancer,
-      Closure<Collection<E>> onBackendsChosen, Amount<Long, Time> restoreInterval) {
-
-    this.loadBalancer = Preconditions.checkNotNull(loadBalancer);
-    this.onBackendsChosen = Preconditions.checkNotNull(onBackendsChosen);
-
-    ReadWriteLock backendsLock = new ReentrantReadWriteLock(true);
-    backendsReadLock = backendsLock.readLock();
-    backendsWriteLock = backendsLock.writeLock();
-
-    setBackends(backends);
-
-    Preconditions.checkNotNull(restoreInterval);
-    Preconditions.checkArgument(restoreInterval.getValue() > 0);
-    stopBackendRestorer = startDeadBackendRestorer(restoreInterval);
-  }
-
-  /**
-   * Assigns the backend pools that this pool should draw from.
-   *
-   * @param pools New pools to use.
-   */
-  public void setBackends(Map<E, ObjectPool<Connection<T, E>>> pools) {
-    backendsWriteLock.lock();
-    try {
-      backends = Preconditions.checkNotNull(pools);
-      loadBalancer.offerBackends(pools.keySet(), onBackendsChosen);
-    } finally {
-      backendsWriteLock.unlock();
-    }
-  }
-
-  private Command startDeadBackendRestorer(final Amount<Long, Time> restoreInterval) {
-
-    final AtomicBoolean shouldRestore = new AtomicBoolean(true);
-    Runnable restoreDeadBackends = new Runnable() {
-      @Override public void run() {
-        if (shouldRestore.get()) {
-          restoreDeadBackends(restoreInterval);
-        }
-      }
-    };
-    final ScheduledExecutorService scheduledExecutorService =
-        Executors.newScheduledThreadPool(1,
-            new ThreadFactoryBuilder()
-                .setDaemon(true)
-                .setNameFormat("MTCP-DeadBackendRestorer[%s]")
-                .build());
-    long restoreDelay = restoreInterval.getValue();
-    scheduledExecutorService.scheduleWithFixedDelay(restoreDeadBackends, restoreDelay,
-        restoreDelay, restoreInterval.getUnit().getTimeUnit());
-
-    return new Command() {
-      @Override public void execute() {
-        shouldRestore.set(false);
-        scheduledExecutorService.shutdownNow();
-        LOG.info("Backend restorer shut down");
-      }
-    };
-  }
-
-  private static final Logger LOG = Logger.getLogger(MetaPool.class.getName());
-
-  private void restoreDeadBackends(Amount<Long, Time> restoreInterval) {
-    for (E backend : snapshotBackends()) {
-      ObjectPool<Connection<T, E>> pool;
-      backendsReadLock.lock();
-      try {
-        pool = backends.get(backend);
-      } finally {
-        backendsReadLock.unlock();
-      }
-
-      // We can lose a race if the backends change - and that's fine, we'll restore the new set of
-      // backends in the next scheduled restoration run.
-      if (pool != null) {
-        try {
-          release(get(backend, pool, restoreInterval));
-        } catch (TimeoutException e) {
-          LOG.warning("Backend restorer failed to revive backend: " + backend + " -> " + e);
-        } catch (ResourceExhaustedException e) {
-          LOG.warning("Backend restorer failed to revive backend: " + backend + " -> " + e);
-        }
-      }
-    }
-  }
-
-  private Iterable<E> snapshotBackends() {
-    backendsReadLock.lock();
-    try {
-      return ImmutableList.copyOf(backends.keySet());
-    } finally {
-      backendsReadLock.unlock();
-    }
-  }
-
-  @Override
-  public Connection<T, E> get() throws ResourceExhaustedException, TimeoutException {
-    return get(ObjectPool.NO_TIMEOUT);
-  }
-
-  @Override
-  public Connection<T, E> get(Amount<Long, Time> timeout)
-      throws ResourceExhaustedException, TimeoutException {
-
-    E backend;
-    ObjectPool<Connection<T, E>> pool;
-
-    backendsReadLock.lock();
-    try {
-      backend = loadBalancer.nextBackend();
-      Preconditions.checkNotNull(backend, "Load balancer gave a null backend.");
-
-      pool = backends.get(backend);
-      Preconditions.checkNotNull(backend,
-          "Given backend %s not found in tracked backends: %s", backend, backends);
-    } finally {
-      backendsReadLock.unlock();
-    }
-
-    return get(backend, pool, timeout);
-  }
-
-  private static class ManagedConnection<T, E> implements Connection<T, E> {
-    private final Connection<T, E> connection;
-    private final ObjectPool<Connection<T, E>> pool;
-
-    private ManagedConnection(Connection<T, E> connection, ObjectPool<Connection<T, E>> pool) {
-      this.connection = connection;
-      this.pool = pool;
-    }
-
-    @Override
-    public void close() {
-      connection.close();
-    }
-
-    @Override
-    public T get() {
-      return connection.get();
-    }
-
-    @Override
-    public boolean isValid() {
-      return connection.isValid();
-    }
-
-    @Override
-    public E getEndpoint() {
-      return connection.getEndpoint();
-    }
-
-    @Override public String toString() {
-      return "ManagedConnection[" + connection.toString() + "]";
-    }
-
-    void release(boolean remove) {
-      if (remove) {
-        pool.remove(connection);
-      } else {
-        pool.release(connection);
-      }
-    }
-  }
-
-  private Connection<T, E> get(E backend, ObjectPool<Connection<T, E>> pool,
-      Amount<Long, Time> timeout) throws ResourceExhaustedException, TimeoutException {
-
-    long startNanos = System.nanoTime();
-    try {
-      Connection<T, E> connection = (timeout.getValue() == 0) ? pool.get() : pool.get(timeout);
-
-      // BEWARE: We have leased a connection from the underlying pool here and must return it to the
-      // caller so they can later release it.  If we fail to do so, the connection will leak.
-      // Catching intermediate exceptions ourselves and pro-actively returning the connection to the
-      // pool before re-throwing is not a viable option since the return would have to succeed,
-      // forcing us to ignore the timeout passed in.
-
-      // NOTE: LoadBalancer gracefully ignores backends it does not know about so even if we acquire
-      // a (backend, pool) pair atomically that has since been removed, we can safely let the lb
-      // know about backend events and it will just ignore us.
-
-      try {
-        loadBalancer.connected(backend, System.nanoTime() - startNanos);
-      } catch (RuntimeException e) {
-        LOG.log(Level.WARNING, "Encountered an exception updating load balancer stats after "
-                               + "leasing a connection - continuing", e);
-      }
-      return new ManagedConnection<T, E>(connection, pool);
-    } catch (TimeoutException e) {
-      loadBalancer.connectFailed(backend, ConnectionResult.TIMEOUT);
-      throw e;
-    } catch (ResourceExhaustedException e) {
-      loadBalancer.connectFailed(backend, ConnectionResult.FAILED);
-      throw e;
-    }
-  }
-
-  @Override
-  public void release(Connection<T, E> connection) {
-    release(connection, false);
-  }
-
-  /**
-   * Equivalent to releasing a Connection with isValid() == false.
-   * @see ObjectPool#remove(Object)
-   */
-  @Override
-  public void remove(Connection<T, E> connection) {
-    release(connection, true);
-  }
-
-  private void release(Connection<T, E> connection, boolean remove) {
-    backendsWriteLock.lock();
-    try {
-
-      if (!(connection instanceof ManagedConnection)) {
-        throw new IllegalArgumentException("Connection not controlled by this connection pool: "
-                                           + connection);
-      }
-      ((ManagedConnection) connection).release(remove);
-
-      loadBalancer.released(connection.getEndpoint());
-    } finally {
-      backendsWriteLock.unlock();
-    }
-  }
-
-  @Override
-  public void close() {
-    stopBackendRestorer.execute();
-
-    backendsWriteLock.lock();
-    try {
-      for (ObjectPool<Connection<T, E>> backend : backends.values()) {
-        backend.close();
-      }
-    } finally {
-      backendsWriteLock.unlock();
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/net/pool/ObjectPool.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/net/pool/ObjectPool.java b/commons/src/main/java/org/apache/aurora/common/net/pool/ObjectPool.java
deleted file mode 100644
index a665903..0000000
--- a/commons/src/main/java/org/apache/aurora/common/net/pool/ObjectPool.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net.pool;
-
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-
-import java.util.concurrent.TimeoutException;
-
-/**
- * A generic object pool that provides object of a given type for exclusive use by the caller.
- * Object pools generally pool expensive resources and so offer a {@link #close} method that should
- * be used to free these resources when the pool is no longer needed.
- *
- * @author John Sirois
- */
-public interface ObjectPool<T> {
-
-  /**
-   * Gets a resource potentially blocking for as long as it takes to either create a new one or wait
-   * for one to be {@link #release(Object) released}.  Callers must {@link #release(Object) release}
-   * the connection when they are done with it.
-   *
-   * @return a resource for exclusive use by the caller
-   * @throws ResourceExhaustedException if no resource could be obtained because this pool was
-   *     exhausted
-   * @throws TimeoutException if we timed out while trying to fetch a resource
-   */
-  T get() throws ResourceExhaustedException, TimeoutException;
-
-  /**
-   * A convenience constant representing a no timeout.
-   */
-  Amount<Long,Time> NO_TIMEOUT = Amount.of(0L, Time.MILLISECONDS);
-
-  /**
-   * Gets a resource; timing out if there are none available and it takes longer than specified to
-   * create a new one or wait for one to be {@link #release(Object) released}.  Callers must
-   * {@link #release (Object) release} the connection when they are done with it.
-   *
-   * @param timeout the maximum amount of time to wait
-   * @return a resource for exclusive use by the caller
-   * @throws TimeoutException if the specified timeout was reached before a resource became
-   *     available
-   * @throws ResourceExhaustedException if no resource could be obtained because this pool was
-   *     exhausted
-   */
-  T get(Amount<Long, Time> timeout) throws ResourceExhaustedException, TimeoutException;
-
-  /**
-   * Releases a resource obtained from this pool back into the pool of available resources. It is an
-   * error to release a resource not obtained from this pool.
-   *
-   * @param resource Resource to release.
-   */
-  void release(T resource);
-
-  /**
-   * Removes a resource obtained from this pool from its available resources.  It is an error to
-   * remove a resource not obtained from this pool.
-   *
-   * @param resource Resource to remove.
-   */
-  void remove(T resource);
-
-  /**
-   * Disallows further gets from this pool, "closes" all idle objects and any outstanding objects
-   * when they are released.
-   */
-  void close();
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/net/pool/ResourceExhaustedException.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/net/pool/ResourceExhaustedException.java b/commons/src/main/java/org/apache/aurora/common/net/pool/ResourceExhaustedException.java
deleted file mode 100644
index fd48ddb..0000000
--- a/commons/src/main/java/org/apache/aurora/common/net/pool/ResourceExhaustedException.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net.pool;
-
-/**
- * @author John Sirois
- */
-public class ResourceExhaustedException extends Exception {
-  public ResourceExhaustedException(String message) {
-    super(message);
-  }
-
-  public ResourceExhaustedException(String message, Throwable cause) {
-    super(message, cause);
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/objectsize/ObjectSizeCalculator.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/objectsize/ObjectSizeCalculator.java b/commons/src/main/java/org/apache/aurora/common/objectsize/ObjectSizeCalculator.java
deleted file mode 100644
index 95c8868..0000000
--- a/commons/src/main/java/org/apache/aurora/common/objectsize/ObjectSizeCalculator.java
+++ /dev/null
@@ -1,427 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.objectsize;
-
-import java.lang.management.ManagementFactory;
-import java.lang.management.MemoryPoolMXBean;
-import java.lang.reflect.Array;
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.util.ArrayDeque;
-import java.util.Arrays;
-import java.util.Deque;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
-import com.google.common.cache.CacheBuilder;
-import com.google.common.cache.CacheLoader;
-import com.google.common.cache.LoadingCache;
-import com.google.common.collect.Sets;
-
-/**
- * Contains utility methods for calculating the memory usage of objects. It
- * only works on the HotSpot JVM, and infers the actual memory layout (32 bit
- * vs. 64 bit word size, compressed object pointers vs. uncompressed) from
- * best available indicators. It can reliably detect a 32 bit vs. 64 bit JVM.
- * It can only make an educated guess at whether compressed OOPs are used,
- * though; specifically, it knows what the JVM's default choice of OOP
- * compression would be based on HotSpot version and maximum heap sizes, but if
- * the choice is explicitly overridden with the <tt>-XX:{+|-}UseCompressedOops</tt> command line
- * switch, it can not detect
- * this fact and will report incorrect sizes, as it will presume the default JVM
- * behavior.
- *
- * @author Attila Szegedi
- */
-public class ObjectSizeCalculator {
-
-  /**
-   * Describes constant memory overheads for various constructs in a JVM implementation.
-   */
-  public interface MemoryLayoutSpecification {
-
-    /**
-     * Returns the fixed overhead of an array of any type or length in this JVM.
-     *
-     * @return the fixed overhead of an array.
-     */
-    int getArrayHeaderSize();
-
-    /**
-     * Returns the fixed overhead of for any {@link Object} subclass in this JVM.
-     *
-     * @return the fixed overhead of any object.
-     */
-    int getObjectHeaderSize();
-
-    /**
-     * Returns the quantum field size for a field owned by an object in this JVM.
-     *
-     * @return the quantum field size for an object.
-     */
-    int getObjectPadding();
-
-    /**
-     * Returns the fixed size of an object reference in this JVM.
-     *
-     * @return the size of all object references.
-     */
-    int getReferenceSize();
-
-    /**
-     * Returns the quantum field size for a field owned by one of an object's ancestor superclasses
-     * in this JVM.
-     *
-     * @return the quantum field size for a superclass field.
-     */
-    int getSuperclassFieldPadding();
-  }
-
-  private static class CurrentLayout {
-    private static final MemoryLayoutSpecification SPEC =
-        getEffectiveMemoryLayoutSpecification();
-  }
-
-  /**
-   * Given an object, returns the total allocated size, in bytes, of the object
-   * and all other objects reachable from it.  Attempts to to detect the current JVM memory layout,
-   * but may fail with {@link UnsupportedOperationException};
-   *
-   * @param obj the object; can be null. Passing in a {@link java.lang.Class} object doesn't do
-   *          anything special, it measures the size of all objects
-   *          reachable through it (which will include its class loader, and by
-   *          extension, all other Class objects loaded by
-   *          the same loader, and all the parent class loaders). It doesn't provide the
-   *          size of the static fields in the JVM class that the Class object
-   *          represents.
-   * @return the total allocated size of the object and all other objects it
-   *         retains.
-   * @throws UnsupportedOperationException if the current vm memory layout cannot be detected.
-   */
-  public static long getObjectSize(Object obj) throws UnsupportedOperationException {
-    return obj == null ? 0 : new ObjectSizeCalculator(CurrentLayout.SPEC).calculateObjectSize(obj);
-  }
-
-  // Fixed object header size for arrays.
-  private final int arrayHeaderSize;
-  // Fixed object header size for non-array objects.
-  private final int objectHeaderSize;
-  // Padding for the object size - if the object size is not an exact multiple
-  // of this, it is padded to the next multiple.
-  private final int objectPadding;
-  // Size of reference (pointer) fields.
-  private final int referenceSize;
-  // Padding for the fields of superclass before fields of subclasses are
-  // added.
-  private final int superclassFieldPadding;
-
-  private final LoadingCache<Class<?>, ClassSizeInfo> classSizeInfos =
-      CacheBuilder.newBuilder().build(new CacheLoader<Class<?>, ClassSizeInfo>() {
-        public ClassSizeInfo load(Class<?> clazz) {
-          return new ClassSizeInfo(clazz);
-        }
-      });
-
-
-  private final Set<Object> alreadyVisited = Sets.newIdentityHashSet();
-  private final Deque<Object> pending = new ArrayDeque<Object>(16 * 1024);
-  private long size;
-
-  /**
-   * Creates an object size calculator that can calculate object sizes for a given
-   * {@code memoryLayoutSpecification}.
-   *
-   * @param memoryLayoutSpecification a description of the JVM memory layout.
-   */
-  public ObjectSizeCalculator(MemoryLayoutSpecification memoryLayoutSpecification) {
-    Preconditions.checkNotNull(memoryLayoutSpecification);
-    arrayHeaderSize = memoryLayoutSpecification.getArrayHeaderSize();
-    objectHeaderSize = memoryLayoutSpecification.getObjectHeaderSize();
-    objectPadding = memoryLayoutSpecification.getObjectPadding();
-    referenceSize = memoryLayoutSpecification.getReferenceSize();
-    superclassFieldPadding = memoryLayoutSpecification.getSuperclassFieldPadding();
-  }
-
-  /**
-   * Given an object, returns the total allocated size, in bytes, of the object
-   * and all other objects reachable from it.
-   *
-   * @param obj the object; can be null. Passing in a {@link java.lang.Class} object doesn't do
-   *          anything special, it measures the size of all objects
-   *          reachable through it (which will include its class loader, and by
-   *          extension, all other Class objects loaded by
-   *          the same loader, and all the parent class loaders). It doesn't provide the
-   *          size of the static fields in the JVM class that the Class object
-   *          represents.
-   * @return the total allocated size of the object and all other objects it
-   *         retains.
-   */
-  public synchronized long calculateObjectSize(Object obj) {
-    // Breadth-first traversal instead of naive depth-first with recursive
-    // implementation, so we don't blow the stack traversing long linked lists.
-    try {
-      for (;;) {
-        visit(obj);
-        if (pending.isEmpty()) {
-          return size;
-        }
-        obj = pending.removeFirst();
-      }
-    } finally {
-      alreadyVisited.clear();
-      pending.clear();
-      size = 0;
-    }
-  }
-
-  private void visit(Object obj) {
-    if (alreadyVisited.contains(obj)) {
-      return;
-    }
-    final Class<?> clazz = obj.getClass();
-    if (clazz == ArrayElementsVisitor.class) {
-      ((ArrayElementsVisitor) obj).visit(this);
-    } else {
-      alreadyVisited.add(obj);
-      if (clazz.isArray()) {
-        visitArray(obj);
-      } else {
-        classSizeInfos.getUnchecked(clazz).visit(obj, this);
-      }
-    }
-  }
-
-  private void visitArray(Object array) {
-    final Class<?> componentType = array.getClass().getComponentType();
-    final int length = Array.getLength(array);
-    if (componentType.isPrimitive()) {
-      increaseByArraySize(length, getPrimitiveFieldSize(componentType));
-    } else {
-      increaseByArraySize(length, referenceSize);
-      // If we didn't use an ArrayElementsVisitor, we would be enqueueing every
-      // element of the array here instead. For large arrays, it would
-      // tremendously enlarge the queue. In essence, we're compressing it into
-      // a small command object instead. This is different than immediately
-      // visiting the elements, as their visiting is scheduled for the end of
-      // the current queue.
-      switch (length) {
-        case 0: {
-          break;
-        }
-        case 1: {
-          enqueue(Array.get(array, 0));
-          break;
-        }
-        default: {
-          enqueue(new ArrayElementsVisitor((Object[]) array));
-        }
-      }
-    }
-  }
-
-  private void increaseByArraySize(int length, long elementSize) {
-    increaseSize(roundTo(arrayHeaderSize + length * elementSize, objectPadding));
-  }
-
-  private static class ArrayElementsVisitor {
-    private final Object[] array;
-
-    ArrayElementsVisitor(Object[] array) {
-      this.array = array;
-    }
-
-    public void visit(ObjectSizeCalculator calc) {
-      for (Object elem : array) {
-        if (elem != null) {
-          calc.visit(elem);
-        }
-      }
-    }
-  }
-
-  void enqueue(Object obj) {
-    if (obj != null) {
-      pending.addLast(obj);
-    }
-  }
-
-  void increaseSize(long objectSize) {
-    size += objectSize;
-  }
-
-  @VisibleForTesting
-  static long roundTo(long x, int multiple) {
-    return ((x + multiple - 1) / multiple) * multiple;
-  }
-
-  private class ClassSizeInfo {
-    // Padded fields + header size
-    private final long objectSize;
-    // Only the fields size - used to calculate the subclasses' memory
-    // footprint.
-    private final long fieldsSize;
-    private final Field[] referenceFields;
-
-    public ClassSizeInfo(Class<?> clazz) {
-      long fieldsSize = 0;
-      final List<Field> referenceFields = new LinkedList<Field>();
-      for (Field f : clazz.getDeclaredFields()) {
-        if (Modifier.isStatic(f.getModifiers())) {
-          continue;
-        }
-        final Class<?> type = f.getType();
-        if (type.isPrimitive()) {
-          fieldsSize += getPrimitiveFieldSize(type);
-        } else {
-          f.setAccessible(true);
-          referenceFields.add(f);
-          fieldsSize += referenceSize;
-        }
-      }
-      final Class<?> superClass = clazz.getSuperclass();
-      if (superClass != null) {
-        final ClassSizeInfo superClassInfo = classSizeInfos.getUnchecked(superClass);
-        fieldsSize += roundTo(superClassInfo.fieldsSize, superclassFieldPadding);
-        referenceFields.addAll(Arrays.asList(superClassInfo.referenceFields));
-      }
-      this.fieldsSize = fieldsSize;
-      this.objectSize = roundTo(objectHeaderSize + fieldsSize, objectPadding);
-      this.referenceFields = referenceFields.toArray(
-          new Field[referenceFields.size()]);
-    }
-
-    void visit(Object obj, ObjectSizeCalculator calc) {
-      calc.increaseSize(objectSize);
-      enqueueReferencedObjects(obj, calc);
-    }
-
-    public void enqueueReferencedObjects(Object obj, ObjectSizeCalculator calc) {
-      for (Field f : referenceFields) {
-        try {
-          calc.enqueue(f.get(obj));
-        } catch (IllegalAccessException e) {
-          final AssertionError ae = new AssertionError(
-              "Unexpected denial of access to " + f);
-          ae.initCause(e);
-          throw ae;
-        }
-      }
-    }
-  }
-
-  private static long getPrimitiveFieldSize(Class<?> type) {
-    if (type == boolean.class || type == byte.class) {
-      return 1;
-    }
-    if (type == char.class || type == short.class) {
-      return 2;
-    }
-    if (type == int.class || type == float.class) {
-      return 4;
-    }
-    if (type == long.class || type == double.class) {
-      return 8;
-    }
-    throw new AssertionError("Encountered unexpected primitive type " +
-        type.getName());
-  }
-
-  @VisibleForTesting
-  static MemoryLayoutSpecification getEffectiveMemoryLayoutSpecification() {
-    final String vmName = System.getProperty("java.vm.name");
-    if (vmName == null || !(vmName.startsWith("Java HotSpot(TM) ")
-        || vmName.startsWith("OpenJDK") || vmName.startsWith("TwitterJDK"))) {
-      throw new UnsupportedOperationException(
-          "ObjectSizeCalculator only supported on HotSpot VM");
-    }
-
-    final String dataModel = System.getProperty("sun.arch.data.model");
-    if ("32".equals(dataModel)) {
-      // Running with 32-bit data model
-      return new MemoryLayoutSpecification() {
-        @Override public int getArrayHeaderSize() {
-          return 12;
-        }
-        @Override public int getObjectHeaderSize() {
-          return 8;
-        }
-        @Override public int getObjectPadding() {
-          return 8;
-        }
-        @Override public int getReferenceSize() {
-          return 4;
-        }
-        @Override public int getSuperclassFieldPadding() {
-          return 4;
-        }
-      };
-    } else if (!"64".equals(dataModel)) {
-      throw new UnsupportedOperationException("Unrecognized value '" +
-          dataModel + "' of sun.arch.data.model system property");
-    }
-
-    final String strVmVersion = System.getProperty("java.vm.version");
-    final int vmVersion = Integer.parseInt(strVmVersion.substring(0,
-        strVmVersion.indexOf('.')));
-    if (vmVersion >= 17) {
-      long maxMemory = 0;
-      for (MemoryPoolMXBean mp : ManagementFactory.getMemoryPoolMXBeans()) {
-        maxMemory += mp.getUsage().getMax();
-      }
-      if (maxMemory < 30L * 1024 * 1024 * 1024) {
-        // HotSpot 17.0 and above use compressed OOPs below 30GB of RAM total
-        // for all memory pools (yes, including code cache).
-        return new MemoryLayoutSpecification() {
-          @Override public int getArrayHeaderSize() {
-            return 16;
-          }
-          @Override public int getObjectHeaderSize() {
-            return 12;
-          }
-          @Override public int getObjectPadding() {
-            return 8;
-          }
-          @Override public int getReferenceSize() {
-            return 4;
-          }
-          @Override public int getSuperclassFieldPadding() {
-            return 4;
-          }
-        };
-      }
-    }
-
-    // In other cases, it's a 64-bit uncompressed OOPs object model
-    return new MemoryLayoutSpecification() {
-      @Override public int getArrayHeaderSize() {
-        return 24;
-      }
-      @Override public int getObjectHeaderSize() {
-        return 16;
-      }
-      @Override public int getObjectPadding() {
-        return 8;
-      }
-      @Override public int getReferenceSize() {
-        return 8;
-      }
-      @Override public int getSuperclassFieldPadding() {
-        return 8;
-      }
-    };
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/stats/ApproximateHistogram.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/stats/ApproximateHistogram.java b/commons/src/main/java/org/apache/aurora/common/stats/ApproximateHistogram.java
deleted file mode 100644
index cfbf04e..0000000
--- a/commons/src/main/java/org/apache/aurora/common/stats/ApproximateHistogram.java
+++ /dev/null
@@ -1,563 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.stats;
-
-import java.util.Arrays;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
-
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Data;
-
-/**
- * <p>
- * Implements Histogram structure for computing approximate quantiles.
- * The implementation is based on the following paper:
- *
- * <pre>
- * [MP80]  Munro & Paterson, "Selection and Sorting with Limited Storage",
- *         Theoretical Computer Science, Vol 12, p 315-323, 1980.
- * </pre>
- * </p>
- * <p>
- * You could read a detailed description of the same algorithm here:
- *
- * <pre>
- * [MRL98] Manku, Rajagopalan & Lindsay, "Approximate Medians and other
- *         Quantiles in One Pass and with Limited Memory", Proc. 1998 ACM
- *         SIGMOD, Vol 27, No 2, p 426-435, June 1998.
- * </pre>
- * </p>
- * <p>
- * There's a good explanation of the algorithm in the Sawzall source code
- * See: http://szl.googlecode.com/svn-history/r36/trunk/src/emitters/szlquantile.cc
- * </p>
- * Here's a schema of the tree:
- * <pre>
- *      [4]     level 3, weight=rootWeight=8
- *       |
- *      [3]     level 2, weight=4
- *       |
- *      [2]     level 1, weight=2
- *     /   \
- *   [0]   [1]  level 0, weight=1
- * </pre>
- * <p>
- * {@code [i]} represents {@code buffer[i]}
- * The depth of the tree is limited to a maximum value
- * Every buffer has the same size
- * </p>
- * <p>
- * We add element in {@code [0]} or {@code [1]}.
- * When {@code [0]} and {@code [1]} are full, we collapse them, it generates a temporary buffer
- * of weight 2, if {@code [2]} is empty, we put the collapsed buffer into {@code [2]} otherwise
- * we collapse {@code [2]} with the temporary buffer and put it in {@code [3]} if it's empty and
- * so on...
- * </p>
- */
-public final class ApproximateHistogram implements Histogram {
-  @VisibleForTesting
-  public static final Precision DEFAULT_PRECISION = new Precision(0.02, 100 * 1000);
-  @VisibleForTesting
-  public static final Amount<Long, Data> DEFAULT_MAX_MEMORY = Amount.of(12L, Data.KB);
-  @VisibleForTesting static final long ELEM_SIZE = 8; // sizeof long
-
-  // See above
-  @VisibleForTesting long[][] buffer;
-  @VisibleForTesting long count = 0L;
-  @VisibleForTesting int leafCount = 0; // number of elements in the bottom two leaves
-  @VisibleForTesting int currentTop = 1;
-  @VisibleForTesting int[] indices; // member for optimization reason
-  private boolean leavesSorted = true;
-  private int rootWeight = 1;
-  private long[][] bufferPool; // pool of 2 buffers (used for merging)
-  private int bufferSize;
-  private int maxDepth;
-
-  /**
-   * Private init method that is called only by constructors.
-   * All allocations are done in this method.
-   *
-   * @param bufSize size of each buffer
-   * @param depth maximum depth of the tree of buffers
-   */
-  @VisibleForTesting
-  void init(int bufSize, int depth) {
-    bufferSize = bufSize;
-    maxDepth = depth;
-    bufferPool = new long[2][bufferSize];
-    indices = new int[depth + 1];
-    buffer = new long[depth + 1][bufferSize];
-    // only allocate the first 2 buffers, lazily allocate the others.
-    allocate(0);
-    allocate(1);
-    Arrays.fill(buffer, 2, buffer.length, null);
-    clear();
-  }
-
-  @VisibleForTesting
-  ApproximateHistogram(int bufSize, int depth) {
-    init(bufSize, depth);
-  }
-
-  /**
-   * Constructor with precision constraint, it will allocated as much memory as require to match
-   * this precision constraint.
-   * @param precision the requested precision
-   */
-  public ApproximateHistogram(Precision precision) {
-    Preconditions.checkNotNull(precision);
-    int depth = computeDepth(precision.getEpsilon(), precision.getN());
-    int bufSize = computeBufferSize(depth, precision.getN());
-    init(bufSize, depth);
-  }
-
-  /**
-   * Constructor with memory constraint, it will find the best possible precision that satisfied
-   * the memory constraint.
-   * @param maxMemory the maximum amount of memory that the instance will take
-   */
-  public ApproximateHistogram(Amount<Long, Data> maxMemory, int expectedSize) {
-    Preconditions.checkNotNull(maxMemory);
-    Preconditions.checkArgument(1024 <= maxMemory.as(Data.BYTES),
-        "at least 1KB is required for an Histogram");
-
-    double epsilon = DEFAULT_PRECISION.getEpsilon();
-    int n = expectedSize;
-    int depth = computeDepth(epsilon, n);
-    int bufSize = computeBufferSize(depth, n);
-    long maxBytes = maxMemory.as(Data.BYTES);
-
-    // Increase precision if the maxMemory allow it, otherwise reduce precision. (by 5% steps)
-    boolean tooMuchMem = memoryUsage(bufSize, depth) > maxBytes;
-    double multiplier = tooMuchMem ? 1.05 : 0.95;
-    while((maxBytes < memoryUsage(bufSize, depth)) == tooMuchMem) {
-      epsilon *= multiplier;
-      if (epsilon < 0.00001) {
-        // for very high memory constraint increase N as well
-        n *= 10;
-        epsilon = DEFAULT_PRECISION.getEpsilon();
-      }
-      depth = computeDepth(epsilon, n);
-      bufSize = computeBufferSize(depth, n);
-    }
-    if (!tooMuchMem) {
-      // It's ok to consume less memory than the constraint
-      // but we never have to consume more!
-      depth = computeDepth(epsilon / multiplier, n);
-      bufSize = computeBufferSize(depth, n);
-    }
-
-    init(bufSize, depth);
-  }
-
-  /**
-   * Constructor with memory constraint.
-   * @see #ApproximateHistogram(Amount, int)
-   */
-  public ApproximateHistogram(Amount<Long, Data> maxMemory) {
-    this(maxMemory, DEFAULT_PRECISION.getN());
-  }
-
-  /**
-   * Default Constructor.
-   * @see #ApproximateHistogram(Amount)
-   */
-  public ApproximateHistogram() {
-    this(DEFAULT_MAX_MEMORY);
-  }
-
-  @Override
-  public synchronized void add(long x) {
-    // if the leaves of the tree are full, "collapse" recursively the tree
-    if (leafCount == 2 * bufferSize) {
-      Arrays.sort(buffer[0]);
-      Arrays.sort(buffer[1]);
-      recCollapse(buffer[0], 1);
-      leafCount = 0;
-    }
-
-    // Now we're sure there is space for adding x
-    if (leafCount < bufferSize) {
-      buffer[0][leafCount] = x;
-    } else {
-      buffer[1][leafCount - bufferSize] = x;
-    }
-    leafCount++;
-    count++;
-    leavesSorted = (leafCount == 1);
-  }
-
-  @Override
-  public synchronized long getQuantile(double q) {
-    Preconditions.checkArgument(0.0 <= q && q <= 1.0,
-        "quantile must be in the range 0.0 to 1.0 inclusive");
-    if (count == 0) {
-      return 0L;
-    }
-
-    // the two leaves are the only buffer that can be partially filled
-    int buf0Size = Math.min(bufferSize, leafCount);
-    int buf1Size = Math.max(0, leafCount - buf0Size);
-    long sum = 0;
-    long target = (long) Math.ceil(count * (1.0 - q));
-    int i;
-
-    if (! leavesSorted) {
-      Arrays.sort(buffer[0], 0, buf0Size);
-      Arrays.sort(buffer[1], 0, buf1Size);
-      leavesSorted = true;
-    }
-    Arrays.fill(indices, bufferSize - 1);
-    indices[0] = buf0Size - 1;
-    indices[1] = buf1Size - 1;
-
-    do {
-      i = biggest(indices);
-      indices[i]--;
-      sum += weight(i);
-    } while (sum < target);
-    return buffer[i][indices[i] + 1];
-  }
-
-  @Override
-  public synchronized long[] getQuantiles(double[] quantiles) {
-    return Histograms.extractQuantiles(this, quantiles);
-  }
-
-  @Override
-  public synchronized void clear() {
-    count = 0L;
-    leafCount = 0;
-    currentTop = 1;
-    rootWeight = 1;
-    leavesSorted = true;
-  }
-
-  /**
-   * MergedHistogram is a Wrapper on top of multiple histograms, it gives a view of all the
-   * underlying histograms as it was just one.
-   * Note: Should only be used for querying the underlying histograms.
-   */
-  private static class MergedHistogram implements Histogram {
-    private final ApproximateHistogram[] histograms;
-
-    private MergedHistogram(ApproximateHistogram[] histograms) {
-      this.histograms = histograms;
-    }
-
-    @Override
-    public void add(long x) {
-      /* Ignore, Shouldn't be used */
-      assert(false);
-    }
-
-    @Override
-    public void clear() {
-      /* Ignore, Shouldn't be used */
-      assert(false);
-    }
-
-    @Override
-    public long getQuantile(double quantile) {
-      Preconditions.checkArgument(0.0 <= quantile && quantile <= 1.0,
-          "quantile must be in the range 0.0 to 1.0 inclusive");
-
-      long count = initIndices();
-      if (count == 0) {
-        return 0L;
-      }
-
-      long sum = 0;
-      long target = (long) Math.ceil(count * (1.0 - quantile));
-      int iHist = -1;
-      int iBiggest = -1;
-      do {
-        long biggest = Long.MIN_VALUE;
-        for (int i = 0; i < histograms.length; i++) {
-          ApproximateHistogram hist = histograms[i];
-          int indexBiggest = hist.biggest(hist.indices);
-          if (indexBiggest >= 0) {
-            long value = hist.buffer[indexBiggest][hist.indices[indexBiggest]];
-            if (iBiggest == -1 || biggest <= value) {
-              iBiggest = indexBiggest;
-              biggest = value;
-              iHist = i;
-            }
-          }
-        }
-        histograms[iHist].indices[iBiggest]--;
-        sum += histograms[iHist].weight(iBiggest);
-      } while (sum < target);
-
-      ApproximateHistogram hist = histograms[iHist];
-      int i = hist.indices[iBiggest];
-      return hist.buffer[iBiggest][i + 1];
-    }
-
-    @Override
-    public synchronized long[] getQuantiles(double[] quantiles) {
-      return Histograms.extractQuantiles(this, quantiles);
-    }
-
-    /**
-     * Initialize the indices array for each Histogram and return the global count.
-     */
-    private long initIndices() {
-      long count = 0L;
-      for (int i = 0; i < histograms.length; i++) {
-        ApproximateHistogram h = histograms[i];
-        int[] indices = h.indices;
-        count += h.count;
-        int buf0Size = Math.min(h.bufferSize, h.leafCount);
-        int buf1Size = Math.max(0, h.leafCount - buf0Size);
-
-        if (! h.leavesSorted) {
-          Arrays.sort(h.buffer[0], 0, buf0Size);
-          Arrays.sort(h.buffer[1], 0, buf1Size);
-          h.leavesSorted = true;
-        }
-        Arrays.fill(indices, h.bufferSize - 1);
-        indices[0] = buf0Size - 1;
-        indices[1] = buf1Size - 1;
-      }
-      return count;
-    }
-  }
-
-  /**
-   * Return a MergedHistogram
-   * @param histograms array of histograms to merged together
-   * @return a new Histogram
-   */
-  public static Histogram merge(ApproximateHistogram[] histograms) {
-    return new MergedHistogram(histograms);
-  }
-
-  /**
-   * We compute the "smallest possible b" satisfying two inequalities:
-   *    1)   (b - 2) * (2 ^ (b - 2)) + 0.5 <= epsilon * N
-   *    2)   k * (2 ^ (b - 1)) >= N
-   *
-   * For an explanation of these inequalities, please read the Munro-Paterson or
-   * the Manku-Rajagopalan-Linday papers.
-   */
-  @VisibleForTesting static int computeDepth(double epsilon, long n) {
-    int b = 2;
-    while ((b - 2) * (1L << (b - 2)) + 0.5 <= epsilon * n) {
-      b += 1;
-    }
-    return b;
-  }
-
-  @VisibleForTesting static int computeBufferSize(int depth, long n) {
-    return (int) (n / (1L << (depth - 1)));
-  }
-
-  /**
-   * Return an estimation of the memory used by an instance.
-   * The size is due to:
-   * - a fix cost (76 bytes) for the class + fields
-   * - bufferPool: 16 + 2 * (16 + bufferSize * ELEM_SIZE)
-   * - indices: 16 + sizeof(Integer) * (depth + 1)
-   * - buffer: 16 + (depth + 1) * (16 + bufferSize * ELEM_SIZE)
-   *
-   * Note: This method is tested with unit test, it will break if you had new fields.
-   * @param bufferSize the size of a buffer
-   * @param depth the depth of the tree of buffer (depth + 1 buffers)
-   */
-  @VisibleForTesting
-  static long memoryUsage(int bufferSize, int depth) {
-    return 176 + (24 * depth) + (bufferSize * ELEM_SIZE * (depth + 3));
-  }
-
-  /**
-   * Return the level of the biggest element (using the indices array 'ids'
-   * to track which elements have been already returned). Every buffer has
-   * already been sorted at this point.
-   * @return the level of the biggest element or -1 if no element has been found
-   */
-  @VisibleForTesting
-  int biggest(final int[] ids) {
-    long biggest = Long.MIN_VALUE;
-    final int id0 = ids[0], id1 = ids[1];
-    int iBiggest = -1;
-
-    if (0 < leafCount && 0 <= id0) {
-      biggest = buffer[0][id0];
-      iBiggest = 0;
-    }
-    if (bufferSize < leafCount && 0 <= id1) {
-      long x = buffer[1][id1];
-      if (x > biggest) {
-        biggest = x;
-        iBiggest = 1;
-      }
-    }
-    for (int i = 2; i < currentTop + 1; i++) {
-      if (!isBufferEmpty(i) && 0 <= ids[i]) {
-        long x = buffer[i][ids[i]];
-        if (x > biggest) {
-          biggest = x;
-          iBiggest = i;
-        }
-      }
-    }
-    return iBiggest;
-  }
-
-
-  /**
-   * Based on the number of elements inserted we can easily know if a buffer
-   * is empty or not
-   */
-  @VisibleForTesting
-  boolean isBufferEmpty(int level) {
-    if (level == currentTop) {
-      return false; // root buffer (if present) is always full
-    } else {
-      long levelWeight = 1 << (level - 1);
-      return (((count - leafCount) / bufferSize) & levelWeight) == 0;
-    }
-  }
-
-  /**
-   * Return the weight of the level ie. 2^(i-1) except for the two tree
-   * leaves (weight=1) and for the root
-   */
-  private int weight(int level) {
-    if (level == 0) {
-      return 1;
-    } else if (level == maxDepth) {
-      return rootWeight;
-    } else {
-      return 1 << (level - 1);
-    }
-  }
-
-  private void allocate(int i) {
-    if (buffer[i] == null) {
-      buffer[i] = new long[bufferSize];
-    }
-  }
-
-  /**
-   * Recursively collapse the buffers of the tree.
-   * Upper buffers will be allocated on first access in this method.
-   */
-  private void recCollapse(long[] buf, int level) {
-    // if we reach the root, we can't add more buffer
-    if (level == maxDepth) {
-      // weight() return the weight of the root, in that case we need the
-      // weight of merge result
-      int mergeWeight = 1 << (level - 1);
-      int idx = level % 2;
-      long[] merged = bufferPool[idx];
-      long[] tmp = buffer[level];
-      collapse(buf, mergeWeight, buffer[level], rootWeight, merged);
-      buffer[level] = merged;
-      bufferPool[idx] = tmp;
-      rootWeight += mergeWeight;
-    } else {
-      allocate(level + 1); // lazy allocation (if needed)
-      if (level == currentTop) {
-        // if we reach the top, add a new buffer
-        collapse1(buf, buffer[level], buffer[level + 1]);
-        currentTop += 1;
-        rootWeight *= 2;
-      } else if (isBufferEmpty(level + 1)) {
-        // if the upper buffer is empty, use it
-        collapse1(buf, buffer[level], buffer[level + 1]);
-      } else {
-        // it the upper buffer isn't empty, collapse with it
-        long[] merged = bufferPool[level % 2];
-        collapse1(buf, buffer[level], merged);
-        recCollapse(merged, level + 1);
-      }
-    }
-  }
-
-  /**
-   * collapse two sorted Arrays of different weight
-   * ex: [2,5,7] weight 2 and [3,8,9] weight 3
-   *     weight x array + concat = [2,2,5,5,7,7,3,3,3,8,8,8,9,9,9]
-   *     sort = [2,2,3,3,3,5,5,7,7,8,8,8,9,9,9]
-   *     select every nth elems = [3,7,9]  (n = sum weight / 2)
-   */
-  @VisibleForTesting
-  static void collapse(
-    long[] left,
-    int leftWeight,
-    long[] right,
-    int rightWeight,
-    long[] output) {
-
-    int totalWeight = leftWeight + rightWeight;
-    int halfTotalWeight = (totalWeight / 2) - 1;
-    int i = 0, j = 0, k = 0, cnt = 0;
-
-    int weight;
-    long smallest;
-
-    while (i < left.length || j < right.length) {
-      if (i < left.length && (j == right.length || left[i] < right[j])) {
-        smallest = left[i];
-        weight = leftWeight;
-        i++;
-      } else {
-        smallest = right[j];
-        weight = rightWeight;
-        j++;
-      }
-
-      int cur = (cnt + halfTotalWeight) / totalWeight;
-      cnt += weight;
-      int next = (cnt + halfTotalWeight) / totalWeight;
-
-      for(; cur < next; cur++) {
-        output[k] = smallest;
-        k++;
-      }
-    }
-  }
-
-/**
- * Optimized version of collapse for collapsing two array of the same weight
- * (which is what we want most of the time)
- */
-  private static void collapse1(
-    long[] left,
-    long[] right,
-    long[] output) {
-
-    int i = 0, j = 0, k = 0, cnt = 0;
-    long smallest;
-
-    while (i < left.length || j < right.length) {
-      if (i < left.length && (j == right.length || left[i] < right[j])) {
-        smallest = left[i];
-        i++;
-      } else {
-        smallest = right[j];
-        j++;
-      }
-      if (cnt % 2 == 1) {
-        output[k] = smallest;
-        k++;
-      }
-      cnt++;
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/stats/CounterMap.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/stats/CounterMap.java b/commons/src/main/java/org/apache/aurora/common/stats/CounterMap.java
deleted file mode 100644
index 024e67b..0000000
--- a/commons/src/main/java/org/apache/aurora/common/stats/CounterMap.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.stats;
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Maps;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.logging.Logger;
-
-/**
- * A map from a key type to integers.  This simplifies the process of storing counters for multiple
- * values of the same type.
- */
-public class CounterMap <K> implements Iterable<Map.Entry<K, Integer>>, Cloneable {
-  private final Map<K, Integer> map = Maps.newHashMap();
-
-  private static Logger log = Logger.getLogger(CounterMap.class.getName());
-
-  /**
-   * Increments the counter value associated with {@code key}, and returns the new value.
-   *
-   * @param key The key to increment
-   * @return The incremented value.
-   */
-  public int incrementAndGet(K key) {
-    return incrementAndGet(key, 1);
-  }
-
-  /**
-   * Increments the value associated with {@code key} by {@code value}, returning the new value.
-   *
-   * @param key The key to increment
-   * @return The incremented value.
-   */
-  public int incrementAndGet(K key, int count) {
-    Integer value = map.get(key);
-    if (value == null) {
-      value = 0;
-    }
-    int newValue = count + value;
-    map.put(key, newValue);
-    return newValue;
-  }
-
-  /**
-   * Gets the value associated with a key.
-   *
-   * @param key The key to look up.
-   * @return The counter value stored for {@code key}, or 0 if no mapping exists.
-   */
-  public int get(K key) {
-    if (!map.containsKey(key)) {
-      return 0;
-    }
-
-    return map.get(key);
-  }
-
-  /**
-   * Assigns a value to a key.
-   *
-   * @param key The key to assign a value to.
-   * @param newValue The value to assign.
-   */
-  public void set(K key, int newValue) {
-    Preconditions.checkNotNull(key);
-    map.put(key, newValue);
-  }
-
-  /**
-   * Resets the value for {@code key}.  This will remove the key from the counter.
-   *
-   * @param key The key to reset.
-   */
-  public void reset(K key) {
-    map.remove(key);
-  }
-
-  /**
-   * Gets the number of entries stored in the map.
-   *
-   * @return The size of the map.
-   */
-  public int size() {
-    return map.size();
-  }
-
-  /**
-   * Gets an iterator for the mapped values.
-   *
-   * @return Iterator for mapped values.
-   */
-  public Iterator<Map.Entry<K, Integer>> iterator() {
-    return map.entrySet().iterator();
-  }
-
-  public Collection<Integer> values() {
-    return map.values();
-  }
-
-  public Set<K> keySet() {
-    return map.keySet();
-  }
-
-  public String toString() {
-    StringBuilder strVal = new StringBuilder();
-    for (Map.Entry<K, Integer> entry : this) {
-      strVal.append(entry.getKey().toString()).append(": ").append(entry.getValue()).append('\n');
-    }
-    return strVal.toString();
-  }
-
-  public Map<K, Integer> toMap() {
-    return map;
-  }
-
-  @Override
-  public CounterMap<K> clone() {
-    CounterMap<K> newInstance = new CounterMap<K>();
-    newInstance.map.putAll(map);
-    return newInstance;
-  }
-}


[12/21] aurora git commit: Remove unused classes from commons fork.

Posted by wf...@apache.org.
http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/resources/org/apache/aurora/common/application/http/graphview/dygraph-combined.js
----------------------------------------------------------------------
diff --git a/commons/src/main/resources/org/apache/aurora/common/application/http/graphview/dygraph-combined.js b/commons/src/main/resources/org/apache/aurora/common/application/http/graphview/dygraph-combined.js
deleted file mode 100644
index dcdd498..0000000
--- a/commons/src/main/resources/org/apache/aurora/common/application/http/graphview/dygraph-combined.js
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-"use strict";var DygraphLayout=function(a){this.dygraph_=a;this.datasets=[];this.setNames=[];this.annotations=[];this.yAxes_=null;this.points=null;this.xTicks_=null;this.yTicks_=null};DygraphLayout.prototype.attr_=function(a){return this.dygraph_.attr_(a)};DygraphLayout.prototype.addDataset=function(a,b){this.datasets.push(b);this.setNames.push(a)};DygraphLayout.prototype.getPlotArea=function(){return this.computePlotArea_()};DygraphLayout.prototype.computePlotArea_=function(){var a={x:0,y:0};a.w=this.dygraph_.width_-a.x-this.attr_("rightGap");a.h=this.dygraph_.height_;var b={chart_div:this.dygraph_.graphDiv,reserveSpaceLeft:function(c){var d={x:a.x,y:a.y,w:c,h:a.h};a.x+=c;a.w-=c;return d},reserveSpaceRight:function(c){var d={x:a.x+a.w-c,y:a.y,w:c,h:a.h};a.w-=c;return d},reserveSpaceTop:function(c){var d={x:a.x,y:a.y,w:a.w,h:c};a.y+=c;a.h-=c;return d},reserveSpaceBottom:function(c){var d={x:a.x,y:a.y+a.h-c,w:a.w,h:c};a.h-=c;return d},chartRect:function(){return{x:a.x,y:a.y,w:a.w,h:a
 .h}}};this.dygraph_.cascadeEvents_("layout",b);if(this.attr_("showRangeSelector")){a.h-=this.attr_("rangeSelectorHeight")+4}return a};DygraphLayout.prototype.setAnnotations=function(d){this.annotations=[];var e=this.attr_("xValueParser")||function(a){return a};for(var c=0;c<d.length;c++){var b={};if(!d[c].xval&&!d[c].x){this.dygraph_.error("Annotations must have an 'x' property");return}if(d[c].icon&&!(d[c].hasOwnProperty("width")&&d[c].hasOwnProperty("height"))){this.dygraph_.error("Must set width and height when setting annotation.icon property");return}Dygraph.update(b,d[c]);if(!b.xval){b.xval=e(b.x)}this.annotations.push(b)}};DygraphLayout.prototype.setXTicks=function(a){this.xTicks_=a};DygraphLayout.prototype.setYAxes=function(a){this.yAxes_=a};DygraphLayout.prototype.setDateWindow=function(a){this.dateWindow_=a};DygraphLayout.prototype.evaluate=function(){this._evaluateLimits();this._evaluateLineCharts();this._evaluateLineTicks();this._evaluateAnnotations()};DygraphLayout.prot
 otype._evaluateLimits=function(){this.minxval=this.maxxval=null;if(this.dateWindow_){this.minxval=this.dateWindow_[0];this.maxxval=this.dateWindow_[1]}else{for(var f=0;f<this.datasets.length;++f){var d=this.datasets[f];if(d.length>1){var b=d[0][0];if(!this.minxval||b<this.minxval){this.minxval=b}var a=d[d.length-1][0];if(!this.maxxval||a>this.maxxval){this.maxxval=a}}}}this.xrange=this.maxxval-this.minxval;this.xscale=(this.xrange!==0?1/this.xrange:1);for(var c=0;c<this.yAxes_.length;c++){var e=this.yAxes_[c];e.minyval=e.computedValueRange[0];e.maxyval=e.computedValueRange[1];e.yrange=e.maxyval-e.minyval;e.yscale=(e.yrange!==0?1/e.yrange:1);if(e.g.attr_("logscale")){e.ylogrange=Dygraph.log10(e.maxyval)-Dygraph.log10(e.minyval);e.ylogscale=(e.ylogrange!==0?1/e.ylogrange:1);if(!isFinite(e.ylogrange)||isNaN(e.ylogrange)){e.g.error("axis "+c+" of graph at "+e.g+" can't be displayed in log scale for range ["+e.minyval+" - "+e.maxyval+"]")}}}};DygraphLayout._calcYNormal=function(a,b){if(a
 .logscale){return 1-((Dygraph.log10(b)-Dygraph.log10(a.minyval))*a.ylogscale)}else{return 1-((b-a.minyval)*a.yscale)}};DygraphLayout.prototype._evaluateLineCharts=function(){var c=this.attr_("connectSeparatedPoints");this.points=new Array(this.datasets.length);for(var a=0;a<this.datasets.length;a++){var e=this.datasets[a];var h=this.setNames[a];var b=this.dygraph_.axisPropertiesForSeries(h);var m=new Array(e.length);for(var f=0;f<e.length;f++){var l=e[f];var d=DygraphLayout.parseFloat_(l[0]);var i=DygraphLayout.parseFloat_(l[1]);var k=(d-this.minxval)*this.xscale;var g=DygraphLayout._calcYNormal(b,i);if(c&&l[1]===null){i=null}m[f]={x:k,y:g,xval:d,yval:i,name:h}}this.points[a]=m}};DygraphLayout.parseFloat_=function(a){if(a===null){return NaN}return a};DygraphLayout.prototype._evaluateLineTicks=function(){var d,c,b,f;this.xticks=[];for(d=0;d<this.xTicks_.length;d++){c=this.xTicks_[d];b=c.label;f=this.xscale*(c.v-this.minxval);if((f>=0)&&(f<=1)){this.xticks.push([f,b])}}this.yticks=[];
 for(d=0;d<this.yAxes_.length;d++){var e=this.yAxes_[d];for(var a=0;a<e.ticks.length;a++){c=e.ticks[a];b=c.label;f=this.dygraph_.toPercentYCoord(c.v,d);if((f>=0)&&(f<=1)){this.yticks.push([d,f,b])}}}};DygraphLayout.prototype.evaluateWithError=function(){this.evaluate();if(!(this.attr_("errorBars")||this.attr_("customBars"))){return}var h=0;for(var a=0;a<this.datasets.length;++a){var o=this.points[a];var g=0;var f=this.datasets[a];var l=this.setNames[a];var e=this.dygraph_.axisPropertiesForSeries(l);for(g=0;g<f.length;g++,h++){var p=f[g];var c=DygraphLayout.parseFloat_(p[0]);var m=DygraphLayout.parseFloat_(p[1]);if(c==o[g].xval&&m==o[g].yval){var k=DygraphLayout.parseFloat_(p[2]);var d=DygraphLayout.parseFloat_(p[3]);var n=m-k;var b=m+d;o[g].y_top=DygraphLayout._calcYNormal(e,n);o[g].y_bottom=DygraphLayout._calcYNormal(e,b)}}}};DygraphLayout.prototype._evaluateAnnotations=function(){var d;var g={};for(d=0;d<this.annotations.length;d++){var b=this.annotations[d];g[b.xval+","+b.series]=
 b}this.annotated_points=[];if(!this.annotations||!this.annotations.length){return}for(var h=0;h<this.points.length;h++){var e=this.points[h];for(d=0;d<e.length;d++){var f=e[d];var c=f.xval+","+f.name;if(c in g){f.annotation=g[c];this.annotated_points.push(f)}}}};DygraphLayout.prototype.removeAllDatasets=function(){delete this.datasets;delete this.setNames;delete this.setPointsLengths;delete this.setPointsOffsets;this.datasets=[];this.setNames=[];this.setPointsLengths=[];this.setPointsOffsets=[]};DygraphLayout.prototype.unstackPointAtIndex=function(f,e){var a=this.points[f][e];if(!a.yval){return a}var c={};for(var d in a){c[d]=a[d]}if(!this.attr_("stackedGraph")){return c}if(f==this.points.length-1){return c}var b=this.points[f+1];if(b[e].xval==a.xval&&b[e].yval){c.yval-=b[e].yval}return c};"use strict";var DygraphCanvasRenderer=function(d,c,b,e){this.dygraph_=d;this.layout=e;this.element=c;this.elementContext=b;this.container=this.element.parentNode;this.height=this.element.height;t
 his.width=this.element.width;if(!this.isIE&&!(DygraphCanvasRenderer.isSupported(this.element))){throw"Canvas is not supported."}this.area=e.getPlotArea();this.container.style.position="relative";this.container.style.width=this.width+"px";if(this.dygraph_.isUsingExcanvas_){this._createIEClipArea()}else{if(!Dygraph.isAndroid()){var a=this.dygraph_.canvas_ctx_;a.beginPath();a.rect(this.area.x,this.area.y,this.area.w,this.area.h);a.clip();a=this.dygraph_.hidden_ctx_;a.beginPath();a.rect(this.area.x,this.area.y,this.area.w,this.area.h);a.clip()}}};DygraphCanvasRenderer.prototype.attr_=function(a,b){return this.dygraph_.attr_(a,b)};DygraphCanvasRenderer.prototype.clear=function(){var a;if(this.isIE){try{if(this.clearDelay){this.clearDelay.cancel();this.clearDelay=null}a=this.elementContext}catch(b){return}}a=this.elementContext;a.clearRect(0,0,this.width,this.height)};DygraphCanvasRenderer.isSupported=function(f){var b=null;try{if(typeof(f)=="undefined"||f===null){b=document.createElement
 ("canvas")}else{b=f}b.getContext("2d")}catch(c){var d=navigator.appVersion.match(/MSIE (\d\.\d)/);var a=(navigator.userAgent.toLowerCase().indexOf("opera")!=-1);if((!d)||(d[1]<6)||(a)){return false}return true}return true};DygraphCanvasRenderer.prototype.render=function(){this._updatePoints();this._renderLineChart()};DygraphCanvasRenderer.prototype._createIEClipArea=function(){var g="dygraph-clip-div";var f=this.dygraph_.graphDiv;for(var e=f.childNodes.length-1;e>=0;e--){if(f.childNodes[e].className==g){f.removeChild(f.childNodes[e])}}var c=document.bgColor;var d=this.dygraph_.graphDiv;while(d!=document){var a=d.currentStyle.backgroundColor;if(a&&a!="transparent"){c=a;break}d=d.parentNode}function b(j){if(j.w===0||j.h===0){return}var i=document.createElement("div");i.className=g;i.style.backgroundColor=c;i.style.position="absolute";i.style.left=j.x+"px";i.style.top=j.y+"px";i.style.width=j.w+"px";i.style.height=j.h+"px";f.appendChild(i)}var h=this.area;b({x:0,y:0,w:h.x,h:this.height
 });b({x:h.x,y:0,w:this.width-h.x,h:h.y});b({x:h.x+h.w,y:0,w:this.width-h.x-h.w,h:this.height});b({x:h.x,y:h.y+h.h,w:this.width-h.x,h:this.height-h.h-h.y})};DygraphCanvasRenderer._getIteratorPredicate=function(a){return a?DygraphCanvasRenderer._predicateThatSkipsEmptyPoints:null};DygraphCanvasRenderer._predicateThatSkipsEmptyPoints=function(b,a){return b[a].yval!==null};DygraphCanvasRenderer._drawStyledLine=function(i,a,m,q,f,n,d){var h=i.dygraph;var c=h.getOption("stepPlot");if(!Dygraph.isArrayLike(q)){q=null}var l=h.getOption("drawGapEdgePoints",i.setName);var o=i.points;var k=Dygraph.createIterator(o,0,o.length,DygraphCanvasRenderer._getIteratorPredicate(h.getOption("connectSeparatedPoints")));var j=q&&(q.length>=2);var p=i.drawingContext;p.save();if(j){p.installPattern(q)}var b=DygraphCanvasRenderer._drawSeries(i,k,m,d,f,l,c,a);DygraphCanvasRenderer._drawPointsOnLine(i,b,n,a,d);if(j){p.uninstallPattern()}p.restore()};DygraphCanvasRenderer._drawSeries=function(w,u,m,h,q,t,g,r){var
  b=null;var x=null;var k=null;var j;var p;var l=[];var f=true;var o=w.drawingContext;o.beginPath();o.strokeStyle=r;o.lineWidth=m;var c=u.array_;var v=u.end_;var a=u.predicate_;for(var s=u.start_;s<v;s++){p=c[s];if(a){while(s<v&&!a(c,s)){s++}if(s==v){break}p=c[s]}if(p.canvasy===null||p.canvasy!=p.canvasy){if(g&&b!==null){o.moveTo(b,x);o.lineTo(p.canvasx,x)}b=x=null}else{j=false;if(t||!b){u.nextIdx_=s;var n=u.next();k=u.hasNext?u.peek.canvasy:null;var d=k===null||k!=k;j=(!b&&d);if(t){if((!f&&!b)||(u.hasNext&&d)){j=true}}}if(b!==null){if(m){if(g){o.moveTo(b,x);o.lineTo(p.canvasx,x)}o.lineTo(p.canvasx,p.canvasy)}}else{o.moveTo(p.canvasx,p.canvasy)}if(q||j){l.push([p.canvasx,p.canvasy])}b=p.canvasx;x=p.canvasy}f=false}o.stroke();return l};DygraphCanvasRenderer._drawPointsOnLine=function(h,i,f,d,g){var c=h.drawingContext;for(var b=0;b<i.length;b++){var a=i[b];c.save();f(h.dygraph,h.setName,c,a[0],a[1],d,g);c.restore()}};DygraphCanvasRenderer.prototype._updatePoints=function(){var e=this.l
 ayout.points;for(var c=e.length;c--;){var d=e[c];for(var b=d.length;b--;){var a=d[b];a.canvasx=this.area.w*a.x+this.area.x;a.canvasy=this.area.h*a.y+this.area.y}}};DygraphCanvasRenderer.prototype._renderLineChart=function(h,x){var k=x||this.elementContext;var u=this.attr_("errorBars")||this.attr_("customBars");var f=this.attr_("fillGraph");var q;var a=this.layout.points;var v=this.layout.setNames;var n=v.length;var b;this.colors=this.dygraph_.colorsMap_;var r=this.attr_("plotter");var g=r;if(!Dygraph.isArrayLike(g)){g=[g]}var c={};for(q=0;q<v.length;q++){b=v[q];var w=this.attr_("plotter",b);if(w==r){continue}c[b]=w}for(q=0;q<g.length;q++){var t=g[q];var s=(q==g.length-1);for(var m=0;m<a.length;m++){b=v[m];if(h&&b!=h){continue}var o=a[m];var e=t;if(b in c){if(s){e=c[b]}else{continue}}var l=this.colors[b];var d=this.dygraph_.getOption("strokeWidth",b);k.save();k.strokeStyle=l;k.lineWidth=d;e({points:o,setName:b,drawingContext:k,color:l,strokeWidth:d,dygraph:this.dygraph_,axis:this.dyg
 raph_.axisPropertiesForSeries(b),plotArea:this.area,seriesIndex:m,seriesCount:a.length,allSeriesPoints:a});k.restore()}}};DygraphCanvasRenderer._Plotters={linePlotter:function(a){DygraphCanvasRenderer._linePlotter(a)},fillPlotter:function(a){DygraphCanvasRenderer._fillPlotter(a)},errorPlotter:function(a){DygraphCanvasRenderer._errorPlotter(a)}};DygraphCanvasRenderer._linePlotter=function(f){var d=f.dygraph;var h=f.setName;var i=f.strokeWidth;var a=d.getOption("strokeBorderWidth",h);var j=d.getOption("drawPointCallback",h)||Dygraph.Circles.DEFAULT;var k=d.getOption("strokePattern",h);var c=d.getOption("drawPoints",h);var b=d.getOption("pointSize",h);if(a&&i){DygraphCanvasRenderer._drawStyledLine(f,d.getOption("strokeBorderColor",h),i+2*a,k,c,j,b)}DygraphCanvasRenderer._drawStyledLine(f,f.color,i,k,c,j,b)};DygraphCanvasRenderer._errorPlotter=function(t){var s=t.dygraph;var h=t.setName;var v=s.getOption("errorBars")||s.getOption("customBars");if(!v){return}var l=s.getOption("fillGraph"
 ,h);if(l){s.warn("Can't use fillGraph option with error bars")}var n=t.drawingContext;var o=t.color;var p=s.getOption("fillAlpha",h);var j=s.getOption("stepPlot");var b=t.axis;var q=t.points;var r=Dygraph.createIterator(q,0,q.length,DygraphCanvasRenderer._getIteratorPredicate(s.getOption("connectSeparatedPoints")));var k;var i=NaN;var d=NaN;var f=[-1,-1];var u=b.yscale;var a=new RGBColor(o);var w="rgba("+a.r+","+a.g+","+a.b+","+p+")";n.fillStyle=w;n.beginPath();var c=function(e){return(e===null||e===undefined||isNaN(e))};while(r.hasNext){var m=r.next();if((!j&&c(m.y))||(j&&!isNaN(d)&&c(d))){i=NaN;continue}if(j){k=[m.y_bottom,m.y_top];d=m.y}else{k=[m.y_bottom,m.y_top]}k[0]=t.plotArea.h*k[0]+t.plotArea.y;k[1]=t.plotArea.h*k[1]+t.plotArea.y;if(!isNaN(i)){if(j){n.moveTo(i,f[0]);n.lineTo(m.canvasx,f[0]);n.lineTo(m.canvasx,f[1])}else{n.moveTo(i,f[0]);n.lineTo(m.canvasx,k[0]);n.lineTo(m.canvasx,k[1])}n.lineTo(i,f[1]);n.closePath()}f=k;i=m.canvasx}n.fill()};DygraphCanvasRenderer._fillPlotte
 r=function(D){if(D.seriesIndex!==0){return}var B=D.dygraph;var G=B.getLabels().slice(1);for(var A=G.length;A>=0;A--){if(!B.visibility()[A]){G.splice(A,1)}}var h=(function(){for(var e=0;e<G.length;e++){if(B.getOption("fillGraph",G[e])){return true}}return false})();if(!h){return}var u=D.drawingContext;var C=D.plotArea;var c=D.allSeriesPoints;var x=c.length;var w=B.getOption("fillAlpha");var o=B.getOption("stepPlot");var j=B.getOption("stackedGraph");var p=B.getColors();var q={};var a;for(var s=x-1;s>=0;s--){var m=G[s];if(!B.getOption("fillGraph",m)){continue}var v=p[s];var f=B.axisPropertiesForSeries(m);var d=1+f.minyval*f.yscale;if(d<0){d=0}else{if(d>1){d=1}}d=C.h*d+C.y;var z=c[s];var y=Dygraph.createIterator(z,0,z.length,DygraphCanvasRenderer._getIteratorPredicate(B.getOption("connectSeparatedPoints")));var l=NaN;var k=[-1,-1];var r;var E=f.yscale;var b=new RGBColor(v);var F="rgba("+b.r+","+b.g+","+b.b+","+w+")";u.fillStyle=F;u.beginPath();while(y.hasNext){var t=y.next();if(!Dygrap
 h.isOK(t.y)){l=NaN;continue}if(j){a=q[t.canvasx];var n;if(a===undefined){n=d}else{if(o){n=a[0]}else{n=a}}r=[t.canvasy,n];if(o){if(k[0]===-1){q[t.canvasx]=[t.canvasy,d]}else{q[t.canvasx]=[t.canvasy,k[0]]}}else{q[t.canvasx]=t.canvasy}}else{r=[t.canvasy,d]}if(!isNaN(l)){u.moveTo(l,k[0]);if(o){u.lineTo(t.canvasx,k[0]);if(a){u.lineTo(t.canvasx,a[1])}else{u.lineTo(t.canvasx,r[1])}}else{u.lineTo(t.canvasx,r[0]);u.lineTo(t.canvasx,r[1])}u.lineTo(l,k[1]);u.closePath()}k=r;l=t.canvasx}u.fill()}};"use strict";var Dygraph=function(d,c,b,a){if(a!==undefined){this.warn("Using deprecated four-argument dygraph constructor");this.__old_init__(d,c,b,a)}else{this.__init__(d,c,b)}};Dygraph.NAME="Dygraph";Dygraph.VERSION="1.2";Dygraph.__repr__=function(){return"["+this.NAME+" "+this.VERSION+"]"};Dygraph.toString=function(){return this.__repr__()};Dygraph.DEFAULT_ROLL_PERIOD=1;Dygraph.DEFAULT_WIDTH=480;Dygraph.DEFAULT_HEIGHT=320;Dygraph.ANIMATION_STEPS=10;Dygraph.ANIMATION_DURATION=200;Dygraph.numberValu
 eFormatter=function(a,e,h,d){var b=e("sigFigs");if(b!==null){return Dygraph.floatFormat(a,b)}var f=e("digitsAfterDecimal");var c=e("maxNumberWidth");if(a!==0&&(Math.abs(a)>=Math.pow(10,c)||Math.abs(a)<Math.pow(10,-f))){return a.toExponential(f)}else{return""+Dygraph.round_(a,f)}};Dygraph.numberAxisLabelFormatter=function(a,d,c,b){return Dygraph.numberValueFormatter(a,c,b)};Dygraph.dateString_=function(e){var i=Dygraph.zeropad;var h=new Date(e);var f=""+h.getFullYear();var g=i(h.getMonth()+1);var a=i(h.getDate());var c="";var b=h.getHours()*3600+h.getMinutes()*60+h.getSeconds();if(b){c=" "+Dygraph.hmsString_(e)}return f+"/"+g+"/"+a+c};Dygraph.dateAxisFormatter=function(b,c){if(c>=Dygraph.DECADAL){return b.strftime("%Y")}else{if(c>=Dygraph.MONTHLY){return b.strftime("%b %y")}else{var a=b.getHours()*3600+b.getMinutes()*60+b.getSeconds()+b.getMilliseconds();if(a===0||c>=Dygraph.DAILY){return new Date(b.getTime()+3600*1000).strftime("%d%b")}else{return Dygraph.hmsString_(b.getTime())}}}}
 ;Dygraph.Plotters=DygraphCanvasRenderer._Plotters;Dygraph.DEFAULT_ATTRS={highlightCircleSize:3,highlightSeriesOpts:null,highlightSeriesBackgroundAlpha:0.5,labelsDivWidth:250,labelsDivStyles:{},labelsSeparateLines:false,labelsShowZeroValues:true,labelsKMB:false,labelsKMG2:false,showLabelsOnHighlight:true,digitsAfterDecimal:2,maxNumberWidth:6,sigFigs:null,strokeWidth:1,strokeBorderWidth:0,strokeBorderColor:"white",axisTickSize:3,axisLabelFontSize:14,xAxisLabelWidth:50,yAxisLabelWidth:50,rightGap:5,showRoller:false,xValueParser:Dygraph.dateParser,delimiter:",",sigma:2,errorBars:false,fractions:false,wilsonInterval:true,customBars:false,fillGraph:false,fillAlpha:0.15,connectSeparatedPoints:false,stackedGraph:false,hideOverlayOnMouseOut:true,legend:"onmouseover",stepPlot:false,avoidMinZero:false,drawAxesAtZero:false,titleHeight:28,xLabelHeight:18,yLabelWidth:18,drawXAxis:true,drawYAxis:true,axisLineColor:"black",axisLineWidth:0.3,gridLineWidth:0.3,axisLabelColor:"black",axisLabelFont:"Ar
 ial",axisLabelWidth:50,drawYGrid:true,drawXGrid:true,gridLineColor:"rgb(128,128,128)",interactionModel:null,animatedZooms:false,showRangeSelector:false,rangeSelectorHeight:40,rangeSelectorPlotStrokeColor:"#808FAB",rangeSelectorPlotFillColor:"#A7B1C4",plotter:[Dygraph.Plotters.fillPlotter,Dygraph.Plotters.errorPlotter,Dygraph.Plotters.linePlotter],axes:{x:{pixelsPerLabel:60,axisLabelFormatter:Dygraph.dateAxisFormatter,valueFormatter:Dygraph.dateString_,ticker:null},y:{pixelsPerLabel:30,valueFormatter:Dygraph.numberValueFormatter,axisLabelFormatter:Dygraph.numberAxisLabelFormatter,ticker:null},y2:{pixelsPerLabel:30,valueFormatter:Dygraph.numberValueFormatter,axisLabelFormatter:Dygraph.numberAxisLabelFormatter,ticker:null}}};Dygraph.HORIZONTAL=1;Dygraph.VERTICAL=2;Dygraph.PLUGINS=[];Dygraph.addedAnnotationCSS=false;Dygraph.prototype.__old_init__=function(f,d,e,b){if(e!==null){var a=["Date"];for(var c=0;c<e.length;c++){a.push(e[c])}Dygraph.update(b,{labels:a})}this.__init__(f,d,b)};Dygr
 aph.prototype.__init__=function(a,c,k){if(/MSIE/.test(navigator.userAgent)&&!window.opera&&typeof(G_vmlCanvasManager)!="undefined"&&document.readyState!="complete"){var n=this;setTimeout(function(){n.__init__(a,c,k)},100);return}if(k===null||k===undefined){k={}}k=Dygraph.mapLegacyOptions_(k);if(!a){Dygraph.error("Constructing dygraph with a non-existent div!");return}this.isUsingExcanvas_=typeof(G_vmlCanvasManager)!="undefined";this.maindiv_=a;this.file_=c;this.rollPeriod_=k.rollPeriod||Dygraph.DEFAULT_ROLL_PERIOD;this.previousVerticalX_=-1;this.fractions_=k.fractions||false;this.dateWindow_=k.dateWindow||null;this.is_initial_draw_=true;this.annotations_=[];this.zoomed_x_=false;this.zoomed_y_=false;a.innerHTML="";if(a.style.width===""&&k.width){a.style.width=k.width+"px"}if(a.style.height===""&&k.height){a.style.height=k.height+"px"}if(a.style.height===""&&a.clientHeight===0){a.style.height=Dygraph.DEFAULT_HEIGHT+"px";if(a.style.width===""){a.style.width=Dygraph.DEFAULT_WIDTH+"px"}}
 this.width_=a.clientWidth;this.height_=a.clientHeight;if(k.stackedGraph){k.fillGraph=true}if(k.showRangeSelector&&k.animatedZooms){this.warn("You should not set animatedZooms=true when using the range selector.");k.animatedZooms=false}this.user_attrs_={};Dygraph.update(this.user_attrs_,k);this.attrs_={};Dygraph.updateDeep(this.attrs_,Dygraph.DEFAULT_ATTRS);this.boundaryIds_=[];this.setIndexByName_={};this.datasetIndex_=[];this.registeredEvents_=[];this.eventListeners_={};this.createInterface_();this.plugins_=[];for(var f=0;f<Dygraph.PLUGINS.length;f++){var h=Dygraph.PLUGINS[f];var e=new h();var j={plugin:e,events:{},options:{},pluginOptions:{}};var b=e.activate(this);for(var g in b){j.events[g]=b[g]}this.plugins_.push(j)}for(var f=0;f<this.plugins_.length;f++){var m=this.plugins_[f];for(var g in m.events){if(!m.events.hasOwnProperty(g)){continue}var l=m.events[g];var d=[m.plugin,l];if(!(g in this.eventListeners_)){this.eventListeners_[g]=[d]}else{this.eventListeners_[g].push(d)}}}th
 is.start_()};Dygraph.prototype.cascadeEvents_=function(c,b){if(!(c in this.eventListeners_)){return true}var g={dygraph:this,cancelable:false,defaultPrevented:false,preventDefault:function(){if(!g.cancelable){throw"Cannot call preventDefault on non-cancelable event."}g.defaultPrevented=true},propagationStopped:false,stopPropagation:function(){g.propagationStopped=true}};Dygraph.update(g,b);var a=this.eventListeners_[c];if(a){for(var d=a.length-1;d>=0;d--){var f=a[d][0];var h=a[d][1];h.call(f,g);if(g.propagationStopped){break}}}return g.defaultPrevented};Dygraph.prototype.isZoomed=function(a){if(a===null||a===undefined){return this.zoomed_x_||this.zoomed_y_}if(a==="x"){return this.zoomed_x_}if(a==="y"){return this.zoomed_y_}throw"axis parameter is ["+a+"] must be null, 'x' or 'y'."};Dygraph.prototype.toString=function(){var a=this.maindiv_;var b=(a&&a.id)?a.id:a;return"[Dygraph "+b+"]"};Dygraph.prototype.attr_=function(d,a){var c=[];c.push(this.attrs_);if(this.user_attrs_){c.push(thi
 s.user_attrs_);if(a){if(this.user_attrs_.hasOwnProperty(a)){c.push(this.user_attrs_[a])}if(a===this.highlightSet_&&this.user_attrs_.hasOwnProperty("highlightSeriesOpts")){c.push(this.user_attrs_.highlightSeriesOpts)}}}var b=null;for(var e=c.length-1;e>=0;--e){var f=c[e];if(f.hasOwnProperty(d)){b=f[d];break}}return b};Dygraph.prototype.getOption=function(a,b){return this.attr_(a,b)};Dygraph.prototype.optionsViewForAxis_=function(b){var a=this;return function(c){var d=a.user_attrs_.axes;if(d&&d[b]&&d[b][c]){return d[b][c]}if(typeof(a.user_attrs_[c])!="undefined"){return a.user_attrs_[c]}d=a.attrs_.axes;if(d&&d[b]&&d[b][c]){return d[b][c]}if(b=="y"&&a.axes_[0].hasOwnProperty(c)){return a.axes_[0][c]}else{if(b=="y2"&&a.axes_[1].hasOwnProperty(c)){return a.axes_[1][c]}}return a.attr_(c)}};Dygraph.prototype.rollPeriod=function(){return this.rollPeriod_};Dygraph.prototype.xAxisRange=function(){return this.dateWindow_?this.dateWindow_:this.xAxisExtremes()};Dygraph.prototype.xAxisExtremes=fu
 nction(){var b=this.rawData_[0][0];var a=this.rawData_[this.rawData_.length-1][0];return[b,a]};Dygraph.prototype.yAxisRange=function(a){if(typeof(a)=="undefined"){a=0}if(a<0||a>=this.axes_.length){return null}var b=this.axes_[a];return[b.computedValueRange[0],b.computedValueRange[1]]};Dygraph.prototype.yAxisRanges=function(){var a=[];for(var b=0;b<this.axes_.length;b++){a.push(this.yAxisRange(b))}return a};Dygraph.prototype.toDomCoords=function(a,c,b){return[this.toDomXCoord(a),this.toDomYCoord(c,b)]};Dygraph.prototype.toDomXCoord=function(b){if(b===null){return null}var c=this.plotter_.area;var a=this.xAxisRange();return c.x+(b-a[0])/(a[1]-a[0])*c.w};Dygraph.prototype.toDomYCoord=function(d,a){var c=this.toPercentYCoord(d,a);if(c===null){return null}var b=this.plotter_.area;return b.y+c*b.h};Dygraph.prototype.toDataCoords=function(a,c,b){return[this.toDataXCoord(a),this.toDataYCoord(c,b)]};Dygraph.prototype.toDataXCoord=function(b){if(b===null){return null}var c=this.plotter_.area;
 var a=this.xAxisRange();return a[0]+(b-c.x)/c.w*(a[1]-a[0])};Dygraph.prototype.toDataYCoord=function(h,b){if(h===null){return null}var c=this.plotter_.area;var g=this.yAxisRange(b);if(typeof(b)=="undefined"){b=0}if(!this.axes_[b].logscale){return g[0]+(c.y+c.h-h)/c.h*(g[1]-g[0])}else{var f=(h-c.y)/c.h;var a=Dygraph.log10(g[1]);var e=a-(f*(a-Dygraph.log10(g[0])));var d=Math.pow(Dygraph.LOG_SCALE,e);return d}};Dygraph.prototype.toPercentYCoord=function(e,b){if(e===null){return null}if(typeof(b)=="undefined"){b=0}var d=this.yAxisRange(b);var c;if(!this.axes_[b].logscale){c=(d[1]-e)/(d[1]-d[0])}else{var a=Dygraph.log10(d[1]);c=(a-Dygraph.log10(e))/(a-Dygraph.log10(d[0]))}return c};Dygraph.prototype.toPercentXCoord=function(b){if(b===null){return null}var a=this.xAxisRange();return(b-a[0])/(a[1]-a[0])};Dygraph.prototype.numColumns=function(){return this.rawData_[0]?this.rawData_[0].length:this.attr_("labels").length};Dygraph.prototype.numRows=function(){return this.rawData_.length};Dygra
 ph.prototype.fullXRange_=function(){if(this.numRows()>0){return[this.rawData_[0][0],this.rawData_[this.numRows()-1][0]]}else{return[0,1]}};Dygraph.prototype.getValue=function(b,a){if(b<0||b>this.rawData_.length){return null}if(a<0||a>this.rawData_[b].length){return null}return this.rawData_[b][a]};Dygraph.prototype.createInterface_=function(){var a=this.maindiv_;this.graphDiv=document.createElement("div");this.graphDiv.style.width=this.width_+"px";this.graphDiv.style.height=this.height_+"px";a.appendChild(this.graphDiv);this.canvas_=Dygraph.createCanvas();this.canvas_.style.position="absolute";this.canvas_.width=this.width_;this.canvas_.height=this.height_;this.canvas_.style.width=this.width_+"px";this.canvas_.style.height=this.height_+"px";this.canvas_ctx_=Dygraph.getContext(this.canvas_);this.hidden_=this.createPlotKitCanvas_(this.canvas_);this.hidden_ctx_=Dygraph.getContext(this.hidden_);if(this.attr_("showRangeSelector")){this.rangeSelector_=new DygraphRangeSelector(this)}this.g
 raphDiv.appendChild(this.hidden_);this.graphDiv.appendChild(this.canvas_);this.mouseEventElement_=this.createMouseEventElement_();this.layout_=new DygraphLayout(this);if(this.rangeSelector_){this.rangeSelector_.addToGraph(this.graphDiv,this.layout_)}var b=this;this.mouseMoveHandler=function(c){b.mouseMove_(c)};this.addEvent(this.mouseEventElement_,"mousemove",this.mouseMoveHandler);this.mouseOutHandler=function(c){b.mouseOut_(c)};this.addEvent(this.mouseEventElement_,"mouseout",this.mouseOutHandler);this.createDragInterface_();this.resizeHandler=function(c){b.resize()};this.addEvent(window,"resize",this.resizeHandler)};Dygraph.prototype.destroy=function(){var b=function(e){while(e.hasChildNodes()){b(e.firstChild);e.removeChild(e.firstChild)}};for(var a=0;a<this.registeredEvents_.length;a++){var d=this.registeredEvents_[a];Dygraph.removeEvent(d.elem,d.type,d.fn)}this.registeredEvents_=[];Dygraph.removeEvent(this.mouseEventElement_,"mouseout",this.mouseOutHandler);Dygraph.removeEvent(
 this.mouseEventElement_,"mousemove",this.mouseMoveHandler);Dygraph.removeEvent(this.mouseEventElement_,"mousemove",this.mouseUpHandler_);b(this.maindiv_);var c=function(e){for(var f in e){if(typeof(e[f])==="object"){e[f]=null}}};Dygraph.removeEvent(window,"resize",this.resizeHandler);this.resizeHandler=null;c(this.layout_);c(this.plotter_);c(this)};Dygraph.prototype.createPlotKitCanvas_=function(a){var b=Dygraph.createCanvas();b.style.position="absolute";b.style.top=a.style.top;b.style.left=a.style.left;b.width=this.width_;b.height=this.height_;b.style.width=this.width_+"px";b.style.height=this.height_+"px";return b};Dygraph.prototype.createMouseEventElement_=function(){if(this.isUsingExcanvas_){var a=document.createElement("div");a.style.position="absolute";a.style.backgroundColor="white";a.style.filter="alpha(opacity=0)";a.style.width=this.width_+"px";a.style.height=this.height_+"px";this.graphDiv.appendChild(a);return a}else{return this.canvas_}};Dygraph.prototype.setColors_=func
 tion(){var g=this.getLabels();var e=g.length-1;this.colors_=[];this.colorsMap_={};var a=this.attr_("colors");var d;if(!a){var c=this.attr_("colorSaturation")||1;var b=this.attr_("colorValue")||0.5;var k=Math.ceil(e/2);for(d=1;d<=e;d++){if(!this.visibility()[d-1]){continue}var h=d%2?Math.ceil(d/2):(k+d/2);var f=(1*h/(1+e));var j=Dygraph.hsvToRGB(f,c,b);this.colors_.push(j);this.colorsMap_[g[d]]=j}}else{for(d=0;d<e;d++){if(!this.visibility()[d]){continue}var j=a[d%a.length];this.colors_.push(j);this.colorsMap_[g[1+d]]=j}}};Dygraph.prototype.getColors=function(){return this.colors_};Dygraph.prototype.getPropertiesForSeries=function(c){var a=-1;var d=this.getLabels();for(var b=1;b<d.length;b++){if(d[b]==c){a=b;break}}if(a==-1){return null}return{name:c,column:a,visible:this.visibility()[a-1],color:this.colorsMap_[c],axis:1+this.seriesToAxisMap_[c]}};Dygraph.prototype.createRollInterface_=function(){if(!this.roller_){this.roller_=document.createElement("input");this.roller_.type="text";t
 his.roller_.style.display="none";this.graphDiv.appendChild(this.roller_)}var e=this.attr_("showRoller")?"block":"none";var d=this.plotter_.area;var b={position:"absolute",zIndex:10,top:(d.y+d.h-25)+"px",left:(d.x+1)+"px",display:e};this.roller_.size="2";this.roller_.value=this.rollPeriod_;for(var a in b){if(b.hasOwnProperty(a)){this.roller_.style[a]=b[a]}}var c=this;this.roller_.onchange=function(){c.adjustRoll(c.roller_.value)}};Dygraph.prototype.dragGetX_=function(b,a){return Dygraph.pageX(b)-a.px};Dygraph.prototype.dragGetY_=function(b,a){return Dygraph.pageY(b)-a.py};Dygraph.prototype.createDragInterface_=function(){var c={isZooming:false,isPanning:false,is2DPan:false,dragStartX:null,dragStartY:null,dragEndX:null,dragEndY:null,dragDirection:null,prevEndX:null,prevEndY:null,prevDragDirection:null,cancelNextDblclick:false,initialLeftmostDate:null,xUnitsPerPixel:null,dateRange:null,px:0,py:0,boundedDates:null,boundedValues:null,tarp:new Dygraph.IFrameTarp(),initializeMouseDown:func
 tion(i,h,f){if(i.preventDefault){i.preventDefault()}else{i.returnValue=false;i.cancelBubble=true}f.px=Dygraph.findPosX(h.canvas_);f.py=Dygraph.findPosY(h.canvas_);f.dragStartX=h.dragGetX_(i,f);f.dragStartY=h.dragGetY_(i,f);f.cancelNextDblclick=false;f.tarp.cover()}};var e=this.attr_("interactionModel");var b=this;var d=function(f){return function(g){f(g,b,c)}};for(var a in e){if(!e.hasOwnProperty(a)){continue}this.addEvent(this.mouseEventElement_,a,d(e[a]))}this.mouseUpHandler_=function(g){if(c.isZooming||c.isPanning){c.isZooming=false;c.dragStartX=null;c.dragStartY=null}if(c.isPanning){c.isPanning=false;c.draggingDate=null;c.dateRange=null;for(var f=0;f<b.axes_.length;f++){delete b.axes_[f].draggingValue;delete b.axes_[f].dragValueRange}}c.tarp.uncover()};this.addEvent(document,"mouseup",this.mouseUpHandler_)};Dygraph.prototype.drawZoomRect_=function(e,c,i,b,g,a,f,d){var h=this.canvas_ctx_;if(a==Dygraph.HORIZONTAL){h.clearRect(Math.min(c,f),this.layout_.getPlotArea().y,Math.abs(c-f
 ),this.layout_.getPlotArea().h)}else{if(a==Dygraph.VERTICAL){h.clearRect(this.layout_.getPlotArea().x,Math.min(b,d),this.layout_.getPlotArea().w,Math.abs(b-d))}}if(e==Dygraph.HORIZONTAL){if(i&&c){h.fillStyle="rgba(128,128,128,0.33)";h.fillRect(Math.min(c,i),this.layout_.getPlotArea().y,Math.abs(i-c),this.layout_.getPlotArea().h)}}else{if(e==Dygraph.VERTICAL){if(g&&b){h.fillStyle="rgba(128,128,128,0.33)";h.fillRect(this.layout_.getPlotArea().x,Math.min(b,g),this.layout_.getPlotArea().w,Math.abs(g-b))}}}if(this.isUsingExcanvas_){this.currentZoomRectArgs_=[e,c,i,b,g,0,0,0]}};Dygraph.prototype.clearZoomRect_=function(){this.currentZoomRectArgs_=null;this.canvas_ctx_.clearRect(0,0,this.canvas_.width,this.canvas_.height)};Dygraph.prototype.doZoomX_=function(c,a){this.currentZoomRectArgs_=null;var b=this.toDataXCoord(c);var d=this.toDataXCoord(a);this.doZoomXDates_(b,d)};Dygraph.zoomAnimationFunction=function(c,b){var a=1.5;return(1-Math.pow(a,-c))/(1-Math.pow(a,-b))};Dygraph.prototype.doZ
 oomXDates_=function(c,e){var a=this.xAxisRange();var d=[c,e];this.zoomed_x_=true;var b=this;this.doAnimatedZoom(a,d,null,null,function(){if(b.attr_("zoomCallback")){b.attr_("zoomCallback")(c,e,b.yAxisRanges())}})};Dygraph.prototype.doZoomY_=function(h,f){this.currentZoomRectArgs_=null;var c=this.yAxisRanges();var b=[];for(var e=0;e<this.axes_.length;e++){var d=this.toDataYCoord(h,e);var a=this.toDataYCoord(f,e);b.push([a,d])}this.zoomed_y_=true;var g=this;this.doAnimatedZoom(null,null,c,b,function(){if(g.attr_("zoomCallback")){var i=g.xAxisRange();g.attr_("zoomCallback")(i[0],i[1],g.yAxisRanges())}})};Dygraph.prototype.doUnzoom_=function(){var c=false,d=false,a=false;if(this.dateWindow_!==null){c=true;d=true}for(var g=0;g<this.axes_.length;g++){if(typeof(this.axes_[g].valueWindow)!=="undefined"&&this.axes_[g].valueWindow!==null){c=true;a=true}}this.clearSelection();if(c){this.zoomed_x_=false;this.zoomed_y_=false;var f=this.rawData_[0][0];var b=this.rawData_[this.rawData_.length-1][0
 ];if(!this.attr_("animatedZooms")){this.dateWindow_=null;for(g=0;g<this.axes_.length;g++){if(this.axes_[g].valueWindow!==null){delete this.axes_[g].valueWindow}}this.drawGraph_();if(this.attr_("zoomCallback")){this.attr_("zoomCallback")(f,b,this.yAxisRanges())}return}var l=null,m=null,k=null,h=null;if(d){l=this.xAxisRange();m=[f,b]}if(a){k=this.yAxisRanges();var n=this.gatherDatasets_(this.rolledSeries_,null);var o=n[1];this.computeYAxisRanges_(o);h=[];for(g=0;g<this.axes_.length;g++){var e=this.axes_[g];h.push((e.valueRange!==null&&e.valueRange!==undefined)?e.valueRange:e.extremeRange)}}var j=this;this.doAnimatedZoom(l,m,k,h,function(){j.dateWindow_=null;for(var p=0;p<j.axes_.length;p++){if(j.axes_[p].valueWindow!==null){delete j.axes_[p].valueWindow}}if(j.attr_("zoomCallback")){j.attr_("zoomCallback")(f,b,j.yAxisRanges())}})}};Dygraph.prototype.doAnimatedZoom=function(a,e,b,c,m){var i=this.attr_("animatedZooms")?Dygraph.ANIMATION_STEPS:1;var l=[];var k=[];var f,d;if(a!==null&&e!==
 null){for(f=1;f<=i;f++){d=Dygraph.zoomAnimationFunction(f,i);l[f-1]=[a[0]*(1-d)+d*e[0],a[1]*(1-d)+d*e[1]]}}if(b!==null&&c!==null){for(f=1;f<=i;f++){d=Dygraph.zoomAnimationFunction(f,i);var n=[];for(var g=0;g<this.axes_.length;g++){n.push([b[g][0]*(1-d)+d*c[g][0],b[g][1]*(1-d)+d*c[g][1]])}k[f-1]=n}}var h=this;Dygraph.repeatAndCleanup(function(p){if(k.length){for(var o=0;o<h.axes_.length;o++){var j=k[p][o];h.axes_[o].valueWindow=[j[0],j[1]]}}if(l.length){h.dateWindow_=l[p]}h.drawGraph_()},i,Dygraph.ANIMATION_DURATION/i,m)};Dygraph.prototype.getArea=function(){return this.plotter_.area};Dygraph.prototype.eventToDomCoords=function(c){var b=Dygraph.pageX(c)-Dygraph.findPosX(this.mouseEventElement_);var a=Dygraph.pageY(c)-Dygraph.findPosY(this.mouseEventElement_);return[b,a]};Dygraph.prototype.findClosestRow=function(b){var k=Infinity;var d=-1,a=-1;var g=this.layout_.points;for(var e=0;e<g.length;e++){var m=g[e];var f=m.length;for(var c=0;c<f;c++){var l=m[c];if(!Dygraph.isValidPoint(l,tru
 e)){continue}var h=Math.abs(l.canvasx-b);if(h<k){k=h;a=e;d=c}}}return this.idxToRow_(a,d)};Dygraph.prototype.findClosestPoint=function(f,e){var j=Infinity;var k=-1;var h,o,n,l,d,c;for(var b=0;b<this.layout_.datasets.length;++b){var m=this.layout_.points[b];for(var g=0;g<m.length;++g){var l=m[g];if(!Dygraph.isValidPoint(l)){continue}o=l.canvasx-f;n=l.canvasy-e;h=o*o+n*n;if(h<j){j=h;d=l;c=b;k=g}}}var a=this.layout_.setNames[c];return{row:k+this.getLeftBoundary_(),seriesName:a,point:d}};Dygraph.prototype.findStackedPoint=function(i,h){var q=this.findClosestRow(i);var g=this.getLeftBoundary_();var e=q-g;var j=this.layout_.points;var f,d;for(var c=0;c<this.layout_.datasets.length;++c){var m=this.layout_.points[c];if(e>=m.length){continue}var n=m[e];if(!Dygraph.isValidPoint(n)){continue}var k=n.canvasy;if(i>n.canvasx&&e+1<m.length){var l=m[e+1];if(Dygraph.isValidPoint(l)){var p=l.canvasx-n.canvasx;if(p>0){var a=(i-n.canvasx)/p;k+=a*(l.canvasy-n.canvasy)}}}else{if(i<n.canvasx&&e>0){var o=m
 [e-1];if(Dygraph.isValidPoint(o)){var p=n.canvasx-o.canvasx;if(p>0){var a=(n.canvasx-i)/p;k+=a*(o.canvasy-n.canvasy)}}}}if(c===0||k<h){f=n;d=c}}var b=this.layout_.setNames[d];return{row:q,seriesName:b,point:f}};Dygraph.prototype.mouseMove_=function(b){var h=this.layout_.points;if(h===undefined||h===null){return}var e=this.eventToDomCoords(b);var a=e[0];var j=e[1];var f=this.attr_("highlightSeriesOpts");var d=false;if(f&&!this.lockedSet_){var c;if(this.attr_("stackedGraph")){c=this.findStackedPoint(a,j)}else{c=this.findClosestPoint(a,j)}d=this.setSelection(c.row,c.seriesName)}else{var g=this.findClosestRow(a);d=this.setSelection(g)}var i=this.attr_("highlightCallback");if(i&&d){i(b,this.lastx_,this.selPoints_,this.lastRow_,this.highlightSet_)}};Dygraph.prototype.getLeftBoundary_=function(){for(var a=0;a<this.boundaryIds_.length;a++){if(this.boundaryIds_[a]!==undefined){return this.boundaryIds_[a][0]}}return 0};Dygraph.prototype.idxToRow_=function(b,a){if(a<0){return -1}var c=this.get
 LeftBoundary_();return c+a};Dygraph.prototype.animateSelection_=function(f){var e=10;var c=30;if(this.fadeLevel===undefined){this.fadeLevel=0}if(this.animateId===undefined){this.animateId=0}var g=this.fadeLevel;var b=f<0?g:e-g;if(b<=0){if(this.fadeLevel){this.updateSelection_(1)}return}var a=++this.animateId;var d=this;Dygraph.repeatAndCleanup(function(h){if(d.animateId!=a){return}d.fadeLevel+=f;if(d.fadeLevel===0){d.clearSelection()}else{d.updateSelection_(d.fadeLevel/e)}},b,c,function(){})};Dygraph.prototype.updateSelection_=function(d){var l=this.cascadeEvents_("select",{selectedX:this.lastx_,selectedPoints:this.selPoints_});var h;var o=this.canvas_ctx_;if(this.attr_("highlightSeriesOpts")){o.clearRect(0,0,this.width_,this.height_);var f=1-this.attr_("highlightSeriesBackgroundAlpha");if(f){var g=true;if(g){if(d===undefined){this.animateSelection_(1);return}f*=d}o.fillStyle="rgba(255,255,255,"+f+")";o.fillRect(0,0,this.width_,this.height_)}this.plotter_._renderLineChart(this.highl
 ightSet_,o)}else{if(this.previousVerticalX_>=0){var j=0;var k=this.attr_("labels");for(h=1;h<k.length;h++){var c=this.attr_("highlightCircleSize",k[h]);if(c>j){j=c}}var m=this.previousVerticalX_;o.clearRect(m-j-1,0,2*j+2,this.height_)}}if(this.isUsingExcanvas_&&this.currentZoomRectArgs_){Dygraph.prototype.drawZoomRect_.apply(this,this.currentZoomRectArgs_)}if(this.selPoints_.length>0){var b=this.selPoints_[0].canvasx;o.save();for(h=0;h<this.selPoints_.length;h++){var p=this.selPoints_[h];if(!Dygraph.isOK(p.canvasy)){continue}var a=this.attr_("highlightCircleSize",p.name);var n=this.attr_("drawHighlightPointCallback",p.name);var e=this.plotter_.colors[p.name];if(!n){n=Dygraph.Circles.DEFAULT}o.lineWidth=this.attr_("strokeWidth",p.name);o.strokeStyle=e;o.fillStyle=e;n(this.g,p.name,o,b,p.canvasy,e,a)}o.restore();this.previousVerticalX_=b}};Dygraph.prototype.setSelection=function(d,g,f){this.selPoints_=[];if(d!==false){d-=this.getLeftBoundary_()}var c=false;if(d!==false&&d>=0){if(d!=th
 is.lastRow_){c=true}this.lastRow_=d;for(var b=0;b<this.layout_.datasets.length;++b){var e=this.layout_.datasets[b];if(d<e.length){var a=this.layout_.points[b][d];if(this.attr_("stackedGraph")){a=this.layout_.unstackPointAtIndex(b,d)}if(a.yval!==null){this.selPoints_.push(a)}}}}else{if(this.lastRow_>=0){c=true}this.lastRow_=-1}if(this.selPoints_.length){this.lastx_=this.selPoints_[0].xval}else{this.lastx_=-1}if(g!==undefined){if(this.highlightSet_!==g){c=true}this.highlightSet_=g}if(f!==undefined){this.lockedSet_=f}if(c){this.updateSelection_(undefined)}return c};Dygraph.prototype.mouseOut_=function(a){if(this.attr_("unhighlightCallback")){this.attr_("unhighlightCallback")(a)}if(this.attr_("hideOverlayOnMouseOut")&&!this.lockedSet_){this.clearSelection()}};Dygraph.prototype.clearSelection=function(){this.cascadeEvents_("deselect",{});this.lockedSet_=false;if(this.fadeLevel){this.animateSelection_(-1);return}this.canvas_ctx_.clearRect(0,0,this.width_,this.height_);this.fadeLevel=0;thi
 s.selPoints_=[];this.lastx_=-1;this.lastRow_=-1;this.highlightSet_=null};Dygraph.prototype.getSelection=function(){if(!this.selPoints_||this.selPoints_.length<1){return -1}for(var c=0;c<this.layout_.points.length;c++){var a=this.layout_.points[c];for(var b=0;b<a.length;b++){if(a[b].x==this.selPoints_[0].x){return b+this.getLeftBoundary_()}}}return -1};Dygraph.prototype.getHighlightSeries=function(){return this.highlightSet_};Dygraph.prototype.loadedEvent_=function(a){this.rawData_=this.parseCSV_(a);this.predraw_()};Dygraph.prototype.addXTicks_=function(){var a;if(this.dateWindow_){a=[this.dateWindow_[0],this.dateWindow_[1]]}else{a=this.fullXRange_()}var c=this.optionsViewForAxis_("x");var b=c("ticker")(a[0],a[1],this.width_,c,this);this.layout_.setXTicks(b)};Dygraph.prototype.extremeValues_=function(d){var h=null,f=null,c,g;var b=this.attr_("errorBars")||this.attr_("customBars");if(b){for(c=0;c<d.length;c++){g=d[c][1][0];if(g===null||isNaN(g)){continue}var a=g-d[c][1][1];var e=g+d[c
 ][1][2];if(a>g){a=g}if(e<g){e=g}if(f===null||e>f){f=e}if(h===null||a<h){h=a}}}else{for(c=0;c<d.length;c++){g=d[c][1];if(g===null||isNaN(g)){continue}if(f===null||g>f){f=g}if(h===null||g<h){h=g}}}return[h,f]};Dygraph.prototype.predraw_=function(){var e=new Date();this.computeYAxes_();if(this.plotter_){this.cascadeEvents_("clearChart");this.plotter_.clear()}this.plotter_=new DygraphCanvasRenderer(this,this.hidden_,this.hidden_ctx_,this.layout_);this.createRollInterface_();this.cascadeEvents_("predraw");if(this.rangeSelector_){this.rangeSelector_.renderStaticLayer()}this.rolledSeries_=[null];for(var c=1;c<this.numColumns();c++){var d=this.attr_("logscale",c);var b=this.extractSeries_(this.rawData_,c,d);b=this.rollingAverage(b,this.rollPeriod_);this.rolledSeries_.push(b)}this.drawGraph_();var a=new Date();this.drawingTimeMs_=(a-e)};Dygraph.prototype.gatherDatasets_=function(w,c){var s=[];var b=[];var e=[];var a={};var u,t,r;var m=w.length-1;for(u=m;u>=1;u--){if(!this.visibility()[u-1]){
 continue}var h=[];for(t=0;t<w[u].length;t++){h.push(w[u][t])}var o=this.attr_("errorBars")||this.attr_("customBars");if(c){var A=c[0];var f=c[1];var p=[];var d=null,z=null;for(r=0;r<h.length;r++){if(h[r][0]>=A&&d===null){d=r}if(h[r][0]<=f){z=r}}if(d===null){d=0}if(d>0){d--}if(z===null){z=h.length-1}if(z<h.length-1){z++}s[u-1]=[d,z];for(r=d;r<=z;r++){p.push(h[r])}h=p}else{s[u-1]=[0,h.length-1]}var n=this.extremeValues_(h);if(o){for(t=0;t<h.length;t++){h[t]=[h[t][0],h[t][1][0],h[t][1][1],h[t][1][2]]}}else{if(this.attr_("stackedGraph")){var q=h.length;var y;for(t=0;t<q;t++){var g=h[t][0];if(b[g]===undefined){b[g]=0}y=h[t][1];if(y===null){h[t]=[g,null];continue}b[g]+=y;h[t]=[g,b[g]];if(b[g]>n[1]){n[1]=b[g]}if(b[g]<n[0]){n[0]=b[g]}}}}var v=this.attr_("labels")[u];a[v]=n;e[u]=h}if(this.attr_("stackedGraph")){for(r=e.length-1;r>=0;--r){if(!e[r]){continue}for(t=0;t<e[r].length;t++){var g=e[r][t][0];if(isNaN(b[g])){for(u=e.length-1;u>=0;u--){if(!e[u]){continue}e[u][t][1]=NaN}}}break}}return[
 e,a,s]};Dygraph.prototype.drawGraph_=function(){var a=new Date();var e=this.is_initial_draw_;this.is_initial_draw_=false;this.layout_.removeAllDatasets();this.setColors_();this.attrs_.pointSize=0.5*this.attr_("highlightCircleSize");var j=this.gatherDatasets_(this.rolledSeries_,this.dateWindow_);var d=j[0];var k=j[1];this.boundaryIds_=j[2];this.setIndexByName_={};var h=this.attr_("labels");if(h.length>0){this.setIndexByName_[h[0]]=0}var f=0;for(var g=1;g<d.length;g++){this.setIndexByName_[h[g]]=g;if(!this.visibility()[g-1]){continue}this.layout_.addDataset(h[g],d[g]);this.datasetIndex_[g]=f++}this.computeYAxisRanges_(k);this.layout_.setYAxes(this.axes_);this.addXTicks_();var b=this.zoomed_x_;this.layout_.setDateWindow(this.dateWindow_);this.zoomed_x_=b;this.layout_.evaluateWithError();this.renderGraph_(e);if(this.attr_("timingName")){var c=new Date();if(console){console.log(this.attr_("timingName")+" - drawGraph: "+(c-a)+"ms")}}};Dygraph.prototype.renderGraph_=function(a){this.cascad
 eEvents_("clearChart");this.plotter_.clear();if(this.attr_("underlayCallback")){this.attr_("underlayCallback")(this.hidden_ctx_,this.layout_.getPlotArea(),this,this)}var b={canvas:this.hidden_,drawingContext:this.hidden_ctx_};this.cascadeEvents_("willDrawChart",b);this.plotter_.render();this.cascadeEvents_("didDrawChart",b);this.canvas_.getContext("2d").clearRect(0,0,this.canvas_.width,this.canvas_.height);if(this.rangeSelector_){this.rangeSelector_.renderInteractiveLayer()}if(this.attr_("drawCallback")!==null){this.attr_("drawCallback")(this,a)}};Dygraph.prototype.computeYAxes_=function(){var g,c,m,b,j,a,p;if(this.axes_!==undefined&&this.user_attrs_.hasOwnProperty("valueRange")===false){c=[];for(j=0;j<this.axes_.length;j++){c.push(this.axes_[j].valueWindow)}}this.axes_=[{yAxisId:0,g:this}];this.seriesToAxisMap_={};var h=this.attr_("labels");var f={};for(g=1;g<h.length;g++){f[h[g]]=(g-1)}var e=["includeZero","valueRange","labelsKMB","labelsKMG2","pixelsPerYLabel","yAxisLabelWidth","
 axisLabelFontSize","axisTickSize","logscale"];for(g=0;g<e.length;g++){var d=e[g];p=this.attr_(d);if(p){this.axes_[0][d]=p}}for(m in f){if(!f.hasOwnProperty(m)){continue}b=this.attr_("axis",m);if(b===null){this.seriesToAxisMap_[m]=0;continue}if(typeof(b)=="object"){a={};Dygraph.update(a,this.axes_[0]);Dygraph.update(a,{valueRange:null});var o=this.axes_.length;a.yAxisId=o;a.g=this;Dygraph.update(a,b);this.axes_.push(a);this.seriesToAxisMap_[m]=o}}for(m in f){if(!f.hasOwnProperty(m)){continue}b=this.attr_("axis",m);if(typeof(b)=="string"){if(!this.seriesToAxisMap_.hasOwnProperty(b)){this.error("Series "+m+" wants to share a y-axis with series "+b+", which does not define its own axis.");return null}var n=this.seriesToAxisMap_[b];this.seriesToAxisMap_[m]=n}}if(c!==undefined){for(j=0;j<c.length;j++){this.axes_[j].valueWindow=c[j]}}for(b=0;b<this.axes_.length;b++){if(b===0){a=this.optionsViewForAxis_("y"+(b?"2":""));p=a("valueRange");if(p){this.axes_[b].valueRange=p}}else{var l=this.user
 _attrs_.axes;if(l&&l.y2){p=l.y2.valueRange;if(p){this.axes_[b].valueRange=p}}}}};Dygraph.prototype.numAxes=function(){var c=0;for(var b in this.seriesToAxisMap_){if(!this.seriesToAxisMap_.hasOwnProperty(b)){continue}var a=this.seriesToAxisMap_[b];if(a>c){c=a}}return 1+c};Dygraph.prototype.axisPropertiesForSeries=function(a){return this.axes_[this.seriesToAxisMap_[a]]};Dygraph.prototype.computeYAxisRanges_=function(a){var g=[],h;for(h in this.seriesToAxisMap_){if(!this.seriesToAxisMap_.hasOwnProperty(h)){continue}var p=this.seriesToAxisMap_[h];while(g.length<=p){g.push([])}g[p].push(h)}for(var u=0;u<this.axes_.length;u++){var b=this.axes_[u];if(!g[u]){b.extremeRange=[0,1]}else{h=g[u];var x=Infinity;var w=-Infinity;var o,m;for(var s=0;s<h.length;s++){if(!a.hasOwnProperty(h[s])){continue}o=a[h[s]][0];if(o!==null){x=Math.min(o,x)}m=a[h[s]][1];if(m!==null){w=Math.max(m,w)}}if(b.includeZero&&x>0){x=0}if(x==Infinity){x=0}if(w==-Infinity){w=1}var t=w-x;if(t===0){t=w}var d,z;if(b.logscale){d
 =w+0.1*t;z=x}else{d=w+0.1*t;z=x-0.1*t;if(!this.attr_("avoidMinZero")){if(z<0&&x>=0){z=0}if(d>0&&w<=0){d=0}}if(this.attr_("includeZero")){if(w<0){d=0}if(x>0){z=0}}}b.extremeRange=[z,d]}if(b.valueWindow){b.computedValueRange=[b.valueWindow[0],b.valueWindow[1]]}else{if(b.valueRange){b.computedValueRange=[b.valueRange[0],b.valueRange[1]]}else{b.computedValueRange=b.extremeRange}}var n=this.optionsViewForAxis_("y"+(u?"2":""));var y=n("ticker");if(u===0||b.independentTicks){b.ticks=y(b.computedValueRange[0],b.computedValueRange[1],this.height_,n,this)}else{var l=this.axes_[0];var e=l.ticks;var f=l.computedValueRange[1]-l.computedValueRange[0];var A=b.computedValueRange[1]-b.computedValueRange[0];var c=[];for(var r=0;r<e.length;r++){var q=(e[r].v-l.computedValueRange[0])/f;var v=b.computedValueRange[0]+q*A;c.push(v)}b.ticks=y(b.computedValueRange[0],b.computedValueRange[1],this.height_,n,this,c)}}};Dygraph.prototype.extractSeries_=function(g,e,f){var d=[];for(var c=0;c<g.length;c++){var b=
 g[c][0];var a=g[c][e];if(f){if(a<=0){a=null}}d.push([b,a])}return d};Dygraph.prototype.rollingAverage=function(l,d){if(l.length<2){return l}d=Math.min(d,l.length);var b=[];var s=this.attr_("sigma");var E,o,w,v,m,c,D,x;if(this.fractions_){var k=0;var h=0;var e=100;for(w=0;w<l.length;w++){k+=l[w][1][0];h+=l[w][1][1];if(w-d>=0){k-=l[w-d][1][0];h-=l[w-d][1][1]}var A=l[w][0];var u=h?k/h:0;if(this.attr_("errorBars")){if(this.attr_("wilsonInterval")){if(h){var r=u<0?0:u,t=h;var z=s*Math.sqrt(r*(1-r)/t+s*s/(4*t*t));var a=1+s*s/h;E=(r+s*s/(2*h)-z)/a;o=(r+s*s/(2*h)+z)/a;b[w]=[A,[r*e,(r-E)*e,(o-r)*e]]}else{b[w]=[A,[0,0,0]]}}else{x=h?s*Math.sqrt(u*(1-u)/h):1;b[w]=[A,[e*u,e*x,e*x]]}}else{b[w]=[A,e*u]}}}else{if(this.attr_("customBars")){E=0;var B=0;o=0;var g=0;for(w=0;w<l.length;w++){var C=l[w][1];m=C[1];b[w]=[l[w][0],[m,m-C[0],C[2]-m]];if(m!==null&&!isNaN(m)){E+=C[0];B+=m;o+=C[2];g+=1}if(w-d>=0){var q=l[w-d];if(q[1][1]!==null&&!isNaN(q[1][1])){E-=q[1][0];B-=q[1][1];o-=q[1][2];g-=1}}if(g){b[w]=[l
 [w][0],[1*B/g,1*(B-E)/g,1*(o-B)/g]]}else{b[w]=[l[w][0],[null,null,null]]}}}else{if(!this.attr_("errorBars")){if(d==1){return l}for(w=0;w<l.length;w++){c=0;D=0;for(v=Math.max(0,w-d+1);v<w+1;v++){m=l[v][1];if(m===null||isNaN(m)){continue}D++;c+=l[v][1]}if(D){b[w]=[l[w][0],c/D]}else{b[w]=[l[w][0],null]}}}else{for(w=0;w<l.length;w++){c=0;var f=0;D=0;for(v=Math.max(0,w-d+1);v<w+1;v++){m=l[v][1][0];if(m===null||isNaN(m)){continue}D++;c+=l[v][1][0];f+=Math.pow(l[v][1][1],2)}if(D){x=Math.sqrt(f)/D;b[w]=[l[w][0],[c/D,s*x,s*x]]}else{b[w]=[l[w][0],[null,null,null]]}}}}}return b};Dygraph.prototype.detectTypeFromString_=function(b){var a=false;var c=b.indexOf("-");if((c>0&&(b[c-1]!="e"&&b[c-1]!="E"))||b.indexOf("/")>=0||isNaN(parseFloat(b))){a=true}else{if(b.length==8&&b>"19700101"&&b<"20371231"){a=true}}if(a){this.attrs_.xValueParser=Dygraph.dateParser;this.attrs_.axes.x.valueFormatter=Dygraph.dateString_;this.attrs_.axes.x.ticker=Dygraph.dateTicker;this.attrs_.axes.x.axisLabelFormatter=Dygraph
 .dateAxisFormatter}else{this.attrs_.xValueParser=function(d){return parseFloat(d)};this.attrs_.axes.x.valueFormatter=function(d){return d};this.attrs_.axes.x.ticker=Dygraph.numericLinearTicks;this.attrs_.axes.x.axisLabelFormatter=this.attrs_.axes.x.valueFormatter}};Dygraph.prototype.parseFloat_=function(a,c,b){var e=parseFloat(a);if(!isNaN(e)){return e}if(/^ *$/.test(a)){return null}if(/^ *nan *$/i.test(a)){return NaN}var d="Unable to parse '"+a+"' as a number";if(b!==null&&c!==null){d+=" on line "+(1+c)+" ('"+b+"') of CSV."}this.error(d);return null};Dygraph.prototype.parseCSV_=function(t){var r=[];var s=Dygraph.detectLineDelimiter(t);var a=t.split(s||"\n");var g,k;var p=this.attr_("delimiter");if(a[0].indexOf(p)==-1&&a[0].indexOf("\t")>=0){p="\t"}var b=0;if(!("labels" in this.user_attrs_)){b=1;this.attrs_.labels=a[0].split(p)}var o=0;var m;var q=false;var c=this.attr_("labels").length;var f=false;for(var l=b;l<a.length;l++){var e=a[l];o=l;if(e.length===0){continue}if(e[0]=="#"){co
 ntinue}var d=e.split(p);if(d.length<2){continue}var h=[];if(!q){this.detectTypeFromString_(d[0]);m=this.attr_("xValueParser");q=true}h[0]=m(d[0],this);if(this.fractions_){for(k=1;k<d.length;k++){g=d[k].split("/");if(g.length!=2){this.error('Expected fractional "num/den" values in CSV data but found a value \''+d[k]+"' on line "+(1+l)+" ('"+e+"') which is not of this form.");h[k]=[0,0]}else{h[k]=[this.parseFloat_(g[0],l,e),this.parseFloat_(g[1],l,e)]}}}else{if(this.attr_("errorBars")){if(d.length%2!=1){this.error("Expected alternating (value, stdev.) pairs in CSV data but line "+(1+l)+" has an odd number of values ("+(d.length-1)+"): '"+e+"'")}for(k=1;k<d.length;k+=2){h[(k+1)/2]=[this.parseFloat_(d[k],l,e),this.parseFloat_(d[k+1],l,e)]}}else{if(this.attr_("customBars")){for(k=1;k<d.length;k++){var u=d[k];if(/^ *$/.test(u)){h[k]=[null,null,null]}else{g=u.split(";");if(g.length==3){h[k]=[this.parseFloat_(g[0],l,e),this.parseFloat_(g[1],l,e),this.parseFloat_(g[2],l,e)]}else{this.warn('W
 hen using customBars, values must be either blank or "low;center;high" tuples (got "'+u+'" on line '+(1+l))}}}}else{for(k=1;k<d.length;k++){h[k]=this.parseFloat_(d[k],l,e)}}}}if(r.length>0&&h[0]<r[r.length-1][0]){f=true}if(h.length!=c){this.error("Number of columns in line "+l+" ("+h.length+") does not agree with number of labels ("+c+") "+e)}if(l===0&&this.attr_("labels")){var n=true;for(k=0;n&&k<h.length;k++){if(h[k]){n=false}}if(n){this.warn("The dygraphs 'labels' option is set, but the first row of CSV data ('"+e+"') appears to also contain labels. Will drop the CSV labels and use the option labels.");continue}}r.push(h)}if(f){this.warn("CSV is out of order; order it correctly to speed loading.");r.sort(function(j,i){return j[0]-i[0]})}return r};Dygraph.prototype.parseArray_=function(c){if(c.length===0){this.error("Can't plot empty data set");return null}if(c[0].length===0){this.error("Data set cannot contain an empty row");return null}var a;if(this.attr_("labels")===null){this.
 warn("Using default labels. Set labels explicitly via 'labels' in the options parameter");this.attrs_.labels=["X"];for(a=1;a<c[0].length;a++){this.attrs_.labels.push("Y"+a)}}else{var b=this.attr_("labels");if(b.length!=c[0].length){this.error("Mismatch between number of labels ("+b+") and number of columns in array ("+c[0].length+")");return null}}if(Dygraph.isDateLike(c[0][0])){this.attrs_.axes.x.valueFormatter=Dygraph.dateString_;this.attrs_.axes.x.axisLabelFormatter=Dygraph.dateAxisFormatter;this.attrs_.axes.x.ticker=Dygraph.dateTicker;var d=Dygraph.clone(c);for(a=0;a<c.length;a++){if(d[a].length===0){this.error("Row "+(1+a)+" of data is empty");return null}if(d[a][0]===null||typeof(d[a][0].getTime)!="function"||isNaN(d[a][0].getTime())){this.error("x value in row "+(1+a)+" is not a Date");return null}d[a][0]=d[a][0].getTime()}return d}else{this.attrs_.axes.x.valueFormatter=function(e){return e};this.attrs_.axes.x.axisLabelFormatter=Dygraph.numberAxisLabelFormatter;this.attrs_.ax
 es.x.ticker=Dygraph.numericLinearTicks;return c}};Dygraph.prototype.parseDataTable_=function(w){var d=function(i){var j=String.fromCharCode(65+i%26);i=Math.floor(i/26);while(i>0){j=String.fromCharCode(65+(i-1)%26)+j.toLowerCase();i=Math.floor((i-1)/26)}return j};var h=w.getNumberOfColumns();var g=w.getNumberOfRows();var f=w.getColumnType(0);if(f=="date"||f=="datetime"){this.attrs_.xValueParser=Dygraph.dateParser;this.attrs_.axes.x.valueFormatter=Dygraph.dateString_;this.attrs_.axes.x.ticker=Dygraph.dateTicker;this.attrs_.axes.x.axisLabelFormatter=Dygraph.dateAxisFormatter}else{if(f=="number"){this.attrs_.xValueParser=function(i){return parseFloat(i)};this.attrs_.axes.x.valueFormatter=function(i){return i};this.attrs_.axes.x.ticker=Dygraph.numericLinearTicks;this.attrs_.axes.x.axisLabelFormatter=this.attrs_.axes.x.valueFormatter}else{this.error("only 'date', 'datetime' and 'number' types are supported for column 1 of DataTable input (Got '"+f+"')");return null}}var m=[];var t={};var 
 s=false;var q,o;for(q=1;q<h;q++){var b=w.getColumnType(q);if(b=="number"){m.push(q)}else{if(b=="string"&&this.attr_("displayAnnotations")){var r=m[m.length-1];if(!t.hasOwnProperty(r)){t[r]=[q]}else{t[r].push(q)}s=true}else{this.error("Only 'number' is supported as a dependent type with Gviz. 'string' is only supported if displayAnnotations is true")}}}var u=[w.getColumnLabel(0)];for(q=0;q<m.length;q++){u.push(w.getColumnLabel(m[q]));if(this.attr_("errorBars")){q+=1}}this.attrs_.labels=u;h=u.length;var v=[];var l=false;var a=[];for(q=0;q<g;q++){var e=[];if(typeof(w.getValue(q,0))==="undefined"||w.getValue(q,0)===null){this.warn("Ignoring row "+q+" of DataTable because of undefined or null first column.");continue}if(f=="date"||f=="datetime"){e.push(w.getValue(q,0).getTime())}else{e.push(w.getValue(q,0))}if(!this.attr_("errorBars")){for(o=0;o<m.length;o++){var c=m[o];e.push(w.getValue(q,c));if(s&&t.hasOwnProperty(c)&&w.getValue(q,t[c][0])!==null){var p={};p.series=w.getColumnLabel(c);
 p.xval=e[0];p.shortText=d(a.length);p.text="";for(var n=0;n<t[c].length;n++){if(n){p.text+="\n"}p.text+=w.getValue(q,t[c][n])}a.push(p)}}for(o=0;o<e.length;o++){if(!isFinite(e[o])){e[o]=null}}}else{for(o=0;o<h-1;o++){e.push([w.getValue(q,1+2*o),w.getValue(q,2+2*o)])}}if(v.length>0&&e[0]<v[v.length-1][0]){l=true}v.push(e)}if(l){this.warn("DataTable is out of order; order it correctly to speed loading.");v.sort(function(j,i){return j[0]-i[0]})}this.rawData_=v;if(a.length>0){this.setAnnotations(a,true)}};Dygraph.prototype.start_=function(){var d=this.file_;if(typeof d=="function"){d=d()}if(Dygraph.isArrayLike(d)){this.rawData_=this.parseArray_(d);this.predraw_()}else{if(typeof d=="object"&&typeof d.getColumnRange=="function"){this.parseDataTable_(d);this.predraw_()}else{if(typeof d=="string"){var c=Dygraph.detectLineDelimiter(d);if(c){this.loadedEvent_(d)}else{var b=new XMLHttpRequest();var a=this;b.onreadystatechange=function(){if(b.readyState==4){if(b.status===200||b.status===0){a.lo
 adedEvent_(b.responseText)}}};b.open("GET",d,true);b.send(null)}}else{this.error("Unknown data format: "+(typeof d))}}}};Dygraph.prototype.updateOptions=function(e,b){if(typeof(b)=="undefined"){b=false}var d=e.file;var c=Dygraph.mapLegacyOptions_(e);if("rollPeriod" in c){this.rollPeriod_=c.rollPeriod}if("dateWindow" in c){this.dateWindow_=c.dateWindow;if(!("isZoomedIgnoreProgrammaticZoom" in c)){this.zoomed_x_=(c.dateWindow!==null)}}if("valueRange" in c&&!("isZoomedIgnoreProgrammaticZoom" in c)){this.zoomed_y_=(c.valueRange!==null)}var a=Dygraph.isPixelChangingOptionList(this.attr_("labels"),c);Dygraph.updateDeep(this.user_attrs_,c);if(d){this.file_=d;if(!b){this.start_()}}else{if(!b){if(a){this.predraw_()}else{this.renderGraph_(false)}}}};Dygraph.mapLegacyOptions_=function(c){var a={};for(var b in c){if(b=="file"){continue}if(c.hasOwnProperty(b)){a[b]=c[b]}}var e=function(g,f,h){if(!a.axes){a.axes={}}if(!a.axes[g]){a.axes[g]={}}a.axes[g][f]=h};var d=function(f,g,h){if(typeof(c[f])!
 ="undefined"){e(g,h,c[f]);delete a[f]}};d("xValueFormatter","x","valueFormatter");d("pixelsPerXLabel","x","pixelsPerLabel");d("xAxisLabelFormatter","x","axisLabelFormatter");d("xTicker","x","ticker");d("yValueFormatter","y","valueFormatter");d("pixelsPerYLabel","y","pixelsPerLabel");d("yAxisLabelFormatter","y","axisLabelFormatter");d("yTicker","y","ticker");return a};Dygraph.prototype.resize=function(d,b){if(this.resize_lock){return}this.resize_lock=true;if((d===null)!=(b===null)){this.warn("Dygraph.resize() should be called with zero parameters or two non-NULL parameters. Pretending it was zero.");d=b=null}var a=this.width_;var c=this.height_;if(d){this.maindiv_.style.width=d+"px";this.maindiv_.style.height=b+"px";this.width_=d;this.height_=b}else{this.width_=this.maindiv_.clientWidth;this.height_=this.maindiv_.clientHeight}if(a!=this.width_||c!=this.height_){this.maindiv_.innerHTML="";this.roller_=null;this.attrs_.labelsDiv=null;this.createInterface_();if(this.annotations_.length)
 {this.layout_.setAnnotations(this.annotations_)}this.predraw_()}this.resize_lock=false};Dygraph.prototype.adjustRoll=function(a){this.rollPeriod_=a;this.predraw_()};Dygraph.prototype.visibility=function(){if(!this.attr_("visibility")){this.attrs_.visibility=[]}while(this.attr_("visibility").length<this.numColumns()-1){this.attrs_.visibility.push(true)}return this.attr_("visibility")};Dygraph.prototype.setVisibility=function(b,c){var a=this.visibility();if(b<0||b>=a.length){this.warn("invalid series number in setVisibility: "+b)}else{a[b]=c;this.predraw_()}};Dygraph.prototype.size=function(){return{width:this.width_,height:this.height_}};Dygraph.prototype.setAnnotations=function(b,a){Dygraph.addAnnotationRule();this.annotations_=b;this.layout_.setAnnotations(this.annotations_);if(!a){this.predraw_()}};Dygraph.prototype.annotations=function(){return this.annotations_};Dygraph.prototype.getLabels=function(){return this.attr_("labels").slice()};Dygraph.prototype.indexFromSetName=functio
 n(a){return this.setIndexByName_[a]};Dygraph.prototype.datasetIndexFromSetName_=function(a){return this.datasetIndex_[this.indexFromSetName(a)]};Dygraph.addAnnotationRule=function(){if(Dygraph.addedAnnotationCSS){return}var f="border: 1px solid black; background-color: white; text-align: center;";var e=document.createElement("style");e.type="text/css";document.getElementsByTagName("head")[0].appendChild(e);for(var b=0;b<document.styleSheets.length;b++){if(document.styleSheets[b].disabled){continue}var d=document.styleSheets[b];try{if(d.insertRule){var a=d.cssRules?d.cssRules.length:0;d.insertRule(".dygraphDefaultAnnotation { "+f+" }",a)}else{if(d.addRule){d.addRule(".dygraphDefaultAnnotation",f)}}Dygraph.addedAnnotationCSS=true;return}catch(c){}}this.warn("Unable to add default annotation CSS rule; display may be off.")};var DateGraph=Dygraph;"use strict";Dygraph.LOG_SCALE=10;Dygraph.LN_TEN=Math.log(Dygraph.LOG_SCALE);Dygraph.log10=function(a){return Math.log(a)/Dygraph.LN_TEN};Dygr
 aph.DEBUG=1;Dygraph.INFO=2;Dygraph.WARNING=3;Dygraph.ERROR=3;Dygraph.LOG_STACK_TRACES=false;Dygraph.DOTTED_LINE=[2,2];Dygraph.DASHED_LINE=[7,3];Dygraph.DOT_DASH_LINE=[7,2,2,2];Dygraph.log=function(b,d){var a;if(typeof(printStackTrace)!="undefined"){try{a=printStackTrace({guess:false});while(a[0].indexOf("stacktrace")!=-1){a.splice(0,1)}a.splice(0,2);for(var c=0;c<a.length;c++){a[c]=a[c].replace(/\([^)]*\/(.*)\)/,"@$1").replace(/\@.*\/([^\/]*)/,"@$1").replace("[object Object].","")}var g=a.splice(0,1)[0];d+=" ("+g.replace(/^.*@ ?/,"")+")"}catch(f){}}if(typeof(console)!="undefined"){switch(b){case Dygraph.DEBUG:console.debug("dygraphs: "+d);break;case Dygraph.INFO:console.info("dygraphs: "+d);break;case Dygraph.WARNING:console.warn("dygraphs: "+d);break;case Dygraph.ERROR:console.error("dygraphs: "+d);break}}if(Dygraph.LOG_STACK_TRACES){console.log(a.join("\n"))}};Dygraph.info=function(a){Dygraph.log(Dygraph.INFO,a)};Dygraph.prototype.info=Dygraph.info;Dygraph.warn=function(a){Dygraph
 .log(Dygraph.WARNING,a)};Dygraph.prototype.warn=Dygraph.warn;Dygraph.error=function(a){Dygraph.log(Dygraph.ERROR,a)};Dygraph.prototype.error=Dygraph.error;Dygraph.getContext=function(a){return a.getContext("2d")};Dygraph.addEvent=function addEvent(c,b,a){if(c.addEventListener){c.addEventListener(b,a,false)}else{c[b+a]=function(){a(window.event)};c.attachEvent("on"+b,c[b+a])}};Dygraph.prototype.addEvent=function addEvent(c,b,a){Dygraph.addEvent(c,b,a);this.registeredEvents_.push({elem:c,type:b,fn:a})};Dygraph.removeEvent=function addEvent(c,b,a){if(c.removeEventListener){c.removeEventListener(b,a,false)}else{try{c.detachEvent("on"+b,c[b+a])}catch(d){}c[b+a]=null}};Dygraph.cancelEvent=function(a){a=a?a:window.event;if(a.stopPropagation){a.stopPropagation()}if(a.preventDefault){a.preventDefault()}a.cancelBubble=true;a.cancel=true;a.returnValue=false;return false};Dygraph.hsvToRGB=function(h,g,k){var c;var d;var l;if(g===0){c=k;d=k;l=k}else{var e=Math.floor(h*6);var j=(h*6)-e;var b=k*(1
 -g);var a=k*(1-(g*j));var m=k*(1-(g*(1-j)));switch(e){case 1:c=a;d=k;l=b;break;case 2:c=b;d=k;l=m;break;case 3:c=b;d=a;l=k;break;case 4:c=m;d=b;l=k;break;case 5:c=k;d=b;l=a;break;case 6:case 0:c=k;d=m;l=b;break}}c=Math.floor(255*c+0.5);d=Math.floor(255*d+0.5);l=Math.floor(255*l+0.5);return"rgb("+c+","+d+","+l+")"};Dygraph.findPosX=function(b){var c=0;if(b.offsetParent){var a=b;while(1){c+=a.offsetLeft;if(!a.offsetParent){break}a=a.offsetParent}}else{if(b.x){c+=b.x}}while(b&&b!=document.body){c-=b.scrollLeft;b=b.parentNode}return c};Dygraph.findPosY=function(c){var b=0;if(c.offsetParent){var a=c;while(1){b+=a.offsetTop;if(!a.offsetParent){break}a=a.offsetParent}}else{if(c.y){b+=c.y}}while(c&&c!=document.body){b-=c.scrollTop;c=c.parentNode}return b};Dygraph.pageX=function(c){if(c.pageX){return(!c.pageX||c.pageX<0)?0:c.pageX}else{var d=document;var a=document.body;return c.clientX+(d.scrollLeft||a.scrollLeft)-(d.clientLeft||0)}};Dygraph.pageY=function(c){if(c.pageY){return(!c.pageY||c.
 pageY<0)?0:c.pageY}else{var d=document;var a=document.body;return c.clientY+(d.scrollTop||a.scrollTop)-(d.clientTop||0)}};Dygraph.isOK=function(a){return a&&!isNaN(a)};Dygraph.isValidPoint=function(b,a){if(!b){return false}if(b.yval===null){return false}if(b.x===null||b.x===undefined){return false}if(b.y===null||b.y===undefined){return false}if(isNaN(b.x)||(!a&&isNaN(b.y))){return false}return true};Dygraph.floatFormat=function(a,b){var c=Math.min(Math.max(1,b||2),21);return(Math.abs(a)<0.001&&a!==0)?a.toExponential(c-1):a.toPrecision(c)};Dygraph.zeropad=function(a){if(a<10){return"0"+a}else{return""+a}};Dygraph.hmsString_=function(a){var c=Dygraph.zeropad;var b=new Date(a);if(b.getSeconds()){return c(b.getHours())+":"+c(b.getMinutes())+":"+c(b.getSeconds())}else{return c(b.getHours())+":"+c(b.getMinutes())}};Dygraph.round_=function(c,b){var a=Math.pow(10,b);return Math.round(c*a)/a};Dygraph.binarySearch=function(a,d,i,e,b){if(e===null||e===undefined||b===null||b===undefined){e=0;b=
 d.length-1}if(e>b){return -1}if(i===null||i===undefined){i=0}var h=function(j){return j>=0&&j<d.length};var g=parseInt((e+b)/2,10);var c=d[g];if(c==a){return g}var f;if(c>a){if(i>0){f=g-1;if(h(f)&&d[f]<a){return g}}return Dygraph.binarySearch(a,d,i,e,g-1)}if(c<a){if(i<0){f=g+1;if(h(f)&&d[f]>a){return g}}return Dygraph.binarySearch(a,d,i,g+1,b)}};Dygraph.dateParser=function(a){var b;var c;if(a.search("-")==-1||a.search("T")!=-1||a.search("Z")!=-1){c=Dygraph.dateStrToMillis(a);if(c&&!isNaN(c)){return c}}if(a.search("-")!=-1){b=a.replace("-","/","g");while(b.search("-")!=-1){b=b.replace("-","/")}c=Dygraph.dateStrToMillis(b)}else{if(a.length==8){b=a.substr(0,4)+"/"+a.substr(4,2)+"/"+a.substr(6,2);c=Dygraph.dateStrToMillis(b)}else{c=Dygraph.dateStrToMillis(a)}}if(!c||isNaN(c)){Dygraph.error("Couldn't parse "+a+" as a date")}return c};Dygraph.dateStrToMillis=function(a){return new Date(a).getTime()};Dygraph.update=function(b,c){if(typeof(c)!="undefined"&&c!==null){for(var a in c){if(c.has
 OwnProperty(a)){b[a]=c[a]}}}return b};Dygraph.updateDeep=function(b,d){function c(e){return(typeof Node==="object"?e instanceof Node:typeof e==="object"&&typeof e.nodeType==="number"&&typeof e.nodeName==="string")}if(typeof(d)!="undefined"&&d!==null){for(var a in d){if(d.hasOwnProperty(a)){if(d[a]===null){b[a]=null}else{if(Dygraph.isArrayLike(d[a])){b[a]=d[a].slice()}else{if(c(d[a])){b[a]=d[a]}else{if(typeof(d[a])=="object"){if(typeof(b[a])!="object"||b[a]===null){b[a]={}}Dygraph.updateDeep(b[a],d[a])}else{b[a]=d[a]}}}}}}}return b};Dygraph.isArrayLike=function(b){var a=typeof(b);if((a!="object"&&!(a=="function"&&typeof(b.item)=="function"))||b===null||typeof(b.length)!="number"||b.nodeType===3){return false}return true};Dygraph.isDateLike=function(a){if(typeof(a)!="object"||a===null||typeof(a.getTime)!="function"){return false}return true};Dygraph.clone=function(c){var b=[];for(var a=0;a<c.length;a++){if(Dygraph.isArrayLike(c[a])){b.push(Dygraph.clone(c[a]))}else{b.push(c[a])}}retur
 n b};Dygraph.createCanvas=function(){var a=document.createElement("canvas");var b=(/MSIE/.test(navigator.userAgent)&&!window.opera);if(b&&(typeof(G_vmlCanvasManager)!="undefined")){a=G_vmlCanvasManager.initElement(a)}return a};Dygraph.isAndroid=function(){return(/Android/).test(navigator.userAgent)};Dygraph.Iterator=function(d,c,b,a){c=c||0;b=b||d.length;this.hasNext=true;this.peek=null;this.start_=c;this.array_=d;this.predicate_=a;this.end_=Math.min(d.length,c+b);this.nextIdx_=c-1;this.next()};Dygraph.Iterator.prototype.next=function(){if(!this.hasNext){return null}var c=this.peek;var b=this.nextIdx_+1;var a=false;while(b<this.end_){if(!this.predicate_||this.predicate_(this.array_,b)){this.peek=this.array_[b];a=true;break}b++}this.nextIdx_=b;if(!a){this.hasNext=false;this.peek=null}return c};Dygraph.createIterator=function(d,c,b,a){return new Dygraph.Iterator(d,c,b,a)};Dygraph.repeatAndCleanup=function(b,g,f,c){var e=0;var d=new Date().getTime();b(e);if(g==1){c();return}(function a
 (){if(e>=g){return}var h=d+(1+e)*f;setTimeout(function(){e++;b(e);if(e>=g-1){c()}else{a()}},h-new Date().getTime())})()};Dygraph.isPixelChangingOptionList=function(h,e){var d={annotationClickHandler:true,annotationDblClickHandler:true,annotationMouseOutHandler:true,annotationMouseOverHandler:true,axisLabelColor:true,axisLineColor:true,axisLineWidth:true,clickCallback:true,digitsAfterDecimal:true,drawCallback:true,drawHighlightPointCallback:true,drawPoints:true,drawPointCallback:true,drawXGrid:true,drawYGrid:true,fillAlpha:true,gridLineColor:true,gridLineWidth:true,hideOverlayOnMouseOut:true,highlightCallback:true,highlightCircleSize:true,interactionModel:true,isZoomedIgnoreProgrammaticZoom:true,labelsDiv:true,labelsDivStyles:true,labelsDivWidth:true,labelsKMB:true,labelsKMG2:true,labelsSeparateLines:true,labelsShowZeroValues:true,legend:true,maxNumberWidth:true,panEdgeFraction:true,pixelsPerYLabel:true,pointClickCallback:true,pointSize:true,rangeSelectorPlotFillColor:true,rangeSelec
 torPlotStrokeColor:true,showLabelsOnHighlight:true,showRoller:true,sigFigs:true,strokeWidth:true,underlayCallback:true,unhighlightCallback:true,xAxisLabelFormatter:true,xTicker:true,xValueFormatter:true,yAxisLabelFormatter:true,yValueFormatter:true,zoomCallback:true};var a=false;var b={};if(h){for(var f=1;f<h.length;f++){b[h[f]]=true}}for(var g in e){if(a){break}if(e.hasOwnProperty(g)){if(b[g]){for(var c in e[g]){if(a){break}if(e[g].hasOwnProperty(c)&&!d[c]){a=true}}}else{if(!d[g]){a=true}}}}return a};Dygraph.compareArrays=function(c,b){if(!Dygraph.isArrayLike(c)||!Dygraph.isArrayLike(b)){return false}if(c.length!==b.length){return false}for(var a=0;a<c.length;a++){if(c[a]!==b[a]){return false}}return true};Dygraph.regularShape_=function(p,c,j,f,e,a,o){a=a?a:0;o=o?o:Math.PI*2/c;p.beginPath();var h=true;var g=a;var d=g;var i=function(){var q=f+(Math.sin(d)*j);var r=e+(-Math.cos(d)*j);return[q,r]};var b=i();var m=b[0];var k=b[1];p.moveTo(m,k);for(var n=0;n<c;n++){d=(n==c-1)?g:(d+o);va
 r l=i();p.lineTo(l[0],l[1])}p.fill();p.stroke()};Dygraph.shapeFunction_=function(b,a,c){return function(j,i,f,e,k,h,d){f.strokeStyle=h;f.fillStyle="white";Dygraph.regularShape_(f,b,d,e,k,a,c)}};Dygraph.DrawPolygon_=function(f,c,d,b,h,e,a,g){new Dygraph.RegularShape_(f,c,g).draw(d,b,h,a)};Dygraph.Circles={DEFAULT:function(h,f,b,e,d,c,a){b.beginPath();b.fillStyle=c;b.arc(e,d,a,0,2*Math.PI,false);b.fill()},TRIANGLE:Dygraph.shapeFunction_(3),SQUARE:Dygraph.shapeFunction_(4,Math.PI/4),DIAMOND:Dygraph.shapeFunction_(4),PENTAGON:Dygraph.shapeFunction_(5),HEXAGON:Dygraph.shapeFunction_(6),CIRCLE:function(f,e,c,b,h,d,a){c.beginPath();c.strokeStyle=d;c.fillStyle="white";c.arc(b,h,a,0,2*Math.PI,false);c.fill();c.stroke()},STAR:Dygraph.shapeFunction_(5,0,4*Math.PI/5),PLUS:function(f,e,c,b,h,d,a){c.strokeStyle=d;c.beginPath();c.moveTo(b+a,h);c.lineTo(b-a,h);c.closePath();c.stroke();c.beginPath();c.moveTo(b,h+a);c.lineTo(b,h-a);c.closePath();c.stroke()},EX:function(f,e,c,b,h,d,a){c.strokeStyle=d;
 c.beginPath();c.moveTo(b+a,h+a);c.lineTo(b-a,h-a);c.closePath();c.stroke();c.beginPath();c.moveTo(b+a,h-a);c.lineTo(b-a,h+a);c.closePath();c.stroke()}};Dygraph.IFrameTarp=function(){this.tarps=[]};Dygraph.IFrameTarp.prototype.cover=function(){var f=document.getElementsByTagName("iframe");for(var c=0;c<f.length;c++){var e=f[c];var b=Dygraph.findPosX(e),h=Dygraph.findPosY(e),d=e.offsetWidth,a=e.offsetHeight;var g=document.createElement("div");g.style.position="absolute";g.style.left=b+"px";g.style.top=h+"px";g.style.width=d+"px";g.style.height=a+"px";g.style.zIndex=999;document.body.appendChild(g);this.tarps.push(g)}};Dygraph.IFrameTarp.prototype.uncover=function(){for(var a=0;a<this.tarps.length;a++){this.tarps[a].parentNode.removeChild(this.tarps[a])}this.tarps=[]};Dygraph.detectLineDelimiter=function(c){for(var a=0;a<c.length;a++){var b=c[a];if(b=="\r"){return b}if(b=="\n"){if(a<c.length&&c[a+1]=="\r"){return"\n\r"}return b}}return null};"use strict";Dygraph.GVizChart=function(a){t
 his.container=a};Dygraph.GVizChart.prototype.draw=function(b,a){this.container.innerHTML="";if(typeof(this.date_graph)!="undefined"){this.date_graph.destroy()}this.date_graph=new Dygraph(this.container,b,a)};Dygraph.GVizChart.prototype.setSelection=function(b){var a=false;if(b.length){a=b[0].row}this.date_graph.setSelection(a)};Dygraph.GVizChart.prototype.getSelection=function(){var b=[];var d=this.date_graph.getSelection();if(d<0){return b}var a=this.date_graph.layout_.datasets;for(var c=0;c<a.length;++c){b.push({row:d,column:c+1})}return b};"use strict";Dygraph.Interaction={};Dygraph.Interaction.startPan=function(o,t,c){var r,b;c.isPanning=true;var k=t.xAxisRange();c.dateRange=k[1]-k[0];c.initialLeftmostDate=k[0];c.xUnitsPerPixel=c.dateRange/(t.plotter_.area.w-1);if(t.attr_("panEdgeFraction")){var w=t.width_*t.attr_("panEdgeFraction");var d=t.xAxisExtremes();var j=t.toDomXCoord(d[0])-w;var l=t.toDomXCoord(d[1])+w;var u=t.toDataXCoord(j);var v=t.toDataXCoord(l);c.boundedDates=[u,v]
 ;var f=[];var a=t.height_*t.attr_("panEdgeFraction");for(r=0;r<t.axes_.length;r++){b=t.axes_[r];var p=b.extremeRange;var q=t.toDomYCoord(p[0],r)+a;var s=t.toDomYCoord(p[1],r)-a;var n=t.toDataYCoord(q);var e=t.toDataYCoord(s);f[r]=[n,e]}c.boundedValues=f}c.is2DPan=false;c.axes=[];for(r=0;r<t.axes_.length;r++){b=t.axes_[r];var h={};var m=t.yAxisRange(r);if(b.logscale){h.initialTopValue=Dygraph.log10(m[1]);h.dragValueRange=Dygraph.log10(m[1])-Dygraph.log10(m[0])}else{h.initialTopValue=m[1];h.dragValueRange=m[1]-m[0]}h.unitsPerPixel=h.dragValueRange/(t.plotter_.area.h-1);c.axes.push(h);if(b.valueWindow||b.valueRange){c.is2DPan=true}}};Dygraph.Interaction.movePan=function(b,k,c){c.dragEndX=k.dragGetX_(b,c);c.dragEndY=k.dragGetY_(b,c);var h=c.initialLeftmostDate-(c.dragEndX-c.dragStartX)*c.xUnitsPerPixel;if(c.boundedDates){h=Math.max(h,c.boundedDates[0])}var a=h+c.dateRange;if(c.boundedDates){if(a>c.boundedDates[1]){h=h-(a-c.boundedDates[1]);a=h+c.dateRange}}k.dateWindow_=[h,a];if(c.is2DP
 an){for(var j=0;j<k.axes_.length;j++){var e=k.axes_[j];var n=c.axes[j];var d=c.dragEndY-c.dragStartY;var o=d*n.unitsPerPixel;var f=c.boundedValues?c.boundedValues[j]:null;var l=n.initialTopValue+o;if(f){l=Math.min(l,f[1])}var m=l-n.dragValueRange;if(f){if(m<f[0]){l=l-(m-f[0]);m=l-n.dragValueRange}}if(e.logscale){e.valueWindow=[Math.pow(Dygraph.LOG_SCALE,m),Math.pow(Dygraph.LOG_SCALE,l)]}else{e.valueWindow=[m,l]}}}k.drawGraph_(false)};Dygraph.Interaction.endPan=function(c,b,a){a.dragEndX=b.dragGetX_(c,a);a.dragEndY=b.dragGetY_(c,a);var e=Math.abs(a.dragEndX-a.dragStartX);var d=Math.abs(a.dragEndY-a.dragStartY);if(e<2&&d<2&&b.lastx_!==undefined&&b.lastx_!=-1){Dygraph.Interaction.treatMouseOpAsClick(b,c,a)}a.isPanning=false;a.is2DPan=false;a.initialLeftmostDate=null;a.dateRange=null;a.valueRange=null;a.boundedDates=null;a.boundedValues=null;a.axes=null};Dygraph.Interaction.startZoom=function(c,b,a){a.isZooming=true;a.zoomMoved=false};Dygraph.Interaction.moveZoom=function(c,b,a){a.zoomM
 oved=true;a.dragEndX=b.dragGetX_(c,a);a.dragEndY=b.dragGetY_(c,a);var e=Math.abs(a.dragStartX-a.dragEndX);var d=Math.abs(a.dragStartY-a.dragEndY);a.dragDirection=(e<d/2)?Dygraph.VERTICAL:Dygraph.HORIZONTAL;b.drawZoomRect_(a.dragDirection,a.dragStartX,a.dragEndX,a.dragStartY,a.dragEndY,a.prevDragDirection,a.prevEndX,a.prevEndY);a.prevEndX=a.dragEndX;a.prevEndY=a.dragEndY;a.prevDragDirection=a.dragDirection};Dygraph.Interaction.treatMouseOpAsClick=function(f,b,d){var k=f.attr_("clickCallback");var n=f.attr_("pointClickCallback");var j=null;if(n){var l=-1;var m=Number.MAX_VALUE;for(var e=0;e<f.selPoints_.length;e++){var c=f.selPoints_[e];var a=Math.pow(c.canvasx-d.dragEndX,2)+Math.pow(c.canvasy-d.dragEndY,2);if(!isNaN(a)&&(l==-1||a<m)){m=a;l=e}}var h=f.attr_("highlightCircleSize")+2;if(m<=h*h){j=f.selPoints_[l]}}if(j){n(b,j)}if(k){k(b,f.lastx_,f.selPoints_)}};Dygraph.Interaction.endZoom=function(c,b,a){a.isZooming=false;a.dragEndX=b.dragGetX_(c,a);a.dragEndY=b.dragGetY_(c,a);var e=Math
 .abs(a.dragEndX-a.dragStartX);var d=Math.abs(a.dragEndY-a.dragStartY);if(e<2&&d<2&&b.lastx_!==undefined&&b.lastx_!=-1){Dygraph.Interaction.treatMouseOpAsClick(b,c,a)}if(e>=10&&a.dragDirection==Dygraph.HORIZONTAL){b.doZoomX_(Math.min(a.dragStartX,a.dragEndX),Math.max(a.dragStartX,a.dragEndX));a.cancelNextDblclick=true}else{if(d>=10&&a.dragDirection==Dygraph.VERTICAL){b.doZoomY_(Math.min(a.dragStartY,a.dragEndY),Math.max(a.dragStartY,a.dragEndY));a.cancelNextDblclick=true}else{if(a.zoomMoved){b.clearZoomRect_()}}}a.dragStartX=null;a.dragStartY=null};Dygraph.Interaction.startTouch=function(f,e,d){f.preventDefault();var h=[];for(var c=0;c<f.touches.length;c++){var b=f.touches[c];h.push({pageX:b.pageX,pageY:b.pageY,dataX:e.toDataXCoord(b.pageX),dataY:e.toDataYCoord(b.pageY)})}d.initialTouches=h;if(h.length==1){d.initialPinchCenter=h[0];d.touchDirections={x:true,y:true}}else{if(h.length==2){d.initialPinchCenter={pageX:0.5*(h[0].pageX+h[1].pageX),pageY:0.5*(h[0].pageY+h[1].pageY),dataX:0.5
 *(h[0].dataX+h[1].dataX),dataY:0.5*(h[0].dataY+h[1].dataY)};var a=180/Math.PI*Math.atan2(d.initialPinchCenter.pageY-h[0].pageY,h[0].pageX-d.initialPinchCenter.pageX);a=Math.abs(a);if(a>90){a=90-a}d.touchDirections={x:(a<(90-45/2)),y:(a>45/2)}}}d.initialRange={x:e.xAxisRange(),y:e.yAxisRange()}};Dygraph.Interaction.moveTouch=function(b,m,c){var k,l=[];for(k=0;k<b.touches.length;k++){var s=b.touches[k];l.push({pageX:s.pageX,pageY:s.pageY})}var r=c.initialTouches;var o;var a=c.initialPinchCenter;if(l.length==1){o=l[0]}else{o={pageX:0.5*(l[0].pageX+l[1].pageX),pageY:0.5*(l[0].pageY+l[1].pageY)}}var j={pageX:o.pageX-a.pageX,pageY:o.pageY-a.pageY};var f=c.initialRange.x[1]-c.initialRange.x[0];var q=c.initialRange.y[0]-c.initialRange.y[1];j.dataX=(j.pageX/m.plotter_.area.w)*f;j.dataY=(j.pageY/m.plotter_.area.h)*q;var p,d;if(l.length==1){p=1;d=1}else{if(l.length==2){var h=(r[1].pageX-a.pageX);p=(l[1].pageX-o.pageX)/h;var n=(r[1].pageY-a.pageY);d=(l[1].pageY-o.pageY)/n}}p=Math.min(8,Math.max
 (0.125,p));d=Math.min(8,Math.max(0.125,d));if(c.touchDirections.x){m.dateWindow_=[a.dataX-j.dataX+(c.initialRange.x[0]-a.dataX)/p,a.dataX-j.dataX+(c.initialRange.x[1]-a.dataX)/p]}if(c.touchDirections.y){for(k=0;k<1;k++){var e=m.axes_[k];if(e.logscale){}else{e.valueWindow=[a.dataY-j.dataY+(c.initialRange.y[0]-a.dataY)/d,a.dataY-j.dataY+(c.initialRange.y[1]-a.dataY)/d]}}}m.drawGraph_(false)};Dygraph.Interaction.endTouch=function(c,b,a){if(c.touches.length!==0){Dygraph.Interaction.startTouch(c,b,a)}};Dygraph.Interaction.defaultModel={mousedown:function(c,b,a){if(c.button&&c.button==2){return}a.initializeMouseDown(c,b,a);if(c.altKey||c.shiftKey){Dygraph.startPan(c,b,a)}else{Dygraph.startZoom(c,b,a)}},mousemove:function(c,b,a){if(a.isZooming){Dygraph.moveZoom(c,b,a)}else{if(a.isPanning){Dygraph.movePan(c,b,a)}}},mouseup:function(c,b,a){if(a.isZooming){Dygraph.endZoom(c,b,a)}else{if(a.isPanning){Dygraph.endPan(c,b,a)}}},touchstart:function(c,b,a){Dygraph.Interaction.startTouch(c,b,a)},tou
 chmove:function(c,b,a){Dygraph.Interaction.moveTouch(c,b,a)},touchend:function(c,b,a){Dygraph.Interaction.endTouch(c,b,a)},mouseout:function(c,b,a){if(a.isZooming){a.dragEndX=null;a.dragEndY=null}},dblclick:function(c,b,a){if(a.cancelNextDblclick){a.cancelNextDblclick=false;return}if(c.altKey||c.shiftKey){return}b.doUnzoom_()}};Dygraph.DEFAULT_ATTRS.interactionModel=Dygraph.Interaction.defaultModel;Dygraph.defaultInteractionModel=Dygraph.Interaction.defaultModel;Dygraph.endZoom=Dygraph.Interaction.endZoom;Dygraph.moveZoom=Dygraph.Interaction.moveZoom;Dygraph.startZoom=Dygraph.Interaction.startZoom;Dygraph.endPan=Dygraph.Interaction.endPan;Dygraph.movePan=Dygraph.Interaction.movePan;Dygraph.startPan=Dygraph.Interaction.startPan;Dygraph.Interaction.nonInteractiveModel_={mousedown:function(c,b,a){a.initializeMouseDown(c,b,a)},mouseup:function(c,b,a){a.dragEndX=b.dragGetX_(c,a);a.dragEndY=b.dragGetY_(c,a);var e=Math.abs(a.dragEndX-a.dragStartX);var d=Math.abs(a.dragEndY-a.dragStartY);if
 (e<2&&d<2&&b.lastx_!==undefined&&b.lastx_!=-1){Dygraph.Interaction.treatMouseOpAsClick(b,c,a)}}};Dygraph.Interaction.dragIsPanInteractionModel={mousedown:function(c,b,a){a.initializeMouseDown(c,b,a);Dygraph.startPan(c,b,a)},mousemove:function(c,b,a){if(a.isPanning){Dygraph.movePan(c,b,a)}},mouseup:function(c,b,a){if(a.isPanning){Dygraph.endPan(c,b,a)}}};"use strict";var DygraphRangeSelector=function(a){this.isIE_=/MSIE/.test(navigator.userAgent)&&!window.opera;this.isUsingExcanvas_=a.isUsingExcanvas_;this.dygraph_=a;this.hasTouchInterface_=typeof(TouchEvent)!="undefined";this.isMobileDevice_=/mobile|android/gi.test(navigator.appVersion);this.createCanvases_();if(this.isUsingExcanvas_){this.createIEPanOverlay_()}this.createZoomHandles_();this.initInteraction_()};DygraphRangeSelector.prototype.addToGraph=function(a,b){this.layout_=b;this.resize_();a.appendChild(this.bgcanvas_);a.appendChild(this.fgcanvas_);a.appendChild(this.leftZoomHandle_);a.appendChild(this.rightZoomHandle_)};Dygra
 phRangeSelector.prototype.renderStaticLayer=function(){this.resize_();this.drawStaticLayer_()};DygraphRangeSelector.prototype.renderInteractiveLayer=function(){if(this.isChangingRange_){return}this.placeZoomHandles_();this.drawInteractiveLayer_()};DygraphRangeSelector.prototype.resize_=function(){function c(d,e){d.style.top=e.y+"px";d.style.left=e.x+"px";d.width=e.w;d.height=e.h;d.style.width=d.width+"px";d.style.height=d.height+"px"}var b=this.layout_.getPlotArea();var a=this.attr_("xAxisHeight")||(this.attr_("axisLabelFontSize")+2*this.attr_("axisTickSize"));this.canvasRect_={x:b.x,y:b.y+b.h+a+4,w:b.w,h:this.attr_("rangeSelectorHeight")};c(this.bgcanvas_,this.canvasRect_);c(this.fgcanvas_,this.canvasRect_)};DygraphRangeSelector.prototype.attr_=function(a){return this.dygraph_.attr_(a)};DygraphRangeSelector.prototype.createCanvases_=function(){this.bgcanvas_=Dygraph.createCanvas();this.bgcanvas_.className="dygraph-rangesel-bgcanvas";this.bgcanvas_.style.position="absolute";this.bgc
 anvas_.style.zIndex=9;this.bgcanvas_ctx_=Dygraph.getContext(this.bgcanvas_);this.fgcanvas_=Dygraph.createCanvas();this.fgcanvas_.className="dygraph-rangesel-fgcanvas";this.fgcanvas_.style.position="absolute";this.fgcanvas_.style.zIndex=9;this.fgcanvas_.style.cursor="default";this.fgcanvas_ctx_=Dygraph.getContext(this.fgcanvas_)};DygraphRangeSelector.prototype.createIEPanOverlay_=function(){this.iePanOverlay_=document.createElement("div");this.iePanOverlay_.style.position="absolute";this.iePanOverlay_.style.backgroundColor="white";this.iePanOverlay_.style.filter="alpha(opacity=0)";this.iePanOverlay_.style.display="none";this.iePanOverlay_.style.cursor="move";this.fgcanvas_.appendChild(this.iePanOverlay_)};DygraphRangeSelector.prototype.createZoomHandles_=function(){var a=new Image();a.className="dygraph-rangesel-zoomhandle";a.style.position="absolute";a.style.zIndex=10;a.style.visibility="hidden";a.style.cursor="col-resize";if(/MSIE 7/.test(navigator.userAgent)){a.width=7;a.height=14
 ;a.style.backgroundColor="white";a.style.border="1px solid #333333"}else{a.width=9;a.height=16;a.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAQCAYAAADESFVDAAAAAXNSR0IArs4c6QAAAAZiS0dEANAAzwDP4Z7KegAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAAd0SU1FB9sHGw0cMqdt1UwAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAaElEQVQoz+3SsRFAQBCF4Z9WJM8KCDVwownl6YXsTmCUsyKGkZzcl7zkz3YLkypgAnreFmDEpHkIwVOMfpdi9CEEN2nGpFdwD03yEqDtOgCaun7sqSTDH32I1pQA2Pb9sZecAxc5r3IAb21d6878xsAAAAAASUVORK5CYII="}if(this.isMobileDevice_){a.width*=2;a.height*=2}this.leftZoomHandle_=a;this.rightZoomHandle_=a.cloneNode(false)};DygraphRangeSelector.prototype.initInteraction_=function(){var o=this;var h=this.isIE_?document:window;var q=0;var v=null;var t=false;var c=false;var f=!this.isMobileDevice_&&!this.isUsingExcanvas_;var k=new Dygraph.IFrameTarp();var p,e,s,i,w,g,x,u,r,b,n,j;var d,m,l;p=function(C){var B=o.dygraph_.xAxisExtremes();var z=(B[1]-B[0])/o.canvasRect_.w;var A=B[0]+(C.leftHandlePos-o.canvasRect_.x)*z;var
  y=B[0]+(C.rightHandlePos-o.canvasRect_.x)*z;return[A,y]};j=function(z){var y=window.outerWidth/document.documentElement.clientWidth;if(!isNaN(y)){return z/y}else{return z}};e=function(y){Dygraph.cancelEvent(y);t=true;q=y.screenX;v=y.target?y.target:y.srcElement;o.dygraph_.addEvent(h,"mousemove",s);o.dygraph_.addEvent(h,"mouseup",i);o.fgcanvas_.style.cursor="col-resize";k.cover();return true};s=function(C){if(!t){return false}Dygraph.cancelEvent(C);var z=C.screenX-q;if(Math.abs(z)<4||C.screenX===0){return true}q=C.screenX;z=j(z);var B=o.getZoomHandleStatus_();var y;if(v==o.leftZoomHandle_){y=B.leftHandlePos+z;y=Math.min(y,B.rightHandlePos-v.width-3);y=Math.max(y,o.canvasRect_.x)}else{y=B.rightHandlePos+z;y=Math.min(y,o.canvasRect_.x+o.canvasRect_.w);y=Math.max(y,B.leftHandlePos+v.width+3)}var A=v.width/2;v.style.left=(y-A)+"px";o.drawInteractiveLayer_();if(f){w()}return true};i=function(y){if(!t){return false}t=false;k.uncover();Dygraph.removeEvent(h,"mousemove",s);Dygraph.removeEve
 nt(h,"mouseup",i);o.fgcanvas_.style.cursor="default";if(!f){w()}return true};w=function(){try{var z=o.getZoomHandleStatus_();o.isChangingRange_=true;if(!z.isZoomed){o.dygraph_.doUnzoom_()}else{var y=p(z);o.dygraph_.doZoomXDates_(y[0],y[1])}}finally{o.isChangingRange_=false}};g=function(A){if(o.isUsingExcanvas_){return A.srcElement==o.iePanOverlay_}else{var z=o.leftZoomHandle_.getBoundingClientRect();var y=z.left+z.width/2;z=o.rightZoomHandle_.getBoundingClientRect();var B=z.left+z.width/2;return(A.clientX>y&&A.clientX<B)}};x=function(y){if(!c&&g(y)&&o.getZoomHandleStatus_().isZoomed){Dygraph.cancelEvent(y);c=true;q=y.screenX;o.dygraph_.addEvent(h,"mousemove",u);o.dygraph_.addEvent(h,"mouseup",r);return true}return false};u=function(C){if(!c){return false}Dygraph.cancelEvent(C);var z=C.screenX-q;if(Math.abs(z)<4){return true}q=C.screenX;z=j(z);var B=o.getZoomHandleStatus_();var E=B.leftHandlePos;var y=B.rightHandlePos;var D=y-E;if(E+z<=o.canvasRect_.x){E=o.canvasRect_.x;y=E+D}else{if
 (y+z>=o.canvasRect_.x+o.canvasRect_.w){y=o.canvasRect_.x+o.canvasRect_.w;E=y-D}else{E+=z;y+=z}}var A=o.leftZoomHandle_.width/2;o.leftZoomHandle_.style.left=(E-A)+"px";o.rightZoomHandle_.style.left=(y-A)+"px";o.drawInteractiveLayer_();if(f){b()}return true};r=function(y){if(!c){return false}c=false;Dygraph.removeEvent(h,"mousemove",u);Dygraph.removeEvent(h,"mouseup",r);if(!f){b()}return true};b=function(){try{o.isChangingRange_=true;o.dygraph_.dateWindow_=p(o.getZoomHandleStatus_());o.dygraph_.drawGraph_(false)}finally{o.isChangingRange_=false}};n=function(y){if(t||c){return}var z=g(y)?"move":"default";if(z!=o.fgcanvas_.style.cursor){o.fgcanvas_.style.cursor=z}};d=function(y){if(y.type=="touchstart"&&y.targetTouches.length==1){if(e(y.targetTouches[0])){Dygraph.cancelEvent(y)}}else{if(y.type=="touchmove"&&y.targetTouches.length==1){if(s(y.targetTouches[0])){Dygraph.cancelEvent(y)}}else{i(y)}}};m=function(y){if(y.type=="touchstart"&&y.targetTouches.length==1){if(x(y.targetTouches[0])){
 Dygraph.cancelEvent(y)}}else{if(y.type=="touchmove"&&y.targetTouches.length==1){if(u(y.targetTouches[0])){Dygraph.cancelEvent(y)}}else{r(y)}}};l=function(B,A){var z=["touchstart","touchend","touchmove","touchcancel"];for(var y=0;y<z.length;y++){o.dygraph_.addEvent(B,z[y],A)}};this.dygraph_.attrs_.interactionModel=Dygraph.Interaction.dragIsPanInteractionModel;this.dygraph_.attrs_.panEdgeFraction=0.0001;var a=window.opera?"mousedown":"dragstart";this.dygraph_.addEvent(this.leftZoomHandle_,a,e);this.dygraph_.addEvent(this.rightZoomHandle_,a,e);if(this.isUsingExcanvas_){this.dygraph_.addEvent(this.iePanOverlay_,"mousedown",x)}else{this.dygraph_.addEvent(this.fgcanvas_,"mousedown",x);this.dygraph_.addEvent(this.fgcanvas_,"mousemove",n)}if(this.hasTouchInterface_){l(this.leftZoomHandle_,d);l(this.rightZoomHandle_,d);l(this.fgcanvas_,m)}};DygraphRangeSelector.prototype.drawStaticLayer_=function(){var a=this.bgcanvas_ctx_;a.clearRect(0,0,this.canvasRect_.w,this.canvasRect_.h);try{this.drawM
 iniPlot_()}catch(b){Dygraph.warn(b)}var c=0.5;this.bgcanvas_ctx_.lineWidth=1;a.strokeStyle="gray";a.beginPath();a.moveTo(c,c);a.lineTo(c,this.canvasRect_.h-c);a.lineTo(this.canvasRect_.w-c,this.canvasRect_.h-c);a.lineTo(this.canvasRect_.w-c,c);a.stroke()};DygraphRangeSelector.prototype.drawMiniPlot_=function(){var p=this.attr_("rangeSelectorPlotFillColor");var l=this.attr_("rangeSelectorPlotStrokeColor");if(!p&&!l){return}var m=this.computeCombinedSeriesAndLimits_();var e=m.yMax-m.yMin;var r=this.bgcanvas_ctx_;var f=0.5;var j=this.dygraph_.xAxisExtremes();var b=Math.max(j[1]-j[0],1e-30);var q=(this.canvasRect_.w-f)/b;var o=(this.canvasRect_.h-f)/e;var d=this.canvasRect_.w-f;var h=this.canvasRect_.h-f;r.beginPath();r.moveTo(f,h);for(var g=0;g<m.data.length;g++){var a=m.data[g];var n=(a[0]-j[0])*q;var k=h-(a[1]-m.yMin)*o;if(isFinite(n)&&isFinite(k)){r.lineTo(n,k)}}r.lineTo(d,h);r.closePath();if(p){var c=this.bgcanvas_ctx_.createLinearGradient(0,0,0,h);c.addColorStop(0,"white");c.addCo
 lorStop(1,p);this.bgcanvas_ctx_.fillStyle=c;r.fill()}if(l){this.bgcanvas_ctx_.strokeStyle=l;this.bgcanvas_ctx_.lineWidth=1.5;r.stroke()}};DygraphRangeSelector.prototype.computeCombinedSeriesAndLimits_=function(){var u=this.dygraph_.rawData_;var t=this.attr_("logscale");var p=[];var c;var g;var l;var s,r,q;var d,f;for(s=0;s<u.length;s++){if(u[s].length>1&&u[s][1]!==null){l=typeof u[s][1]!="number";if(l){c=[];g=[];for(q=0;q<u[s][1].length;q++){c.push(0);g.push(0)}}break}}for(s=0;s<u.length;s++){var h=u[s];d=h[0];if(l){for(q=0;q<c.length;q++){c[q

<TRUNCATED>

[10/21] aurora git commit: Remove unused classes from commons fork.

Posted by wf...@apache.org.
http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/resources/org/apache/aurora/common/common/webassets/bootstrap/2.1.1/css/bootstrap.min.css
----------------------------------------------------------------------
diff --git a/commons/src/main/resources/org/apache/aurora/common/common/webassets/bootstrap/2.1.1/css/bootstrap.min.css b/commons/src/main/resources/org/apache/aurora/common/common/webassets/bootstrap/2.1.1/css/bootstrap.min.css
deleted file mode 100644
index cf02782..0000000
--- a/commons/src/main/resources/org/apache/aurora/common/common/webassets/bootstrap/2.1.1/css/bootstrap.min.css
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- */article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block}audio,canvas,video{display:inline-block;*display:inline;*zoom:1}audio:not([controls]){display:none}html{font-size:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}a:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}a:hover,a:active{outline:0}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{width:auto\9;height:auto;max-width:100%;vertical-align:middle;border:0;-ms-interpolation-mode:bicubic}#map_canvas img{max-width:none}button,input,select,textarea{margin:0;font-size:100%;vertical-align:middle}button,input{*overflow:visible;line-height:normal}button::-moz-focus-inner,input::-moz-focus-inner{padding:0;border:0}button,input[type="button"],input[type="reset"],input[type="submit"]{cursor:pointer;-webkit-appearance:button}input[type="search"]{-webkit-box-sizing:content-box;-moz-b
 ox-sizing:content-box;box-sizing:content-box;-webkit-appearance:textfield}input[type="search"]::-webkit-search-decoration,input[type="search"]::-webkit-search-cancel-button{-webkit-appearance:none}textarea{overflow:auto;vertical-align:top}.clearfix{*zoom:1}.clearfix:before,.clearfix:after{display:table;line-height:0;content:""}.clearfix:after{clear:both}.hide-text{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.input-block-level{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}body{margin:0;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;line-height:20px;color:#333;background-color:#fff}a{color:#08c;text-decoration:none}a:hover{color:#005580;text-decoration:underline}.img-rounded{-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px}.img-polaroid{padding:4px;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.2);-webkit
 -box-shadow:0 1px 3px rgba(0,0,0,0.1);-moz-box-shadow:0 1px 3px rgba(0,0,0,0.1);box-shadow:0 1px 3px rgba(0,0,0,0.1)}.img-circle{-webkit-border-radius:500px;-moz-border-radius:500px;border-radius:500px}.row{margin-left:-20px;*zoom:1}.row:before,.row:after{display:table;line-height:0;content:""}.row:after{clear:both}[class*="span"]{float:left;min-height:1px;margin-left:20px}.container,.navbar-static-top .container,.navbar-fixed-top .container,.navbar-fixed-bottom .container{width:940px}.span12{width:940px}.span11{width:860px}.span10{width:780px}.span9{width:700px}.span8{width:620px}.span7{width:540px}.span6{width:460px}.span5{width:380px}.span4{width:300px}.span3{width:220px}.span2{width:140px}.span1{width:60px}.offset12{margin-left:980px}.offset11{margin-left:900px}.offset10{margin-left:820px}.offset9{margin-left:740px}.offset8{margin-left:660px}.offset7{margin-left:580px}.offset6{margin-left:500px}.offset5{margin-left:420px}.offset4{margin-left:340px}.offset3{margin-left:260px}.off
 set2{margin-left:180px}.offset1{margin-left:100px}.row-fluid{width:100%;*zoom:1}.row-fluid:before,.row-fluid:after{display:table;line-height:0;content:""}.row-fluid:after{clear:both}.row-fluid [class*="span"]{display:block;float:left;width:100%;min-height:30px;margin-left:2.127659574468085%;*margin-left:2.074468085106383%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.row-fluid [class*="span"]:first-child{margin-left:0}.row-fluid .span12{width:100%;*width:99.94680851063829%}.row-fluid .span11{width:91.48936170212765%;*width:91.43617021276594%}.row-fluid .span10{width:82.97872340425532%;*width:82.92553191489361%}.row-fluid .span9{width:74.46808510638297%;*width:74.41489361702126%}.row-fluid .span8{width:65.95744680851064%;*width:65.90425531914893%}.row-fluid .span7{width:57.44680851063829%;*width:57.39361702127659%}.row-fluid .span6{width:48.93617021276595%;*width:48.88297872340425%}.row-fluid .span5{width:40.42553191489362%;*width:40.37234042553192%}
 .row-fluid .span4{width:31.914893617021278%;*width:31.861702127659576%}.row-fluid .span3{width:23.404255319148934%;*width:23.351063829787233%}.row-fluid .span2{width:14.893617021276595%;*width:14.840425531914894%}.row-fluid .span1{width:6.382978723404255%;*width:6.329787234042553%}.row-fluid .offset12{margin-left:104.25531914893617%;*margin-left:104.14893617021275%}.row-fluid .offset12:first-child{margin-left:102.12765957446808%;*margin-left:102.02127659574467%}.row-fluid .offset11{margin-left:95.74468085106382%;*margin-left:95.6382978723404%}.row-fluid .offset11:first-child{margin-left:93.61702127659574%;*margin-left:93.51063829787232%}.row-fluid .offset10{margin-left:87.23404255319149%;*margin-left:87.12765957446807%}.row-fluid .offset10:first-child{margin-left:85.1063829787234%;*margin-left:84.99999999999999%}.row-fluid .offset9{margin-left:78.72340425531914%;*margin-left:78.61702127659572%}.row-fluid .offset9:first-child{margin-left:76.59574468085106%;*margin-left:76.48936170212
 764%}.row-fluid .offset8{margin-left:70.2127659574468%;*margin-left:70.10638297872339%}.row-fluid .offset8:first-child{margin-left:68.08510638297872%;*margin-left:67.9787234042553%}.row-fluid .offset7{margin-left:61.70212765957446%;*margin-left:61.59574468085106%}.row-fluid .offset7:first-child{margin-left:59.574468085106375%;*margin-left:59.46808510638297%}.row-fluid .offset6{margin-left:53.191489361702125%;*margin-left:53.085106382978715%}.row-fluid .offset6:first-child{margin-left:51.063829787234035%;*margin-left:50.95744680851063%}.row-fluid .offset5{margin-left:44.68085106382979%;*margin-left:44.57446808510638%}.row-fluid .offset5:first-child{margin-left:42.5531914893617%;*margin-left:42.4468085106383%}.row-fluid .offset4{margin-left:36.170212765957444%;*margin-left:36.06382978723405%}.row-fluid .offset4:first-child{margin-left:34.04255319148936%;*margin-left:33.93617021276596%}.row-fluid .offset3{margin-left:27.659574468085104%;*margin-left:27.5531914893617%}.row-fluid .offset
 3:first-child{margin-left:25.53191489361702%;*margin-left:25.425531914893618%}.row-fluid .offset2{margin-left:19.148936170212764%;*margin-left:19.04255319148936%}.row-fluid .offset2:first-child{margin-left:17.02127659574468%;*margin-left:16.914893617021278%}.row-fluid .offset1{margin-left:10.638297872340425%;*margin-left:10.53191489361702%}.row-fluid .offset1:first-child{margin-left:8.51063829787234%;*margin-left:8.404255319148938%}[class*="span"].hide,.row-fluid [class*="span"].hide{display:none}[class*="span"].pull-right,.row-fluid [class*="span"].pull-right{float:right}.container{margin-right:auto;margin-left:auto;*zoom:1}.container:before,.container:after{display:table;line-height:0;content:""}.container:after{clear:both}.container-fluid{padding-right:20px;padding-left:20px;*zoom:1}.container-fluid:before,.container-fluid:after{display:table;line-height:0;content:""}.container-fluid:after{clear:both}p{margin:0 0 10px}.lead{margin-bottom:20px;font-size:21px;font-weight:200;line-h
 eight:30px}small{font-size:85%}strong{font-weight:bold}em{font-style:italic}cite{font-style:normal}.muted{color:#999}.text-warning{color:#c09853}.text-error{color:#b94a48}.text-info{color:#3a87ad}.text-success{color:#468847}h1,h2,h3,h4,h5,h6{margin:10px 0;font-family:inherit;font-weight:bold;line-height:1;color:inherit;text-rendering:optimizelegibility}h1 small,h2 small,h3 small,h4 small,h5 small,h6 small{font-weight:normal;line-height:1;color:#999}h1{font-size:36px;line-height:40px}h2{font-size:30px;line-height:40px}h3{font-size:24px;line-height:40px}h4{font-size:18px;line-height:20px}h5{font-size:14px;line-height:20px}h6{font-size:12px;line-height:20px}h1 small{font-size:24px}h2 small{font-size:18px}h3 small{font-size:14px}h4 small{font-size:14px}.page-header{padding-bottom:9px;margin:20px 0 30px;border-bottom:1px solid #eee}ul,ol{padding:0;margin:0 0 10px 25px}ul ul,ul ol,ol ol,ol ul{margin-bottom:0}li{line-height:20px}ul.unstyled,ol.unstyled{margin-left:0;list-style:none}dl{marg
 in-bottom:20px}dt,dd{line-height:20px}dt{font-weight:bold}dd{margin-left:10px}.dl-horizontal{*zoom:1}.dl-horizontal:before,.dl-horizontal:after{display:table;line-height:0;content:""}.dl-horizontal:after{clear:both}.dl-horizontal dt{float:left;width:160px;overflow:hidden;clear:left;text-align:right;text-overflow:ellipsis;white-space:nowrap}.dl-horizontal dd{margin-left:180px}hr{margin:20px 0;border:0;border-top:1px solid #eee;border-bottom:1px solid #fff}abbr[title]{cursor:help;border-bottom:1px dotted #999}abbr.initialism{font-size:90%;text-transform:uppercase}blockquote{padding:0 0 0 15px;margin:0 0 20px;border-left:5px solid #eee}blockquote p{margin-bottom:0;font-size:16px;font-weight:300;line-height:25px}blockquote small{display:block;line-height:20px;color:#999}blockquote small:before{content:'\2014 \00A0'}blockquote.pull-right{float:right;padding-right:15px;padding-left:0;border-right:5px solid #eee;border-left:0}blockquote.pull-right p,blockquote.pull-right small{text-align:r
 ight}blockquote.pull-right small:before{content:''}blockquote.pull-right small:after{content:'\00A0 \2014'}q:before,q:after,blockquote:before,blockquote:after{content:""}address{display:block;margin-bottom:20px;font-style:normal;line-height:20px}code,pre{padding:0 3px 2px;font-family:Monaco,Menlo,Consolas,"Courier New",monospace;font-size:12px;color:#333;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}code{padding:2px 4px;color:#d14;background-color:#f7f7f9;border:1px solid #e1e1e8}pre{display:block;padding:9.5px;margin:0 0 10px;font-size:13px;line-height:20px;word-break:break-all;word-wrap:break-word;white-space:pre;white-space:pre-wrap;background-color:#f5f5f5;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.15);-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}pre.prettyprint{margin-bottom:20px}pre code{padding:0;color:inherit;background-color:transparent;border:0}.pre-scrollable{max-height:340px;overflow-y:scroll}form{margin:0 0 20px}fields
 et{padding:0;margin:0;border:0}legend{display:block;width:100%;padding:0;margin-bottom:20px;font-size:21px;line-height:40px;color:#333;border:0;border-bottom:1px solid #e5e5e5}legend small{font-size:15px;color:#999}label,input,button,select,textarea{font-size:14px;font-weight:normal;line-height:20px}input,button,select,textarea{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif}label{display:block;margin-bottom:5px}select,textarea,input[type="text"],input[type="password"],input[type="datetime"],input[type="datetime-local"],input[type="date"],input[type="month"],input[type="time"],input[type="week"],input[type="number"],input[type="email"],input[type="url"],input[type="search"],input[type="tel"],input[type="color"],.uneditable-input{display:inline-block;height:20px;padding:4px 6px;margin-bottom:9px;font-size:14px;line-height:20px;color:#555;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}input,textarea,.uneditable-input{width:206px}textarea{height:auto}textare
 a,input[type="text"],input[type="password"],input[type="datetime"],input[type="datetime-local"],input[type="date"],input[type="month"],input[type="time"],input[type="week"],input[type="number"],input[type="email"],input[type="url"],input[type="search"],input[type="tel"],input[type="color"],.uneditable-input{background-color:#fff;border:1px solid #ccc;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-webkit-transition:border linear .2s,box-shadow linear .2s;-moz-transition:border linear .2s,box-shadow linear .2s;-o-transition:border linear .2s,box-shadow linear .2s;transition:border linear .2s,box-shadow linear .2s}textarea:focus,input[type="text"]:focus,input[type="password"]:focus,input[type="datetime"]:focus,input[type="datetime-local"]:focus,input[type="date"]:focus,input[type="month"]:focus,input[type="time"]:focus,input[type="week"]:focus,input[type="number"]:focus,input[type="ema
 il"]:focus,input[type="url"]:focus,input[type="search"]:focus,input[type="tel"]:focus,input[type="color"]:focus,.uneditable-input:focus{border-color:rgba(82,168,236,0.8);outline:0;outline:thin dotted \9;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(82,168,236,0.6);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(82,168,236,0.6);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(82,168,236,0.6)}input[type="radio"],input[type="checkbox"]{margin:4px 0 0;margin-top:1px \9;*margin-top:0;line-height:normal;cursor:pointer}input[type="file"],input[type="image"],input[type="submit"],input[type="reset"],input[type="button"],input[type="radio"],input[type="checkbox"]{width:auto}select,input[type="file"]{height:30px;*margin-top:4px;line-height:30px}select{width:220px;background-color:#fff;border:1px solid #ccc}select[multiple],select[size]{height:auto}select:focus,input[type="file"]:focus,input[type="radio"]:focus,input[type="checkbox"]:focus{outline:thi
 n dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.uneditable-input,.uneditable-textarea{color:#999;cursor:not-allowed;background-color:#fcfcfc;border-color:#ccc;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.025);-moz-box-shadow:inset 0 1px 2px rgba(0,0,0,0.025);box-shadow:inset 0 1px 2px rgba(0,0,0,0.025)}.uneditable-input{overflow:hidden;white-space:nowrap}.uneditable-textarea{width:auto;height:auto}input:-moz-placeholder,textarea:-moz-placeholder{color:#999}input:-ms-input-placeholder,textarea:-ms-input-placeholder{color:#999}input::-webkit-input-placeholder,textarea::-webkit-input-placeholder{color:#999}.radio,.checkbox{min-height:18px;padding-left:18px}.radio input[type="radio"],.checkbox input[type="checkbox"]{float:left;margin-left:-18px}.controls>.radio:first-child,.controls>.checkbox:first-child{padding-top:5px}.radio.inline,.checkbox.inline{display:inline-block;padding-top:5px;margin-bottom:0;vertical-align:middle}.radio.inline+.radio.inline,.ch
 eckbox.inline+.checkbox.inline{margin-left:10px}.input-mini{width:60px}.input-small{width:90px}.input-medium{width:150px}.input-large{width:210px}.input-xlarge{width:270px}.input-xxlarge{width:530px}input[class*="span"],select[class*="span"],textarea[class*="span"],.uneditable-input[class*="span"],.row-fluid input[class*="span"],.row-fluid select[class*="span"],.row-fluid textarea[class*="span"],.row-fluid .uneditable-input[class*="span"]{float:none;margin-left:0}.input-append input[class*="span"],.input-append .uneditable-input[class*="span"],.input-prepend input[class*="span"],.input-prepend .uneditable-input[class*="span"],.row-fluid input[class*="span"],.row-fluid select[class*="span"],.row-fluid textarea[class*="span"],.row-fluid .uneditable-input[class*="span"],.row-fluid .input-prepend [class*="span"],.row-fluid .input-append [class*="span"]{display:inline-block}input,textarea,.uneditable-input{margin-left:0}.controls-row [class*="span"]+[class*="span"]{margin-left:20px}input
 .span12,textarea.span12,.uneditable-input.span12{width:926px}input.span11,textarea.span11,.uneditable-input.span11{width:846px}input.span10,textarea.span10,.uneditable-input.span10{width:766px}input.span9,textarea.span9,.uneditable-input.span9{width:686px}input.span8,textarea.span8,.uneditable-input.span8{width:606px}input.span7,textarea.span7,.uneditable-input.span7{width:526px}input.span6,textarea.span6,.uneditable-input.span6{width:446px}input.span5,textarea.span5,.uneditable-input.span5{width:366px}input.span4,textarea.span4,.uneditable-input.span4{width:286px}input.span3,textarea.span3,.uneditable-input.span3{width:206px}input.span2,textarea.span2,.uneditable-input.span2{width:126px}input.span1,textarea.span1,.uneditable-input.span1{width:46px}.controls-row{*zoom:1}.controls-row:before,.controls-row:after{display:table;line-height:0;content:""}.controls-row:after{clear:both}.controls-row [class*="span"]{float:left}input[disabled],select[disabled],textarea[disabled],input[readon
 ly],select[readonly],textarea[readonly]{cursor:not-allowed;background-color:#eee}input[type="radio"][disabled],input[type="checkbox"][disabled],input[type="radio"][readonly],input[type="checkbox"][readonly]{background-color:transparent}.control-group.warning>label,.control-group.warning .help-block,.control-group.warning .help-inline{color:#c09853}.control-group.warning .checkbox,.control-group.warning .radio,.control-group.warning input,.control-group.warning select,.control-group.warning textarea{color:#c09853}.control-group.warning input,.control-group.warning select,.control-group.warning textarea{border-color:#c09853;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.control-group.warning input:focus,.control-group.warning select:focus,.control-group.warning textarea:focus{border-color:#a47e3c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #dbc59e;-moz-box-shadow:inse
 t 0 1px 1px rgba(0,0,0,0.075),0 0 6px #dbc59e;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #dbc59e}.control-group.warning .input-prepend .add-on,.control-group.warning .input-append .add-on{color:#c09853;background-color:#fcf8e3;border-color:#c09853}.control-group.error>label,.control-group.error .help-block,.control-group.error .help-inline{color:#b94a48}.control-group.error .checkbox,.control-group.error .radio,.control-group.error input,.control-group.error select,.control-group.error textarea{color:#b94a48}.control-group.error input,.control-group.error select,.control-group.error textarea{border-color:#b94a48;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.control-group.error input:focus,.control-group.error select:focus,.control-group.error textarea:focus{border-color:#953b39;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #d59392;-moz-box-shadow:inset 0 1p
 x 1px rgba(0,0,0,0.075),0 0 6px #d59392;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #d59392}.control-group.error .input-prepend .add-on,.control-group.error .input-append .add-on{color:#b94a48;background-color:#f2dede;border-color:#b94a48}.control-group.success>label,.control-group.success .help-block,.control-group.success .help-inline{color:#468847}.control-group.success .checkbox,.control-group.success .radio,.control-group.success input,.control-group.success select,.control-group.success textarea{color:#468847}.control-group.success input,.control-group.success select,.control-group.success textarea{border-color:#468847;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.control-group.success input:focus,.control-group.success select:focus,.control-group.success textarea:focus{border-color:#356635;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7aba7b;-moz-box
 -shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7aba7b;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7aba7b}.control-group.success .input-prepend .add-on,.control-group.success .input-append .add-on{color:#468847;background-color:#dff0d8;border-color:#468847}.control-group.info>label,.control-group.info .help-block,.control-group.info .help-inline{color:#3a87ad}.control-group.info .checkbox,.control-group.info .radio,.control-group.info input,.control-group.info select,.control-group.info textarea{color:#3a87ad}.control-group.info input,.control-group.info select,.control-group.info textarea{border-color:#3a87ad;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.control-group.info input:focus,.control-group.info select:focus,.control-group.info textarea:focus{border-color:#2d6987;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7ab5d3;-moz-box-shadow:inset 0 1px 
 1px rgba(0,0,0,0.075),0 0 6px #7ab5d3;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7ab5d3}.control-group.info .input-prepend .add-on,.control-group.info .input-append .add-on{color:#3a87ad;background-color:#d9edf7;border-color:#3a87ad}input:focus:required:invalid,textarea:focus:required:invalid,select:focus:required:invalid{color:#b94a48;border-color:#ee5f5b}input:focus:required:invalid:focus,textarea:focus:required:invalid:focus,select:focus:required:invalid:focus{border-color:#e9322d;-webkit-box-shadow:0 0 6px #f8b9b7;-moz-box-shadow:0 0 6px #f8b9b7;box-shadow:0 0 6px #f8b9b7}.form-actions{padding:19px 20px 20px;margin-top:20px;margin-bottom:20px;background-color:#f5f5f5;border-top:1px solid #e5e5e5;*zoom:1}.form-actions:before,.form-actions:after{display:table;line-height:0;content:""}.form-actions:after{clear:both}.help-block,.help-inline{color:#595959}.help-block{display:block;margin-bottom:10px}.help-inline{display:inline-block;*display:inline;padding-left:5px;vertica
 l-align:middle;*zoom:1}.input-append,.input-prepend{margin-bottom:5px;font-size:0;white-space:nowrap}.input-append input,.input-prepend input,.input-append select,.input-prepend select,.input-append .uneditable-input,.input-prepend .uneditable-input{position:relative;margin-bottom:0;*margin-left:0;font-size:14px;vertical-align:top;-webkit-border-radius:0 3px 3px 0;-moz-border-radius:0 3px 3px 0;border-radius:0 3px 3px 0}.input-append input:focus,.input-prepend input:focus,.input-append select:focus,.input-prepend select:focus,.input-append .uneditable-input:focus,.input-prepend .uneditable-input:focus{z-index:2}.input-append .add-on,.input-prepend .add-on{display:inline-block;width:auto;height:20px;min-width:16px;padding:4px 5px;font-size:14px;font-weight:normal;line-height:20px;text-align:center;text-shadow:0 1px 0 #fff;background-color:#eee;border:1px solid #ccc}.input-append .add-on,.input-prepend .add-on,.input-append .btn,.input-prepend .btn{vertical-align:top;-webkit-border-ra
 dius:0;-moz-border-radius:0;border-radius:0}.input-append .active,.input-prepend .active{background-color:#a9dba9;border-color:#46a546}.input-prepend .add-on,.input-prepend .btn{margin-right:-1px}.input-prepend .add-on:first-child,.input-prepend .btn:first-child{-webkit-border-radius:3px 0 0 3px;-moz-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px}.input-append input,.input-append select,.input-append .uneditable-input{-webkit-border-radius:3px 0 0 3px;-moz-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px}.input-append .add-on,.input-append .btn{margin-left:-1px}.input-append .add-on:last-child,.input-append .btn:last-child{-webkit-border-radius:0 3px 3px 0;-moz-border-radius:0 3px 3px 0;border-radius:0 3px 3px 0}.input-prepend.input-append input,.input-prepend.input-append select,.input-prepend.input-append .uneditable-input{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.input-prepend.input-append .add-on:first-child,.input-prepend.input-append .btn:first-chil
 d{margin-right:-1px;-webkit-border-radius:3px 0 0 3px;-moz-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px}.input-prepend.input-append .add-on:last-child,.input-prepend.input-append .btn:last-child{margin-left:-1px;-webkit-border-radius:0 3px 3px 0;-moz-border-radius:0 3px 3px 0;border-radius:0 3px 3px 0}input.search-query{padding-right:14px;padding-right:4px \9;padding-left:14px;padding-left:4px \9;margin-bottom:0;-webkit-border-radius:15px;-moz-border-radius:15px;border-radius:15px}.form-search .input-append .search-query,.form-search .input-prepend .search-query{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.form-search .input-append .search-query{-webkit-border-radius:14px 0 0 14px;-moz-border-radius:14px 0 0 14px;border-radius:14px 0 0 14px}.form-search .input-append .btn{-webkit-border-radius:0 14px 14px 0;-moz-border-radius:0 14px 14px 0;border-radius:0 14px 14px 0}.form-search .input-prepend .search-query{-webkit-border-radius:0 14px 14px 0;-moz-border-rad
 ius:0 14px 14px 0;border-radius:0 14px 14px 0}.form-search .input-prepend .btn{-webkit-border-radius:14px 0 0 14px;-moz-border-radius:14px 0 0 14px;border-radius:14px 0 0 14px}.form-search input,.form-inline input,.form-horizontal input,.form-search textarea,.form-inline textarea,.form-horizontal textarea,.form-search select,.form-inline select,.form-horizontal select,.form-search .help-inline,.form-inline .help-inline,.form-horizontal .help-inline,.form-search .uneditable-input,.form-inline .uneditable-input,.form-horizontal .uneditable-input,.form-search .input-prepend,.form-inline .input-prepend,.form-horizontal .input-prepend,.form-search .input-append,.form-inline .input-append,.form-horizontal .input-append{display:inline-block;*display:inline;margin-bottom:0;vertical-align:middle;*zoom:1}.form-search .hide,.form-inline .hide,.form-horizontal .hide{display:none}.form-search label,.form-inline label,.form-search .btn-group,.form-inline .btn-group{display:inline-block}.form-sear
 ch .input-append,.form-inline .input-append,.form-search .input-prepend,.form-inline .input-prepend{margin-bottom:0}.form-search .radio,.form-search .checkbox,.form-inline .radio,.form-inline .checkbox{padding-left:0;margin-bottom:0;vertical-align:middle}.form-search .radio input[type="radio"],.form-search .checkbox input[type="checkbox"],.form-inline .radio input[type="radio"],.form-inline .checkbox input[type="checkbox"]{float:left;margin-right:3px;margin-left:0}.control-group{margin-bottom:10px}legend+.control-group{margin-top:20px;-webkit-margin-top-collapse:separate}.form-horizontal .control-group{margin-bottom:20px;*zoom:1}.form-horizontal .control-group:before,.form-horizontal .control-group:after{display:table;line-height:0;content:""}.form-horizontal .control-group:after{clear:both}.form-horizontal .control-label{float:left;width:160px;padding-top:5px;text-align:right}.form-horizontal .controls{*display:inline-block;*padding-left:20px;margin-left:180px;*margin-left:0}.form-
 horizontal .controls:first-child{*padding-left:180px}.form-horizontal .help-block{margin-bottom:0}.form-horizontal input+.help-block,.form-horizontal select+.help-block,.form-horizontal textarea+.help-block{margin-top:10px}.form-horizontal .form-actions{padding-left:180px}table{max-width:100%;background-color:transparent;border-collapse:collapse;border-spacing:0}.table{width:100%;margin-bottom:20px}.table th,.table td{padding:8px;line-height:20px;text-align:left;vertical-align:top;border-top:1px solid #ddd}.table th{font-weight:bold}.table thead th{vertical-align:bottom}.table caption+thead tr:first-child th,.table caption+thead tr:first-child td,.table colgroup+thead tr:first-child th,.table colgroup+thead tr:first-child td,.table thead:first-child tr:first-child th,.table thead:first-child tr:first-child td{border-top:0}.table tbody+tbody{border-top:2px solid #ddd}.table-condensed th,.table-condensed td{padding:4px 5px}.table-bordered{border:1px solid #ddd;border-collapse:separate
 ;*border-collapse:collapse;border-left:0;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.table-bordered th,.table-bordered td{border-left:1px solid #ddd}.table-bordered caption+thead tr:first-child th,.table-bordered caption+tbody tr:first-child th,.table-bordered caption+tbody tr:first-child td,.table-bordered colgroup+thead tr:first-child th,.table-bordered colgroup+tbody tr:first-child th,.table-bordered colgroup+tbody tr:first-child td,.table-bordered thead:first-child tr:first-child th,.table-bordered tbody:first-child tr:first-child th,.table-bordered tbody:first-child tr:first-child td{border-top:0}.table-bordered thead:first-child tr:first-child th:first-child,.table-bordered tbody:first-child tr:first-child td:first-child{-webkit-border-top-left-radius:4px;border-top-left-radius:4px;-moz-border-radius-topleft:4px}.table-bordered thead:first-child tr:first-child th:last-child,.table-bordered tbody:first-child tr:first-child td:last-child{-webkit-border-to
 p-right-radius:4px;border-top-right-radius:4px;-moz-border-radius-topright:4px}.table-bordered thead:last-child tr:last-child th:first-child,.table-bordered tbody:last-child tr:last-child td:first-child,.table-bordered tfoot:last-child tr:last-child td:first-child{-webkit-border-radius:0 0 0 4px;-moz-border-radius:0 0 0 4px;border-radius:0 0 0 4px;-webkit-border-bottom-left-radius:4px;border-bottom-left-radius:4px;-moz-border-radius-bottomleft:4px}.table-bordered thead:last-child tr:last-child th:last-child,.table-bordered tbody:last-child tr:last-child td:last-child,.table-bordered tfoot:last-child tr:last-child td:last-child{-webkit-border-bottom-right-radius:4px;border-bottom-right-radius:4px;-moz-border-radius-bottomright:4px}.table-bordered caption+thead tr:first-child th:first-child,.table-bordered caption+tbody tr:first-child td:first-child,.table-bordered colgroup+thead tr:first-child th:first-child,.table-bordered colgroup+tbody tr:first-child td:first-child{-webkit-border-
 top-left-radius:4px;border-top-left-radius:4px;-moz-border-radius-topleft:4px}.table-bordered caption+thead tr:first-child th:last-child,.table-bordered caption+tbody tr:first-child td:last-child,.table-bordered colgroup+thead tr:first-child th:last-child,.table-bordered colgroup+tbody tr:first-child td:last-child{-webkit-border-top-right-radius:4px;border-top-right-radius:4px;-moz-border-radius-topleft:4px}.table-striped tbody tr:nth-child(odd) td,.table-striped tbody tr:nth-child(odd) th{background-color:#f9f9f9}.table-hover tbody tr:hover td,.table-hover tbody tr:hover th{background-color:#f5f5f5}table [class*=span],.row-fluid table [class*=span]{display:table-cell;float:none;margin-left:0}.table .span1{float:none;width:44px;margin-left:0}.table .span2{float:none;width:124px;margin-left:0}.table .span3{float:none;width:204px;margin-left:0}.table .span4{float:none;width:284px;margin-left:0}.table .span5{float:none;width:364px;margin-left:0}.table .span6{float:none;width:444px;marg
 in-left:0}.table .span7{float:none;width:524px;margin-left:0}.table .span8{float:none;width:604px;margin-left:0}.table .span9{float:none;width:684px;margin-left:0}.table .span10{float:none;width:764px;margin-left:0}.table .span11{float:none;width:844px;margin-left:0}.table .span12{float:none;width:924px;margin-left:0}.table .span13{float:none;width:1004px;margin-left:0}.table .span14{float:none;width:1084px;margin-left:0}.table .span15{float:none;width:1164px;margin-left:0}.table .span16{float:none;width:1244px;margin-left:0}.table .span17{float:none;width:1324px;margin-left:0}.table .span18{float:none;width:1404px;margin-left:0}.table .span19{float:none;width:1484px;margin-left:0}.table .span20{float:none;width:1564px;margin-left:0}.table .span21{float:none;width:1644px;margin-left:0}.table .span22{float:none;width:1724px;margin-left:0}.table .span23{float:none;width:1804px;margin-left:0}.table .span24{float:none;width:1884px;margin-left:0}.table tbody tr.success td{background-colo
 r:#dff0d8}.table tbody tr.error td{background-color:#f2dede}.table tbody tr.warning td{background-color:#fcf8e3}.table tbody tr.info td{background-color:#d9edf7}.table-hover tbody tr.success:hover td{background-color:#d0e9c6}.table-hover tbody tr.error:hover td{background-color:#ebcccc}.table-hover tbody tr.warning:hover td{background-color:#faf2cc}.table-hover tbody tr.info:hover td{background-color:#c4e3f3}[class^="icon-"],[class*=" icon-"]{display:inline-block;width:14px;height:14px;margin-top:1px;*margin-right:.3em;line-height:14px;vertical-align:text-top;background-image:url("../img/glyphicons-halflings.png");background-position:14px 14px;background-repeat:no-repeat}.icon-white,.nav-tabs>.active>a>[class^="icon-"],.nav-tabs>.active>a>[class*=" icon-"],.nav-pills>.active>a>[class^="icon-"],.nav-pills>.active>a>[class*=" icon-"],.nav-list>.active>a>[class^="icon-"],.nav-list>.active>a>[class*=" icon-"],.navbar-inverse .nav>.active>a>[class^="icon-"],.navbar-inverse .nav>.active>a
 >[class*=" icon-"],.dropdown-menu>li>a:hover>[class^="icon-"],.dropdown-menu>li>a:hover>[class*=" icon-"],.dropdown-menu>.active>a>[class^="icon-"],.dropdown-menu>.active>a>[class*=" icon-"]{background-image:url("../img/glyphicons-halflings-white.png")}.icon-glass{background-position:0 0}.icon-music{background-position:-24px 0}.icon-search{background-position:-48px 0}.icon-envelope{background-position:-72px 0}.icon-heart{background-position:-96px 0}.icon-star{background-position:-120px 0}.icon-star-empty{background-position:-144px 0}.icon-user{background-position:-168px 0}.icon-film{background-position:-192px 0}.icon-th-large{background-position:-216px 0}.icon-th{background-position:-240px 0}.icon-th-list{background-position:-264px 0}.icon-ok{background-position:-288px 0}.icon-remove{background-position:-312px 0}.icon-zoom-in{background-position:-336px 0}.icon-zoom-out{background-position:-360px 0}.icon-off{background-position:-384px 0}.icon-signal{background-position:-408px 0}.icon
 -cog{background-position:-432px 0}.icon-trash{background-position:-456px 0}.icon-home{background-position:0 -24px}.icon-file{background-position:-24px -24px}.icon-time{background-position:-48px -24px}.icon-road{background-position:-72px -24px}.icon-download-alt{background-position:-96px -24px}.icon-download{background-position:-120px -24px}.icon-upload{background-position:-144px -24px}.icon-inbox{background-position:-168px -24px}.icon-play-circle{background-position:-192px -24px}.icon-repeat{background-position:-216px -24px}.icon-refresh{background-position:-240px -24px}.icon-list-alt{background-position:-264px -24px}.icon-lock{background-position:-287px -24px}.icon-flag{background-position:-312px -24px}.icon-headphones{background-position:-336px -24px}.icon-volume-off{background-position:-360px -24px}.icon-volume-down{background-position:-384px -24px}.icon-volume-up{background-position:-408px -24px}.icon-qrcode{background-position:-432px -24px}.icon-barcode{background-position:-456
 px -24px}.icon-tag{background-position:0 -48px}.icon-tags{background-position:-25px -48px}.icon-book{background-position:-48px -48px}.icon-bookmark{background-position:-72px -48px}.icon-print{background-position:-96px -48px}.icon-camera{background-position:-120px -48px}.icon-font{background-position:-144px -48px}.icon-bold{background-position:-167px -48px}.icon-italic{background-position:-192px -48px}.icon-text-height{background-position:-216px -48px}.icon-text-width{background-position:-240px -48px}.icon-align-left{background-position:-264px -48px}.icon-align-center{background-position:-288px -48px}.icon-align-right{background-position:-312px -48px}.icon-align-justify{background-position:-336px -48px}.icon-list{background-position:-360px -48px}.icon-indent-left{background-position:-384px -48px}.icon-indent-right{background-position:-408px -48px}.icon-facetime-video{background-position:-432px -48px}.icon-picture{background-position:-456px -48px}.icon-pencil{background-position:0 -72
 px}.icon-map-marker{background-position:-24px -72px}.icon-adjust{background-position:-48px -72px}.icon-tint{background-position:-72px -72px}.icon-edit{background-position:-96px -72px}.icon-share{background-position:-120px -72px}.icon-check{background-position:-144px -72px}.icon-move{background-position:-168px -72px}.icon-step-backward{background-position:-192px -72px}.icon-fast-backward{background-position:-216px -72px}.icon-backward{background-position:-240px -72px}.icon-play{background-position:-264px -72px}.icon-pause{background-position:-288px -72px}.icon-stop{background-position:-312px -72px}.icon-forward{background-position:-336px -72px}.icon-fast-forward{background-position:-360px -72px}.icon-step-forward{background-position:-384px -72px}.icon-eject{background-position:-408px -72px}.icon-chevron-left{background-position:-432px -72px}.icon-chevron-right{background-position:-456px -72px}.icon-plus-sign{background-position:0 -96px}.icon-minus-sign{background-position:-24px -96px
 }.icon-remove-sign{background-position:-48px -96px}.icon-ok-sign{background-position:-72px -96px}.icon-question-sign{background-position:-96px -96px}.icon-info-sign{background-position:-120px -96px}.icon-screenshot{background-position:-144px -96px}.icon-remove-circle{background-position:-168px -96px}.icon-ok-circle{background-position:-192px -96px}.icon-ban-circle{background-position:-216px -96px}.icon-arrow-left{background-position:-240px -96px}.icon-arrow-right{background-position:-264px -96px}.icon-arrow-up{background-position:-289px -96px}.icon-arrow-down{background-position:-312px -96px}.icon-share-alt{background-position:-336px -96px}.icon-resize-full{background-position:-360px -96px}.icon-resize-small{background-position:-384px -96px}.icon-plus{background-position:-408px -96px}.icon-minus{background-position:-433px -96px}.icon-asterisk{background-position:-456px -96px}.icon-exclamation-sign{background-position:0 -120px}.icon-gift{background-position:-24px -120px}.icon-leaf{ba
 ckground-position:-48px -120px}.icon-fire{background-position:-72px -120px}.icon-eye-open{background-position:-96px -120px}.icon-eye-close{background-position:-120px -120px}.icon-warning-sign{background-position:-144px -120px}.icon-plane{background-position:-168px -120px}.icon-calendar{background-position:-192px -120px}.icon-random{width:16px;background-position:-216px -120px}.icon-comment{background-position:-240px -120px}.icon-magnet{background-position:-264px -120px}.icon-chevron-up{background-position:-288px -120px}.icon-chevron-down{background-position:-313px -119px}.icon-retweet{background-position:-336px -120px}.icon-shopping-cart{background-position:-360px -120px}.icon-folder-close{background-position:-384px -120px}.icon-folder-open{width:16px;background-position:-408px -120px}.icon-resize-vertical{background-position:-432px -119px}.icon-resize-horizontal{background-position:-456px -118px}.icon-hdd{background-position:0 -144px}.icon-bullhorn{background-position:-24px -144px}
 .icon-bell{background-position:-48px -144px}.icon-certificate{background-position:-72px -144px}.icon-thumbs-up{background-position:-96px -144px}.icon-thumbs-down{background-position:-120px -144px}.icon-hand-right{background-position:-144px -144px}.icon-hand-left{background-position:-168px -144px}.icon-hand-up{background-position:-192px -144px}.icon-hand-down{background-position:-216px -144px}.icon-circle-arrow-right{background-position:-240px -144px}.icon-circle-arrow-left{background-position:-264px -144px}.icon-circle-arrow-up{background-position:-288px -144px}.icon-circle-arrow-down{background-position:-312px -144px}.icon-globe{background-position:-336px -144px}.icon-wrench{background-position:-360px -144px}.icon-tasks{background-position:-384px -144px}.icon-filter{background-position:-408px -144px}.icon-briefcase{background-position:-432px -144px}.icon-fullscreen{background-position:-456px -144px}.dropup,.dropdown{position:relative}.dropdown-toggle{*margin-bottom:-3px}.dropdown-t
 oggle:active,.open .dropdown-toggle{outline:0}.caret{display:inline-block;width:0;height:0;vertical-align:top;border-top:4px solid #000;border-right:4px solid transparent;border-left:4px solid transparent;content:""}.dropdown .caret{margin-top:8px;margin-left:2px}.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:160px;padding:5px 0;margin:2px 0 0;list-style:none;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.2);*border-right-width:2px;*border-bottom-width:2px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,0.2);-moz-box-shadow:0 5px 10px rgba(0,0,0,0.2);box-shadow:0 5px 10px rgba(0,0,0,0.2);-webkit-background-clip:padding-box;-moz-background-clip:padding;background-clip:padding-box}.dropdown-menu.pull-right{right:0;left:auto}.dropdown-menu .divider{*width:100%;height:1px;margin:9px 1px;*margin:-5px 0 5px;overflow:hidden;background-color:#e5e5e5;border-
 bottom:1px solid #fff}.dropdown-menu a{display:block;padding:3px 20px;clear:both;font-weight:normal;line-height:20px;color:#333;white-space:nowrap}.dropdown-menu li>a:hover,.dropdown-menu li>a:focus,.dropdown-submenu:hover>a{color:#fff;text-decoration:none;background-color:#08c;background-color:#0081c2;background-image:-moz-linear-gradient(top,#08c,#0077b3);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#0077b3));background-image:-webkit-linear-gradient(top,#08c,#0077b3);background-image:-o-linear-gradient(top,#08c,#0077b3);background-image:linear-gradient(to bottom,#08c,#0077b3);background-repeat:repeat-x;filter:progid:dximagetransform.microsoft.gradient(startColorstr='#ff0088cc',endColorstr='#ff0077b3',GradientType=0)}.dropdown-menu .active>a,.dropdown-menu .active>a:hover{color:#fff;text-decoration:none;background-color:#08c;background-color:#0081c2;background-image:linear-gradient(to bottom,#08c,#0077b3);background-image:-moz-linear-gradient(top,#08c,#0077b3);
 background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#0077b3));background-image:-webkit-linear-gradient(top,#08c,#0077b3);background-image:-o-linear-gradient(top,#08c,#0077b3);background-repeat:repeat-x;outline:0;filter:progid:dximagetransform.microsoft.gradient(startColorstr='#ff0088cc',endColorstr='#ff0077b3',GradientType=0)}.dropdown-menu .disabled>a,.dropdown-menu .disabled>a:hover{color:#999}.dropdown-menu .disabled>a:hover{text-decoration:none;cursor:default;background-color:transparent}.open{*z-index:1000}.open>.dropdown-menu{display:block}.pull-right>.dropdown-menu{right:0;left:auto}.dropup .caret,.navbar-fixed-bottom .dropdown .caret{border-top:0;border-bottom:4px solid #000;content:""}.dropup .dropdown-menu,.navbar-fixed-bottom .dropdown .dropdown-menu{top:auto;bottom:100%;margin-bottom:1px}.dropdown-submenu{position:relative}.dropdown-submenu>.dropdown-menu{top:0;left:100%;margin-top:-6px;margin-left:-1px;-webkit-border-radius:0 6px 6px 6px;-moz-border-radius
 :0 6px 6px 6px;border-radius:0 6px 6px 6px}.dropdown-submenu:hover>.dropdown-menu{display:block}.dropdown-submenu>a:after{display:block;float:right;width:0;height:0;margin-top:5px;margin-right:-10px;border-color:transparent;border-left-color:#ccc;border-style:solid;border-width:5px 0 5px 5px;content:" "}.dropdown-submenu:hover>a:after{border-left-color:#fff}.dropdown .dropdown-menu .nav-header{padding-right:20px;padding-left:20px}.typeahead{margin-top:2px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.well{min-height:20px;padding:19px;margin-bottom:20px;background-color:#f5f5f5;border:1px solid #e3e3e3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.05);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.05);box-shadow:inset 0 1px 1px rgba(0,0,0,0.05)}.well blockquote{border-color:#ddd;border-color:rgba(0,0,0,0.15)}.well-large{padding:24px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6
 px}.well-small{padding:9px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.fade{opacity:0;-webkit-transition:opacity .15s linear;-moz-transition:opacity .15s linear;-o-transition:opacity .15s linear;transition:opacity .15s linear}.fade.in{opacity:1}.collapse{position:relative;height:0;overflow:hidden;-webkit-transition:height .35s ease;-moz-transition:height .35s ease;-o-transition:height .35s ease;transition:height .35s ease}.collapse.in{height:auto}.close{float:right;font-size:20px;font-weight:bold;line-height:20px;color:#000;text-shadow:0 1px 0 #fff;opacity:.2;filter:alpha(opacity=20)}.close:hover{color:#000;text-decoration:none;cursor:pointer;opacity:.4;filter:alpha(opacity=40)}button.close{padding:0;cursor:pointer;background:transparent;border:0;-webkit-appearance:none}.btn{display:inline-block;*display:inline;padding:4px 14px;margin-bottom:0;*margin-left:.3em;font-size:14px;line-height:20px;*line-height:20px;color:#333;text-align:center;text-shadow:0 1px 1p
 x rgba(255,255,255,0.75);vertical-align:middle;cursor:pointer;background-color:#f5f5f5;*background-color:#e6e6e6;background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#e6e6e6));background-image:-webkit-linear-gradient(top,#fff,#e6e6e6);background-image:-o-linear-gradient(top,#fff,#e6e6e6);background-image:linear-gradient(to bottom,#fff,#e6e6e6);background-image:-moz-linear-gradient(top,#fff,#e6e6e6);background-repeat:repeat-x;border:1px solid #bbb;*border:0;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);border-color:#e6e6e6 #e6e6e6 #bfbfbf;border-bottom-color:#a2a2a2;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;filter:progid:dximagetransform.microsoft.gradient(startColorstr='#ffffffff',endColorstr='#ffe6e6e6',GradientType=0);filter:progid:dximagetransform.microsoft.gradient(enabled=false);*zoom:1;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,0.2),0 1px 
 2px rgba(0,0,0,0.05);box-shadow:inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05)}.btn:hover,.btn:active,.btn.active,.btn.disabled,.btn[disabled]{color:#333;background-color:#e6e6e6;*background-color:#d9d9d9}.btn:active,.btn.active{background-color:#ccc \9}.btn:first-child{*margin-left:0}.btn:hover{color:#333;text-decoration:none;background-color:#e6e6e6;*background-color:#d9d9d9;background-position:0 -15px;-webkit-transition:background-position .1s linear;-moz-transition:background-position .1s linear;-o-transition:background-position .1s linear;transition:background-position .1s linear}.btn:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.btn.active,.btn:active{background-color:#e6e6e6;background-color:#d9d9d9 \9;background-image:none;outline:0;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,0.15),0 1px 2px rgba(0,0,0,0.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,0.15),0 1px 2px rgba(0,0,0,0.05);box-shadow:inset 0 2px 4px 
 rgba(0,0,0,0.15),0 1px 2px rgba(0,0,0,0.05)}.btn.disabled,.btn[disabled]{cursor:default;background-color:#e6e6e6;background-image:none;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.btn-large{padding:9px 14px;font-size:16px;line-height:normal;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px}.btn-large [class^="icon-"]{margin-top:2px}.btn-small{padding:3px 9px;font-size:12px;line-height:18px}.btn-small [class^="icon-"]{margin-top:0}.btn-mini{padding:2px 6px;font-size:11px;line-height:17px}.btn-block{display:block;width:100%;padding-right:0;padding-left:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.btn-block+.btn-block{margin-top:5px}input[type="submit"].btn-block,input[type="reset"].btn-block,input[type="button"].btn-block{width:100%}.btn-primary.active,.btn-warning.active,.btn-danger.active,.btn-success.active,.btn-info.active,.btn-inverse.active{color:rgba(255,255,255,0.75)}.bt
 n{border-color:#c5c5c5;border-color:rgba(0,0,0,0.15) rgba(0,0,0,0.15) rgba(0,0,0,0.25)}.btn-primary{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#006dcc;*background-color:#04c;background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#04c));background-image:-webkit-linear-gradient(top,#08c,#04c);background-image:-o-linear-gradient(top,#08c,#04c);background-image:linear-gradient(to bottom,#08c,#04c);background-image:-moz-linear-gradient(top,#08c,#04c);background-repeat:repeat-x;border-color:#04c #04c #002a80;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:dximagetransform.microsoft.gradient(startColorstr='#ff0088cc',endColorstr='#ff0044cc',GradientType=0);filter:progid:dximagetransform.microsoft.gradient(enabled=false)}.btn-primary:hover,.btn-primary:active,.btn-primary.active,.btn-primary.disabled,.btn-primary[disabled]{color:#fff;background-color:#04c;*background-color:#003bb3}.btn-primary:active,.btn-primary.active{backgroun
 d-color:#039 \9}.btn-warning{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#faa732;*background-color:#f89406;background-image:-webkit-gradient(linear,0 0,0 100%,from(#fbb450),to(#f89406));background-image:-webkit-linear-gradient(top,#fbb450,#f89406);background-image:-o-linear-gradient(top,#fbb450,#f89406);background-image:linear-gradient(to bottom,#fbb450,#f89406);background-image:-moz-linear-gradient(top,#fbb450,#f89406);background-repeat:repeat-x;border-color:#f89406 #f89406 #ad6704;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:dximagetransform.microsoft.gradient(startColorstr='#fffbb450',endColorstr='#fff89406',GradientType=0);filter:progid:dximagetransform.microsoft.gradient(enabled=false)}.btn-warning:hover,.btn-warning:active,.btn-warning.active,.btn-warning.disabled,.btn-warning[disabled]{color:#fff;background-color:#f89406;*background-color:#df8505}.btn-warning:active,.btn-warning.active{background-color:#c67605 \9}.btn-dange
 r{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#da4f49;*background-color:#bd362f;background-image:-webkit-gradient(linear,0 0,0 100%,from(#ee5f5b),to(#bd362f));background-image:-webkit-linear-gradient(top,#ee5f5b,#bd362f);background-image:-o-linear-gradient(top,#ee5f5b,#bd362f);background-image:linear-gradient(to bottom,#ee5f5b,#bd362f);background-image:-moz-linear-gradient(top,#ee5f5b,#bd362f);background-repeat:repeat-x;border-color:#bd362f #bd362f #802420;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:dximagetransform.microsoft.gradient(startColorstr='#ffee5f5b',endColorstr='#ffbd362f',GradientType=0);filter:progid:dximagetransform.microsoft.gradient(enabled=false)}.btn-danger:hover,.btn-danger:active,.btn-danger.active,.btn-danger.disabled,.btn-danger[disabled]{color:#fff;background-color:#bd362f;*background-color:#a9302a}.btn-danger:active,.btn-danger.active{background-color:#942a25 \9}.btn-success{color:#fff;text-shadow:0 -1px 0
  rgba(0,0,0,0.25);background-color:#5bb75b;*background-color:#51a351;background-image:-webkit-gradient(linear,0 0,0 100%,from(#62c462),to(#51a351));background-image:-webkit-linear-gradient(top,#62c462,#51a351);background-image:-o-linear-gradient(top,#62c462,#51a351);background-image:linear-gradient(to bottom,#62c462,#51a351);background-image:-moz-linear-gradient(top,#62c462,#51a351);background-repeat:repeat-x;border-color:#51a351 #51a351 #387038;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:dximagetransform.microsoft.gradient(startColorstr='#ff62c462',endColorstr='#ff51a351',GradientType=0);filter:progid:dximagetransform.microsoft.gradient(enabled=false)}.btn-success:hover,.btn-success:active,.btn-success.active,.btn-success.disabled,.btn-success[disabled]{color:#fff;background-color:#51a351;*background-color:#499249}.btn-success:active,.btn-success.active{background-color:#408140 \9}.btn-info{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-
 color:#49afcd;*background-color:#2f96b4;background-image:-webkit-gradient(linear,0 0,0 100%,from(#5bc0de),to(#2f96b4));background-image:-webkit-linear-gradient(top,#5bc0de,#2f96b4);background-image:-o-linear-gradient(top,#5bc0de,#2f96b4);background-image:linear-gradient(to bottom,#5bc0de,#2f96b4);background-image:-moz-linear-gradient(top,#5bc0de,#2f96b4);background-repeat:repeat-x;border-color:#2f96b4 #2f96b4 #1f6377;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:dximagetransform.microsoft.gradient(startColorstr='#ff5bc0de',endColorstr='#ff2f96b4',GradientType=0);filter:progid:dximagetransform.microsoft.gradient(enabled=false)}.btn-info:hover,.btn-info:active,.btn-info.active,.btn-info.disabled,.btn-info[disabled]{color:#fff;background-color:#2f96b4;*background-color:#2a85a0}.btn-info:active,.btn-info.active{background-color:#24748c \9}.btn-inverse{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#363636;*background-color:#222;background
 -image:-webkit-gradient(linear,0 0,0 100%,from(#444),to(#222));background-image:-webkit-linear-gradient(top,#444,#222);background-image:-o-linear-gradient(top,#444,#222);background-image:linear-gradient(to bottom,#444,#222);background-image:-moz-linear-gradient(top,#444,#222);background-repeat:repeat-x;border-color:#222 #222 #000;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:dximagetransform.microsoft.gradient(startColorstr='#ff444444',endColorstr='#ff222222',GradientType=0);filter:progid:dximagetransform.microsoft.gradient(enabled=false)}.btn-inverse:hover,.btn-inverse:active,.btn-inverse.active,.btn-inverse.disabled,.btn-inverse[disabled]{color:#fff;background-color:#222;*background-color:#151515}.btn-inverse:active,.btn-inverse.active{background-color:#080808 \9}button.btn,input[type="submit"].btn{*padding-top:3px;*padding-bottom:3px}button.btn::-moz-focus-inner,input[type="submit"].btn::-moz-focus-inner{padding:0;border:0}button.btn.btn-large,input[
 type="submit"].btn.btn-large{*padding-top:7px;*padding-bottom:7px}button.btn.btn-small,input[type="submit"].btn.btn-small{*padding-top:3px;*padding-bottom:3px}button.btn.btn-mini,input[type="submit"].btn.btn-mini{*padding-top:1px;*padding-bottom:1px}.btn-link,.btn-link:active,.btn-link[disabled]{background-color:transparent;background-image:none;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.btn-link{color:#08c;cursor:pointer;border-color:transparent;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.btn-link:hover{color:#005580;text-decoration:underline;background-color:transparent}.btn-link[disabled]:hover{color:#333;text-decoration:none}.btn-group{position:relative;*margin-left:.3em;font-size:0;white-space:nowrap;vertical-align:middle}.btn-group:first-child{*margin-left:0}.btn-group+.btn-group{margin-left:5px}.btn-toolbar{margin-top:10px;margin-bottom:10px;font-size:0}.btn-toolbar .btn-group{display:inline-block;*display:inline;*zoom:1}.btn-toolbar .btn+
 .btn,.btn-toolbar .btn-group+.btn,.btn-toolbar .btn+.btn-group{margin-left:5px}.btn-group>.btn{position:relative;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.btn-group>.btn+.btn{margin-left:-1px}.btn-group>.btn,.btn-group>.dropdown-menu{font-size:14px}.btn-group>.btn-mini{font-size:11px}.btn-group>.btn-small{font-size:12px}.btn-group>.btn-large{font-size:16px}.btn-group>.btn:first-child{margin-left:0;-webkit-border-bottom-left-radius:4px;border-bottom-left-radius:4px;-webkit-border-top-left-radius:4px;border-top-left-radius:4px;-moz-border-radius-bottomleft:4px;-moz-border-radius-topleft:4px}.btn-group>.btn:last-child,.btn-group>.dropdown-toggle{-webkit-border-top-right-radius:4px;border-top-right-radius:4px;-webkit-border-bottom-right-radius:4px;border-bottom-right-radius:4px;-moz-border-radius-topright:4px;-moz-border-radius-bottomright:4px}.btn-group>.btn.large:first-child{margin-left:0;-webkit-border-bottom-left-radius:6px;border-bottom-left-radius:6px;-webkit-b
 order-top-left-radius:6px;border-top-left-radius:6px;-moz-border-radius-bottomleft:6px;-moz-border-radius-topleft:6px}.btn-group>.btn.large:last-child,.btn-group>.large.dropdown-toggle{-webkit-border-top-right-radius:6px;border-top-right-radius:6px;-webkit-border-bottom-right-radius:6px;border-bottom-right-radius:6px;-moz-border-radius-topright:6px;-moz-border-radius-bottomright:6px}.btn-group>.btn:hover,.btn-group>.btn:focus,.btn-group>.btn:active,.btn-group>.btn.active{z-index:2}.btn-group .dropdown-toggle:active,.btn-group.open .dropdown-toggle{outline:0}.btn-group>.btn+.dropdown-toggle{*padding-top:5px;padding-right:8px;*padding-bottom:5px;padding-left:8px;-webkit-box-shadow:inset 1px 0 0 rgba(255,255,255,0.125),inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05);-moz-box-shadow:inset 1px 0 0 rgba(255,255,255,0.125),inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05);box-shadow:inset 1px 0 0 rgba(255,255,255,0.125),inset 0 1px 0 rgba(255,255,255,0.2),0 1px 
 2px rgba(0,0,0,0.05)}.btn-group>.btn-mini+.dropdown-toggle{*padding-top:2px;padding-right:5px;*padding-bottom:2px;padding-left:5px}.btn-group>.btn-small+.dropdown-toggle{*padding-top:5px;*padding-bottom:4px}.btn-group>.btn-large+.dropdown-toggle{*padding-top:7px;padding-right:12px;*padding-bottom:7px;padding-left:12px}.btn-group.open .dropdown-toggle{background-image:none;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,0.15),0 1px 2px rgba(0,0,0,0.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,0.15),0 1px 2px rgba(0,0,0,0.05);box-shadow:inset 0 2px 4px rgba(0,0,0,0.15),0 1px 2px rgba(0,0,0,0.05)}.btn-group.open .btn.dropdown-toggle{background-color:#e6e6e6}.btn-group.open .btn-primary.dropdown-toggle{background-color:#04c}.btn-group.open .btn-warning.dropdown-toggle{background-color:#f89406}.btn-group.open .btn-danger.dropdown-toggle{background-color:#bd362f}.btn-group.open .btn-success.dropdown-toggle{background-color:#51a351}.btn-group.open .btn-info.dropdown-toggle{background-color
 :#2f96b4}.btn-group.open .btn-inverse.dropdown-toggle{background-color:#222}.btn .caret{margin-top:8px;margin-left:0}.btn-mini .caret,.btn-small .caret,.btn-large .caret{margin-top:6px}.btn-large .caret{border-top-width:5px;border-right-width:5px;border-left-width:5px}.dropup .btn-large .caret{border-top:0;border-bottom:5px solid #000}.btn-primary .caret,.btn-warning .caret,.btn-danger .caret,.btn-info .caret,.btn-success .caret,.btn-inverse .caret{border-top-color:#fff;border-bottom-color:#fff}.btn-group-vertical{display:inline-block;*display:inline;*zoom:1}.btn-group-vertical .btn{display:block;float:none;width:100%;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.btn-group-vertical .btn+.btn{margin-top:-1px;margin-left:0}.btn-group-vertical .btn:first-child{-webkit-border-radius:4px 4px 0 0;-moz-border-radius:4px 4px 0 0;border-radius:4px 4px 0 0}.btn-group-vertical .btn:last-child{-webkit-border-radius:0 0 4px 4px;-moz-border-radius:0 0 4px 4px;border-radius:0 0 4px
  4px}.btn-group-vertical .btn-large:first-child{-webkit-border-radius:6px 6px 0 0;-moz-border-radius:6px 6px 0 0;border-radius:6px 6px 0 0}.btn-group-vertical .btn-large:last-child{-webkit-border-radius:0 0 6px 6px;-moz-border-radius:0 0 6px 6px;border-radius:0 0 6px 6px}.alert{padding:8px 35px 8px 14px;margin-bottom:20px;color:#c09853;text-shadow:0 1px 0 rgba(255,255,255,0.5);background-color:#fcf8e3;border:1px solid #fbeed5;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.alert h4{margin:0}.alert .close{position:relative;top:-2px;right:-21px;line-height:20px}.alert-success{color:#468847;background-color:#dff0d8;border-color:#d6e9c6}.alert-danger,.alert-error{color:#b94a48;background-color:#f2dede;border-color:#eed3d7}.alert-info{color:#3a87ad;background-color:#d9edf7;border-color:#bce8f1}.alert-block{padding-top:14px;padding-bottom:14px}.alert-block>p,.alert-block>ul{margin-bottom:0}.alert-block p+p{margin-top:5px}.nav{margin-bottom:20px;margin-left:0;list-style
 :none}.nav>li>a{display:block}.nav>li>a:hover{text-decoration:none;background-color:#eee}.nav>.pull-right{float:right}.nav-header{display:block;padding:3px 15px;font-size:11px;font-weight:bold;line-height:20px;color:#999;text-shadow:0 1px 0 rgba(255,255,255,0.5);text-transform:uppercase}.nav li+.nav-header{margin-top:9px}.nav-list{padding-right:15px;padding-left:15px;margin-bottom:0}.nav-list>li>a,.nav-list .nav-header{margin-right:-15px;margin-left:-15px;text-shadow:0 1px 0 rgba(255,255,255,0.5)}.nav-list>li>a{padding:3px 15px}.nav-list>.active>a,.nav-list>.active>a:hover{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.2);background-color:#08c}.nav-list [class^="icon-"]{margin-right:2px}.nav-list .divider{*width:100%;height:1px;margin:9px 1px;*margin:-5px 0 5px;overflow:hidden;background-color:#e5e5e5;border-bottom:1px solid #fff}.nav-tabs,.nav-pills{*zoom:1}.nav-tabs:before,.nav-pills:before,.nav-tabs:after,.nav-pills:after{display:table;line-height:0;content:""}.nav-tabs:after,.nav-
 pills:after{clear:both}.nav-tabs>li,.nav-pills>li{float:left}.nav-tabs>li>a,.nav-pills>li>a{padding-right:12px;padding-left:12px;margin-right:2px;line-height:14px}.nav-tabs{border-bottom:1px solid #ddd}.nav-tabs>li{margin-bottom:-1px}.nav-tabs>li>a{padding-top:8px;padding-bottom:8px;line-height:20px;border:1px solid transparent;-webkit-border-radius:4px 4px 0 0;-moz-border-radius:4px 4px 0 0;border-radius:4px 4px 0 0}.nav-tabs>li>a:hover{border-color:#eee #eee #ddd}.nav-tabs>.active>a,.nav-tabs>.active>a:hover{color:#555;cursor:default;background-color:#fff;border:1px solid #ddd;border-bottom-color:transparent}.nav-pills>li>a{padding-top:8px;padding-bottom:8px;margin-top:2px;margin-bottom:2px;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px}.nav-pills>.active>a,.nav-pills>.active>a:hover{color:#fff;background-color:#08c}.nav-stacked>li{float:none}.nav-stacked>li>a{margin-right:0}.nav-tabs.nav-stacked{border-bottom:0}.nav-tabs.nav-stacked>li>a{border:1px solid #ddd;
 -webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.nav-tabs.nav-stacked>li:first-child>a{-webkit-border-top-right-radius:4px;border-top-right-radius:4px;-webkit-border-top-left-radius:4px;border-top-left-radius:4px;-moz-border-radius-topright:4px;-moz-border-radius-topleft:4px}.nav-tabs.nav-stacked>li:last-child>a{-webkit-border-bottom-right-radius:4px;border-bottom-right-radius:4px;-webkit-border-bottom-left-radius:4px;border-bottom-left-radius:4px;-moz-border-radius-bottomright:4px;-moz-border-radius-bottomleft:4px}.nav-tabs.nav-stacked>li>a:hover{z-index:2;border-color:#ddd}.nav-pills.nav-stacked>li>a{margin-bottom:3px}.nav-pills.nav-stacked>li:last-child>a{margin-bottom:1px}.nav-tabs .dropdown-menu{-webkit-border-radius:0 0 6px 6px;-moz-border-radius:0 0 6px 6px;border-radius:0 0 6px 6px}.nav-pills .dropdown-menu{-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px}.nav .dropdown-toggle .caret{margin-top:6px;border-top-color:#08c;border-bottom-color:#08c
 }.nav .dropdown-toggle:hover .caret{border-top-color:#005580;border-bottom-color:#005580}.nav-tabs .dropdown-toggle .caret{margin-top:8px}.nav .active .dropdown-toggle .caret{border-top-color:#fff;border-bottom-color:#fff}.nav-tabs .active .dropdown-toggle .caret{border-top-color:#555;border-bottom-color:#555}.nav>.dropdown.active>a:hover{cursor:pointer}.nav-tabs .open .dropdown-toggle,.nav-pills .open .dropdown-toggle,.nav>li.dropdown.open.active>a:hover{color:#fff;background-color:#999;border-color:#999}.nav li.dropdown.open .caret,.nav li.dropdown.open.active .caret,.nav li.dropdown.open a:hover .caret{border-top-color:#fff;border-bottom-color:#fff;opacity:1;filter:alpha(opacity=100)}.tabs-stacked .open>a:hover{border-color:#999}.tabbable{*zoom:1}.tabbable:before,.tabbable:after{display:table;line-height:0;content:""}.tabbable:after{clear:both}.tab-content{overflow:auto}.tabs-below>.nav-tabs,.tabs-right>.nav-tabs,.tabs-left>.nav-tabs{border-bottom:0}.tab-content>.tab-pane,.pill-c
 ontent>.pill-pane{display:none}.tab-content>.active,.pill-content>.active{display:block}.tabs-below>.nav-tabs{border-top:1px solid #ddd}.tabs-below>.nav-tabs>li{margin-top:-1px;margin-bottom:0}.tabs-below>.nav-tabs>li>a{-webkit-border-radius:0 0 4px 4px;-moz-border-radius:0 0 4px 4px;border-radius:0 0 4px 4px}.tabs-below>.nav-tabs>li>a:hover{border-top-color:#ddd;border-bottom-color:transparent}.tabs-below>.nav-tabs>.active>a,.tabs-below>.nav-tabs>.active>a:hover{border-color:transparent #ddd #ddd #ddd}.tabs-left>.nav-tabs>li,.tabs-right>.nav-tabs>li{float:none}.tabs-left>.nav-tabs>li>a,.tabs-right>.nav-tabs>li>a{min-width:74px;margin-right:0;margin-bottom:3px}.tabs-left>.nav-tabs{float:left;margin-right:19px;border-right:1px solid #ddd}.tabs-left>.nav-tabs>li>a{margin-right:-1px;-webkit-border-radius:4px 0 0 4px;-moz-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px}.tabs-left>.nav-tabs>li>a:hover{border-color:#eee #ddd #eee #eee}.tabs-left>.nav-tabs .active>a,.tabs-left>.nav-tab
 s .active>a:hover{border-color:#ddd transparent #ddd #ddd;*border-right-color:#fff}.tabs-right>.nav-tabs{float:right;margin-left:19px;border-left:1px solid #ddd}.tabs-right>.nav-tabs>li>a{margin-left:-1px;-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0}.tabs-right>.nav-tabs>li>a:hover{border-color:#eee #eee #eee #ddd}.tabs-right>.nav-tabs .active>a,.tabs-right>.nav-tabs .active>a:hover{border-color:#ddd #ddd #ddd transparent;*border-left-color:#fff}.nav>.disabled>a{color:#999}.nav>.disabled>a:hover{text-decoration:none;cursor:default;background-color:transparent}.navbar{*position:relative;*z-index:2;margin-bottom:20px;overflow:visible;color:#777}.navbar-inner{min-height:40px;padding-right:20px;padding-left:20px;background-color:#fafafa;background-image:-moz-linear-gradient(top,#fff,#f2f2f2);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#f2f2f2));background-image:-webkit-linear-gradient(top,#fff,#f2f2f2);background-image:
 -o-linear-gradient(top,#fff,#f2f2f2);background-image:linear-gradient(to bottom,#fff,#f2f2f2);background-repeat:repeat-x;border:1px solid #d4d4d4;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;filter:progid:dximagetransform.microsoft.gradient(startColorstr='#ffffffff',endColorstr='#fff2f2f2',GradientType=0);*zoom:1;-webkit-box-shadow:0 1px 4px rgba(0,0,0,0.065);-moz-box-shadow:0 1px 4px rgba(0,0,0,0.065);box-shadow:0 1px 4px rgba(0,0,0,0.065)}.navbar-inner:before,.navbar-inner:after{display:table;line-height:0;content:""}.navbar-inner:after{clear:both}.navbar .container{width:auto}.nav-collapse.collapse{height:auto}.navbar .brand{display:block;float:left;padding:10px 20px 10px;margin-left:-20px;font-size:20px;font-weight:200;color:#777;text-shadow:0 1px 0 #fff}.navbar .brand:hover{text-decoration:none}.navbar-text{margin-bottom:0;line-height:40px}.navbar-link{color:#777}.navbar-link:hover{color:#333}.navbar .divider-vertical{height:40px;margin:0 9px;border-right:
 1px solid #fff;border-left:1px solid #f2f2f2}.navbar .btn,.navbar .btn-group{margin-top:5px}.navbar .btn-group .btn,.navbar .input-prepend .btn,.navbar .input-append .btn{margin-top:0}.navbar-form{margin-bottom:0;*zoom:1}.navbar-form:before,.navbar-form:after{display:table;line-height:0;content:""}.navbar-form:after{clear:both}.navbar-form input,.navbar-form select,.navbar-form .radio,.navbar-form .checkbox{margin-top:5px}.navbar-form input,.navbar-form select,.navbar-form .btn{display:inline-block;margin-bottom:0}.navbar-form input[type="image"],.navbar-form input[type="checkbox"],.navbar-form input[type="radio"]{margin-top:3px}.navbar-form .input-append,.navbar-form .input-prepend{margin-top:6px;white-space:nowrap}.navbar-form .input-append input,.navbar-form .input-prepend input{margin-top:0}.navbar-search{position:relative;float:left;margin-top:5px;margin-bottom:0}.navbar-search .search-query{padding:4px 14px;margin-bottom:0;font-family:"Helvetica Neue",Helvetica,Arial,sans-seri
 f;font-size:13px;font-weight:normal;line-height:1;-webkit-border-radius:15px;-moz-border-radius:15px;border-radius:15px}.navbar-static-top{position:static;width:100%;margin-bottom:0}.navbar-static-top .navbar-inner{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.navbar-fixed-top,.navbar-fixed-bottom{position:fixed;right:0;left:0;z-index:1030;margin-bottom:0}.navbar-fixed-top .navbar-inner,.navbar-static-top .navbar-inner{border-width:0 0 1px}.navbar-fixed-bottom .navbar-inner{border-width:1px 0 0}.navbar-fixed-top .navbar-inner,.navbar-fixed-bottom .navbar-inner{padding-right:0;padding-left:0;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.navbar-static-top .container,.navbar-fixed-top .container,.navbar-fixed-bottom .container{width:940px}.navbar-fixed-top{top:0}.navbar-fixed-top .navbar-inner,.navbar-static-top .navbar-inner{-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,0.1),0 1px 10px rgba(0,0,0,0.1);-moz-box-shadow:inset 0 -1px 0 rgba(0,0,0,0.1),0 1px 
 10px rgba(0,0,0,0.1);box-shadow:inset 0 -1px 0 rgba(0,0,0,0.1),0 1px 10px rgba(0,0,0,0.1)}.navbar-fixed-bottom{bottom:0}.navbar-fixed-bottom .navbar-inner{-webkit-box-shadow:inset 0 1px 0 rgba(0,0,0,0.1),0 -1px 10px rgba(0,0,0,0.1);-moz-box-shadow:inset 0 1px 0 rgba(0,0,0,0.1),0 -1px 10px rgba(0,0,0,0.1);box-shadow:inset 0 1px 0 rgba(0,0,0,0.1),0 -1px 10px rgba(0,0,0,0.1)}.navbar .nav{position:relative;left:0;display:block;float:left;margin:0 10px 0 0}.navbar .nav.pull-right{float:right;margin-right:0}.navbar .nav>li{float:left}.navbar .nav>li>a{float:none;padding:10px 15px 10px;color:#777;text-decoration:none;text-shadow:0 1px 0 #fff}.navbar .nav .dropdown-toggle .caret{margin-top:8px}.navbar .nav>li>a:focus,.navbar .nav>li>a:hover{color:#333;text-decoration:none;background-color:transparent}.navbar .nav>.active>a,.navbar .nav>.active>a:hover,.navbar .nav>.active>a:focus{color:#555;text-decoration:none;background-color:#e5e5e5;-webkit-box-shadow:inset 0 3px 8px rgba(0,0,0,0.125);-m
 oz-box-shadow:inset 0 3px 8px rgba(0,0,0,0.125);box-shadow:inset 0 3px 8px rgba(0,0,0,0.125)}.navbar .btn-navbar{display:none;float:right;padding:7px 10px;margin-right:5px;margin-left:5px;color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#ededed;*background-color:#e5e5e5;background-image:-webkit-gradient(linear,0 0,0 100%,from(#f2f2f2),to(#e5e5e5));background-image:-webkit-linear-gradient(top,#f2f2f2,#e5e5e5);background-image:-o-linear-gradient(top,#f2f2f2,#e5e5e5);background-image:linear-gradient(to bottom,#f2f2f2,#e5e5e5);background-image:-moz-linear-gradient(top,#f2f2f2,#e5e5e5);background-repeat:repeat-x;border-color:#e5e5e5 #e5e5e5 #bfbfbf;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:dximagetransform.microsoft.gradient(startColorstr='#fff2f2f2',endColorstr='#ffe5e5e5',GradientType=0);filter:progid:dximagetransform.microsoft.gradient(enabled=false);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.075
 );-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.075);box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.075)}.navbar .btn-navbar:hover,.navbar .btn-navbar:active,.navbar .btn-navbar.active,.navbar .btn-navbar.disabled,.navbar .btn-navbar[disabled]{color:#fff;background-color:#e5e5e5;*background-color:#d9d9d9}.navbar .btn-navbar:active,.navbar .btn-navbar.active{background-color:#ccc \9}.navbar .btn-navbar .icon-bar{display:block;width:18px;height:2px;background-color:#f5f5f5;-webkit-border-radius:1px;-moz-border-radius:1px;border-radius:1px;-webkit-box-shadow:0 1px 0 rgba(0,0,0,0.25);-moz-box-shadow:0 1px 0 rgba(0,0,0,0.25);box-shadow:0 1px 0 rgba(0,0,0,0.25)}.btn-navbar .icon-bar+.icon-bar{margin-top:3px}.navbar .nav>li>.dropdown-menu:before{position:absolute;top:-7px;left:9px;display:inline-block;border-right:7px solid transparent;border-bottom:7px solid #ccc;border-left:7px solid transparent;border-bottom-color:rgba(0,0,0,0.
 2);content:''}.navbar .nav>li>.dropdown-menu:after{position:absolute;top:-6px;left:10px;display:inline-block;border-right:6px solid transparent;border-bottom:6px solid #fff;border-left:6px solid transparent;content:''}.navbar-fixed-bottom .nav>li>.dropdown-menu:before{top:auto;bottom:-7px;border-top:7px solid #ccc;border-bottom:0;border-top-color:rgba(0,0,0,0.2)}.navbar-fixed-bottom .nav>li>.dropdown-menu:after{top:auto;bottom:-6px;border-top:6px solid #fff;border-bottom:0}.navbar .nav li.dropdown.open>.dropdown-toggle,.navbar .nav li.dropdown.active>.dropdown-toggle,.navbar .nav li.dropdown.open.active>.dropdown-toggle{color:#555;background-color:#e5e5e5}.navbar .nav li.dropdown>.dropdown-toggle .caret{border-top-color:#777;border-bottom-color:#777}.navbar .nav li.dropdown.open>.dropdown-toggle .caret,.navbar .nav li.dropdown.active>.dropdown-toggle .caret,.navbar .nav li.dropdown.open.active>.dropdown-toggle .caret{border-top-color:#555;border-bottom-color:#555}.navbar .pull-right
 >li>.dropdown-menu,.navbar .nav>li>.dropdown-menu.pull-right{right:0;left:auto}.navbar .pull-right>li>.dropdown-menu:before,.navbar .nav>li>.dropdown-menu.pull-right:before{right:12px;left:auto}.navbar .pull-right>li>.dropdown-menu:after,.navbar .nav>li>.dropdown-menu.pull-right:after{right:13px;left:auto}.navbar .pull-right>li>.dropdown-menu .dropdown-menu,.navbar .nav>li>.dropdown-menu.pull-right .dropdown-menu{right:100%;left:auto;margin-right:-1px;margin-left:0;-webkit-border-radius:6px 0 6px 6px;-moz-border-radius:6px 0 6px 6px;border-radius:6px 0 6px 6px}.navbar-inverse{color:#999}.navbar-inverse .navbar-inner{background-color:#1b1b1b;background-image:-moz-linear-gradient(top,#222,#111);background-image:-webkit-gradient(linear,0 0,0 100%,from(#222),to(#111));background-image:-webkit-linear-gradient(top,#222,#111);background-image:-o-linear-gradient(top,#222,#111);background-image:linear-gradient(to bottom,#222,#111);background-repeat:repeat-x;border-color:#252525;filter:progid
 :dximagetransform.microsoft.gradient(startColorstr='#ff222222',endColorstr='#ff111111',GradientType=0)}.navbar-inverse .brand,.navbar-inverse .nav>li>a{color:#999;text-shadow:0 -1px 0 rgba(0,0,0,0.25)}.navbar-inverse .brand:hover,.navbar-inverse .nav>li>a:hover{color:#fff}.navbar-inverse .nav>li>a:focus,.navbar-inverse .nav>li>a:hover{color:#fff;background-color:transparent}.navbar-inverse .nav .active>a,.navbar-inverse .nav .active>a:hover,.navbar-inverse .nav .active>a:focus{color:#fff;background-color:#111}.navbar-inverse .navbar-link{color:#999}.navbar-inverse .navbar-link:hover{color:#fff}.navbar-inverse .divider-vertical{border-right-color:#222;border-left-color:#111}.navbar-inverse .nav li.dropdown.open>.dropdown-toggle,.navbar-inverse .nav li.dropdown.active>.dropdown-toggle,.navbar-inverse .nav li.dropdown.open.active>.dropdown-toggle{color:#fff;background-color:#111}.navbar-inverse .nav li.dropdown>.dropdown-toggle .caret{border-top-color:#999;border-bottom-color:#999}.nav
 bar-inverse .nav li.dropdown.open>.dropdown-toggle .caret,.navbar-inverse .nav li.dropdown.active>.dropdown-toggle .caret,.navbar-inverse .nav li.dropdown.open.active>.dropdown-toggle .caret{border-top-color:#fff;border-bottom-color:#fff}.navbar-inverse .navbar-search .search-query{color:#fff;background-color:#515151;border-color:#111;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1),0 1px 0 rgba(255,255,255,0.15);-moz-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1),0 1px 0 rgba(255,255,255,0.15);box-shadow:inset 0 1px 2px rgba(0,0,0,0.1),0 1px 0 rgba(255,255,255,0.15);-webkit-transition:none;-moz-transition:none;-o-transition:none;transition:none}.navbar-inverse .navbar-search .search-query:-moz-placeholder{color:#ccc}.navbar-inverse .navbar-search .search-query:-ms-input-placeholder{color:#ccc}.navbar-inverse .navbar-search .search-query::-webkit-input-placeholder{color:#ccc}.navbar-inverse .navbar-search .search-query:focus,.navbar-inverse .navbar-search .search-query.focused{padding
 :5px 15px;color:#333;text-shadow:0 1px 0 #fff;background-color:#fff;border:0;outline:0;-webkit-box-shadow:0 0 3px rgba(0,0,0,0.15);-moz-box-shadow:0 0 3px rgba(0,0,0,0.15);box-shadow:0 0 3px rgba(0,0,0,0.15)}.navbar-inverse .btn-navbar{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#0e0e0e;*background-color:#040404;background-image:-webkit-gradient(linear,0 0,0 100%,from(#151515),to(#040404));background-image:-webkit-linear-gradient(top,#151515,#040404);background-image:-o-linear-gradient(top,#151515,#040404);background-image:linear-gradient(to bottom,#151515,#040404);background-image:-moz-linear-gradient(top,#151515,#040404);background-repeat:repeat-x;border-color:#040404 #040404 #000;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:dximagetransform.microsoft.gradient(startColorstr='#ff151515',endColorstr='#ff040404',GradientType=0);filter:progid:dximagetransform.microsoft.gradient(enabled=false)}.navbar-inverse .btn-navbar:hover,.navba
 r-inverse .btn-navbar:active,.navbar-inverse .btn-navbar.active,.navbar-inverse .btn-navbar.disabled,.navbar-inverse .btn-navbar[disabled]{color:#fff;background-color:#040404;*background-color:#000}.navbar-inverse .btn-navbar:active,.navbar-inverse .btn-navbar.active{background-color:#000 \9}.breadcrumb{padding:8px 15px;margin:0 0 20px;list-style:none;background-color:#f5f5f5;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.breadcrumb li{display:inline-block;*display:inline;text-shadow:0 1px 0 #fff;*zoom:1}.breadcrumb .divider{padding:0 5px;color:#ccc}.breadcrumb .active{color:#999}.pagination{height:40px;margin:20px 0}.pagination ul{display:inline-block;*display:inline;margin-bottom:0;margin-left:0;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;*zoom:1;-webkit-box-shadow:0 1px 2px rgba(0,0,0,0.05);-moz-box-shadow:0 1px 2px rgba(0,0,0,0.05);box-shadow:0 1px 2px rgba(0,0,0,0.05)}.pagination ul>li{display:inline}.pagination ul>li>a,.pagination ul
 >li>span{float:left;padding:0 14px;line-height:38px;text-decoration:none;background-color:#fff;border:1px solid #ddd;border-left-width:0}.pagination ul>li>a:hover,.pagination ul>.active>a,.pagination ul>.active>span{background-color:#f5f5f5}.pagination ul>.active>a,.pagination ul>.active>span{color:#999;cursor:default}.pagination ul>.disabled>span,.pagination ul>.disabled>a,.pagination ul>.disabled>a:hover{color:#999;cursor:default;background-color:transparent}.pagination ul>li:first-child>a,.pagination ul>li:first-child>span{border-left-width:1px;-webkit-border-radius:3px 0 0 3px;-moz-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px}.pagination ul>li:last-child>a,.pagination ul>li:last-child>span{-webkit-border-radius:0 3px 3px 0;-moz-border-radius:0 3px 3px 0;border-radius:0 3px 3px 0}.pagination-centered{text-align:center}.pagination-right{text-align:right}.pager{margin:20px 0;text-align:center;list-style:none;*zoom:1}.pager:before,.pager:after{display:table;line-height:0;cont
 ent:""}.pager:after{clear:both}.pager li{display:inline}.pager a,.pager span{display:inline-block;padding:5px 14px;background-color:#fff;border:1px solid #ddd;-webkit-border-radius:15px;-moz-border-radius:15px;border-radius:15px}.pager a:hover{text-decoration:none;background-color:#f5f5f5}.pager .next a,.pager .next span{float:right}.pager .previous a{float:left}.pager .disabled a,.pager .disabled a:hover,.pager .disabled span{color:#999;cursor:default;background-color:#fff}.modal-open .modal .dropdown-menu{z-index:2050}.modal-open .modal .dropdown.open{*z-index:2050}.modal-open .modal .popover{z-index:2060}.modal-open .modal .tooltip{z-index:2080}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;background-color:#000}.modal-backdrop.fade{opacity:0}.modal-backdrop,.modal-backdrop.fade.in{opacity:.8;filter:alpha(opacity=80)}.modal{position:fixed;top:50%;left:50%;z-index:1050;width:560px;margin:-250px 0 0 -280px;overflow:auto;background-color:#fff;border:1px so
 lid #999;border:1px solid rgba(0,0,0,0.3);*border:1px solid #999;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 3px 7px rgba(0,0,0,0.3);-moz-box-shadow:0 3px 7px rgba(0,0,0,0.3);box-shadow:0 3px 7px rgba(0,0,0,0.3);-webkit-background-clip:padding-box;-moz-background-clip:padding-box;background-clip:padding-box}.modal.fade{top:-25%;-webkit-transition:opacity .3s linear,top .3s ease-out;-moz-transition:opacity .3s linear,top .3s ease-out;-o-transition:opacity .3s linear,top .3s ease-out;transition:opacity .3s linear,top .3s ease-out}.modal.fade.in{top:50%}.modal-header{padding:9px 15px;border-bottom:1px solid #eee}.modal-header .close{margin-top:2px}.modal-header h3{margin:0;line-height:30px}.modal-body{max-height:400px;padding:15px;overflow-y:auto}.modal-form{margin-bottom:0}.modal-footer{padding:14px 15px 15px;margin-bottom:0;text-align:right;background-color:#f5f5f5;border-top:1px solid #ddd;-webkit-border-radius:0 0 6px 6px;-moz-border-radi
 us:0 0 6px 6px;border-radius:0 0 6px 6px;*zoom:1;-webkit-box-shadow:inset 0 1px 0 #fff;-moz-box-shadow:inset 0 1px 0 #fff;box-shadow:inset 0 1px 0 #fff}.modal-footer:before,.modal-footer:after{display:table;line-height:0;content:""}.modal-footer:after{clear:both}.modal-footer .btn+.btn{margin-bottom:0;margin-left:5px}.modal-footer .btn-group .btn+.btn{margin-left:-1px}.tooltip{position:absolute;z-index:1030;display:block;padding:5px;font-size:11px;opacity:0;filter:alpha(opacity=0);visibility:visible}.tooltip.in{opacity:.8;filter:alpha(opacity=80)}.tooltip.top{margin-top:-3px}.tooltip.right{margin-left:3px}.tooltip.bottom{margin-top:3px}.tooltip.left{margin-left:-3px}.tooltip-inner{max-width:200px;padding:3px 8px;color:#fff;text-align:center;text-decoration:none;background-color:#000;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.tooltip-arrow{position:absolute;width:0;height:0;border-color:transparent;border-style:solid}.tooltip.top .tooltip-arrow{bottom:0;left:
 50%;margin-left:-5px;border-top-color:#000;border-width:5px 5px 0}.tooltip.right .tooltip-arrow{top:50%;left:0;margin-top:-5px;border-right-color:#000;border-width:5px 5px 5px 0}.tooltip.left .tooltip-arrow{top:50%;right:0;margin-top:-5px;border-left-color:#000;border-width:5px 0 5px 5px}.tooltip.bottom .tooltip-arrow{top:0;left:50%;margin-left:-5px;border-bottom-color:#000;border-width:0 5px 5px}.popover{position:absolute;top:0;left:0;z-index:1010;display:none;width:236px;padding:1px;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.2);-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,0.2);-moz-box-shadow:0 5px 10px rgba(0,0,0,0.2);box-shadow:0 5px 10px rgba(0,0,0,0.2);-webkit-background-clip:padding-box;-moz-background-clip:padding;background-clip:padding-box}.popover.top{margin-bottom:10px}.popover.right{margin-left:10px}.popover.bottom{margin-top:10px}.popover.left{margin-right:10px}.popover-title{
 padding:8px 14px;margin:0;font-size:14px;font-weight:normal;line-height:18px;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;-webkit-border-radius:5px 5px 0 0;-moz-border-radius:5px 5px 0 0;border-radius:5px 5px 0 0}.popover-content{padding:9px 14px}.popover-content p,.popover-content ul,.popover-content ol{margin-bottom:0}.popover .arrow,.popover .arrow:after{position:absolute;display:inline-block;width:0;height:0;border-color:transparent;border-style:solid}.popover .arrow:after{z-index:-1;content:""}.popover.top .arrow{bottom:-10px;left:50%;margin-left:-10px;border-top-color:#fff;border-width:10px 10px 0}.popover.top .arrow:after{bottom:-1px;left:-11px;border-top-color:rgba(0,0,0,0.25);border-width:11px 11px 0}.popover.right .arrow{top:50%;left:-10px;margin-top:-10px;border-right-color:#fff;border-width:10px 10px 10px 0}.popover.right .arrow:after{bottom:-11px;left:-1px;border-right-color:rgba(0,0,0,0.25);border-width:11px 11px 11px 0}.popover.bottom .arrow{top:-10px;left
 :50%;margin-left:-10px;border-bottom-color:#fff;border-width:0 10px 10px}.popover.bottom .arrow:after{top:-1px;left:-11px;border-bottom-color:rgba(0,0,0,0.25);border-width:0 11px 11px}.popover.left .arrow{top:50%;right:-10px;margin-top:-10px;border-left-color:#fff;border-width:10px 0 10px 10px}.popover.left .arrow:after{right:-1px;bottom:-11px;border-left-color:rgba(0,0,0,0.25);border-width:11px 0 11px 11px}.thumbnails{margin-left:-20px;list-style:none;*zoom:1}.thumbnails:before,.thumbnails:after{display:table;line-height:0;content:""}.thumbnails:after{clear:both}.row-fluid .thumbnails{margin-left:0}.thumbnails>li{float:left;margin-bottom:20px;margin-left:20px}.thumbnail{display:block;padding:4px;line-height:20px;border:1px solid #ddd;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:0 1px 3px rgba(0,0,0,0.055);-moz-box-shadow:0 1px 3px rgba(0,0,0,0.055);box-shadow:0 1px 3px rgba(0,0,0,0.055);-webkit-transition:all .2s ease-in-out;-moz-transition:
 all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out}a.thumbnail:hover{border-color:#08c;-webkit-box-shadow:0 1px 4px rgba(0,105,214,0.25);-moz-box-shadow:0 1px 4px rgba(0,105,214,0.25);box-shadow:0 1px 4px rgba(0,105,214,0.25)}.thumbnail>img{display:block;max-width:100%;margin-right:auto;margin-left:auto}.thumbnail .caption{padding:9px;color:#555}.label,.badge{font-size:11.844px;font-weight:bold;line-height:14px;color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);white-space:nowrap;vertical-align:baseline;background-color:#999}.label{padding:1px 4px 2px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.badge{padding:1px 9px 2px;-webkit-border-radius:9px;-moz-border-radius:9px;border-radius:9px}a.label:hover,a.badge:hover{color:#fff;text-decoration:none;cursor:pointer}.label-important,.badge-important{background-color:#b94a48}.label-important[href],.badge-important[href]{background-color:#953b39}.label-warning,.badge-warning{background-
 color:#f89406}.label-warning[href],.badge-warning[href]{background-color:#c67605}.label-success,.badge-success{background-color:#468847}.label-success[href],.badge-success[href]{background-color:#356635}.label-info,.badge-info{background-color:#3a87ad}.label-info[href],.badge-info[href]{background-color:#2d6987}.label-inverse,.badge-inverse{background-color:#333}.label-inverse[href],.badge-inverse[href]{background-color:#1a1a1a}.btn .label,.btn .badge{position:relative;top:-1px}.btn-mini .label,.btn-mini .badge{top:0}@-webkit-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@-moz-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@-ms-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@-o-keyframes progress-bar-stripes{from{background-position:0 0}to{background-position:40px 0}}@keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position
 :0 0}}.progress{height:20px;margin-bottom:20px;overflow:hidden;background-color:#f7f7f7;background-image:-moz-linear-gradient(top,#f5f5f5,#f9f9f9);background-image:-webkit-gradient(linear,0 0,0 100%,from(#f5f5f5),to(#f9f9f9));background-image:-webkit-linear-gradient(top,#f5f5f5,#f9f9f9);background-image:-o-linear-gradient(top,#f5f5f5,#f9f9f9);background-image:linear-gradient(to bottom,#f5f5f5,#f9f9f9);background-repeat:repeat-x;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;filter:progid:dximagetransform.microsoft.gradient(startColorstr='#fff5f5f5',endColorstr='#fff9f9f9',GradientType=0);-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);-moz-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);box-shadow:inset 0 1px 2px rgba(0,0,0,0.1)}.progress .bar{float:left;width:0;height:100%;font-size:12px;color:#fff;text-align:center;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#0e90d2;background-image:-moz-linear-gradient(top,#149bdf,#0480be);background-image:-webkit-gra
 dient(linear,0 0,0 100%,from(#149bdf),to(#0480be));background-image:-webkit-linear-gradient(top,#149bdf,#0480be);background-image:-o-linear-gradient(top,#149bdf,#0480be);background-image:linear-gradient(to bottom,#149bdf,#0480be);background-repeat:repeat-x;filter:progid:dximagetransform.microsoft.gradient(startColorstr='#ff149bdf',endColorstr='#ff0480be',GradientType=0);-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,0.15);-moz-box-shadow:inset 0 -1px 0 rgba(0,0,0,0.15);box-shadow:inset 0 -1px 0 rgba(0,0,0,0.15);-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;-webkit-transition:width .6s ease;-moz-transition:width .6s ease;-o-transition:width .6s ease;transition:width .6s ease}.progress .bar+.bar{-webkit-box-shadow:inset 1px 0 0 rgba(0,0,0,0.15),inset 0 -1px 0 rgba(0,0,0,0.15);-moz-box-shadow:inset 1px 0 0 rgba(0,0,0,0.15),inset 0 -1px 0 rgba(0,0,0,0.15);box-shadow:inset 1px 0 0 rgba(0,0,0,0.15),inset 0 -1px 0 rgba(0,0,0,0.15)}.progress-striped .bar{backg
 round-color:#149bdf;background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,0.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,0.15)),color-stop(0.75,rgba(255,255,255,0.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-moz-linear-g

<TRUNCATED>

[14/21] aurora git commit: Remove unused classes from commons fork.

Posted by wf...@apache.org.
http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/thrift/callers/StatTrackingCaller.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/thrift/callers/StatTrackingCaller.java b/commons/src/main/java/org/apache/aurora/common/thrift/callers/StatTrackingCaller.java
deleted file mode 100644
index 514e665..0000000
--- a/commons/src/main/java/org/apache/aurora/common/thrift/callers/StatTrackingCaller.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.thrift.callers;
-
-import java.lang.reflect.Method;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-import javax.annotation.Nullable;
-
-import com.google.common.cache.CacheBuilder;
-import com.google.common.cache.CacheLoader;
-import com.google.common.cache.LoadingCache;
-
-import org.apache.aurora.common.thrift.TResourceExhaustedException;
-import org.apache.aurora.common.thrift.TTimeoutException;
-import org.apache.thrift.async.AsyncMethodCallback;
-
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-import org.apache.aurora.common.stats.StatsProvider;
-import org.apache.aurora.common.stats.StatsProvider.RequestTimer;
-
-/**
- * A caller that exports statistics about calls made to the wrapped caller.
- *
- * @author William Farner
- */
-public class StatTrackingCaller extends CallerDecorator {
-
-  private final StatsProvider statsProvider;
-  private final String serviceName;
-
-  private final LoadingCache<Method, RequestTimer> stats =
-      CacheBuilder.newBuilder().build(new CacheLoader<Method, RequestTimer>() {
-        @Override public RequestTimer load(Method method) {
-          // Thrift does not support overloads - so just the name disambiguates all calls.
-          return statsProvider.makeRequestTimer(serviceName + "_" + method.getName());
-        }
-      });
-
-  /**
-   * Creates a new stat tracking caller, which will export stats to the given {@link StatsProvider}.
-   *
-   * @param decoratedCaller The caller to decorate with a deadline.
-   * @param async Whether the caller is asynchronous.
-   * @param statsProvider The stat provider to export statistics to.
-   * @param serviceName The name of the service that methods are being called on.
-   */
-  public StatTrackingCaller(Caller decoratedCaller, boolean async, StatsProvider statsProvider,
-      String serviceName) {
-    super(decoratedCaller, async);
-
-    this.statsProvider = statsProvider;
-    this.serviceName = serviceName;
-  }
-
-  @Override
-  public Object call(Method method, Object[] args, @Nullable AsyncMethodCallback callback,
-      @Nullable Amount<Long, Time> connectTimeoutOverride) throws Throwable {
-    final RequestTimer requestStats = stats.get(method);
-    final long startTime = System.nanoTime();
-
-    ResultCapture capture = new ResultCapture() {
-      @Override public void success() {
-        requestStats.requestComplete(TimeUnit.NANOSECONDS.toMicros(
-            System.nanoTime() - startTime));
-      }
-
-      @Override public boolean fail(Throwable t) {
-        // TODO(John Sirois): the ruby client reconnects for timeouts too - this provides a natural
-        // backoff mechanism - consider how to plumb something similar.
-        if (t instanceof TTimeoutException || t instanceof TimeoutException) {
-          requestStats.incTimeouts();
-          return true;
-        }
-
-        // TODO(John Sirois): consider ditching reconnects since its nearly redundant with errors as
-        // it stands.
-        if (!(t instanceof TResourceExhaustedException)) {
-          requestStats.incReconnects();
-        }
-        // TODO(John Sirois): provide more detailed stats: track counts for distinct exceptions types,
-        // track retries-per-method, etc...
-        requestStats.incErrors();
-        return true;
-      }
-    };
-
-    return invoke(method, args, callback, capture, connectTimeoutOverride);
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/thrift/callers/ThriftCaller.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/thrift/callers/ThriftCaller.java b/commons/src/main/java/org/apache/aurora/common/thrift/callers/ThriftCaller.java
deleted file mode 100644
index 4e62940..0000000
--- a/commons/src/main/java/org/apache/aurora/common/thrift/callers/ThriftCaller.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.thrift.callers;
-
-import com.google.common.base.Function;
-import com.google.common.collect.Lists;
-import org.apache.aurora.common.net.pool.Connection;
-import org.apache.aurora.common.net.pool.ObjectPool;
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-import org.apache.aurora.common.net.pool.ResourceExhaustedException;
-import org.apache.aurora.common.thrift.TResourceExhaustedException;
-import org.apache.aurora.common.thrift.TTimeoutException;
-import org.apache.aurora.common.net.loadbalancing.RequestTracker;
-import org.apache.thrift.async.AsyncMethodCallback;
-import org.apache.thrift.transport.TTransport;
-
-import javax.annotation.Nullable;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.net.InetSocketAddress;
-import java.util.List;
-import java.util.concurrent.TimeoutException;
-import java.util.logging.Logger;
-
-/**
- * A caller that issues calls to a target that is assumed to be a client to a thrift service.
- *
- * @author William Farner
- */
-public class ThriftCaller<T> implements Caller {
-  private static final Logger LOG = Logger.getLogger(ThriftCaller.class.getName());
-
-  private final ObjectPool<Connection<TTransport, InetSocketAddress>> connectionPool;
-  private final RequestTracker<InetSocketAddress> requestTracker;
-  private final Function<TTransport, T> clientFactory;
-  private final Amount<Long, Time> timeout;
-  private final boolean debug;
-
-  /**
-   * Creates a new thrift caller.
-   *
-   * @param connectionPool The connection pool to use.
-   * @param requestTracker The request tracker to nofify of request results.
-   * @param clientFactory Factory to use for building client object instances.
-   * @param timeout The timeout to use when requesting objects from the connection pool.
-   * @param debug Whether to use the caller in debug mode.
-   */
-  public ThriftCaller(ObjectPool<Connection<TTransport, InetSocketAddress>> connectionPool,
-      RequestTracker<InetSocketAddress> requestTracker, Function<TTransport, T> clientFactory,
-      Amount<Long, Time> timeout, boolean debug) {
-
-    this.connectionPool = connectionPool;
-    this.requestTracker = requestTracker;
-    this.clientFactory = clientFactory;
-    this.timeout = timeout;
-    this.debug = debug;
-  }
-
-  @Override
-  public Object call(Method method, Object[] args, @Nullable AsyncMethodCallback callback,
-      @Nullable Amount<Long, Time> connectTimeoutOverride) throws Throwable {
-
-    final Connection<TTransport, InetSocketAddress> connection = getConnection(connectTimeoutOverride);
-    final long startNanos = System.nanoTime();
-
-    ResultCapture capture = new ResultCapture() {
-      @Override public void success() {
-        try {
-          requestTracker.requestResult(connection.getEndpoint(),
-              RequestTracker.RequestResult.SUCCESS, System.nanoTime() - startNanos);
-        } finally {
-          connectionPool.release(connection);
-        }
-      }
-
-      @Override public boolean fail(Throwable t) {
-        if (debug) {
-          LOG.warning(String.format("Call to endpoint: %s failed: %s", connection, t));
-        }
-
-        try {
-          requestTracker.requestResult(connection.getEndpoint(),
-              RequestTracker.RequestResult.FAILED, System.nanoTime() - startNanos);
-        } finally {
-          connectionPool.remove(connection);
-        }
-        return true;
-      }
-    };
-
-    return invokeMethod(clientFactory.apply(connection.get()), method, args, callback, capture);
-  }
-
-  private static Object invokeMethod(Object target, Method method, Object[] args,
-      AsyncMethodCallback callback, final ResultCapture capture) throws Throwable {
-
-    // Swap the wrapped callback out for ours.
-    if (callback != null) {
-      callback = new WrappedMethodCallback(callback, capture);
-
-      List<Object> argsList = Lists.newArrayList(args);
-      argsList.add(callback);
-      args = argsList.toArray();
-    }
-
-    try {
-      Object result = method.invoke(target, args);
-      if (callback == null) capture.success();
-
-      return result;
-    } catch (InvocationTargetException t) {
-      // We allow this one to go to both sync and async captures.
-      if (callback != null) {
-        callback.onError((Exception) t.getCause());
-        return null;
-      } else {
-        capture.fail(t.getCause());
-        throw t.getCause();
-      }
-    }
-  }
-
-  private Connection<TTransport, InetSocketAddress> getConnection(
-      Amount<Long, Time> connectTimeoutOverride)
-      throws TResourceExhaustedException, TTimeoutException {
-    try {
-      Connection<TTransport, InetSocketAddress> connection;
-      if (connectTimeoutOverride != null) {
-        connection = connectionPool.get(connectTimeoutOverride);
-      } else {
-        connection = (timeout.getValue() > 0)
-            ? connectionPool.get(timeout) : connectionPool.get();
-      }
-
-      if (connection == null) {
-        throw new TResourceExhaustedException("no connection was available");
-      }
-      return connection;
-    } catch (ResourceExhaustedException e) {
-      throw new TResourceExhaustedException(e);
-    } catch (TimeoutException e) {
-      throw new TTimeoutException(e);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/thrift/monitoring/TMonitoredNonblockingServerSocket.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/thrift/monitoring/TMonitoredNonblockingServerSocket.java b/commons/src/main/java/org/apache/aurora/common/thrift/monitoring/TMonitoredNonblockingServerSocket.java
deleted file mode 100644
index a14f53a4..0000000
--- a/commons/src/main/java/org/apache/aurora/common/thrift/monitoring/TMonitoredNonblockingServerSocket.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.thrift.monitoring;
-
-import com.google.common.base.Preconditions;
-import org.apache.aurora.common.net.monitoring.ConnectionMonitor;
-import org.apache.thrift.transport.TNonblockingServerSocket;
-import org.apache.thrift.transport.TNonblockingSocket;
-import org.apache.thrift.transport.TTransportException;
-
-import java.net.InetSocketAddress;
-
-/**
- * Extension of TNonblockingServerSocket that allows for tracking of connected clients.
- *
- * @author William Farner
- */
-public class TMonitoredNonblockingServerSocket extends TNonblockingServerSocket {
-  private final ConnectionMonitor monitor;
-
-  public TMonitoredNonblockingServerSocket(int port, ConnectionMonitor monitor)
-      throws TTransportException {
-    super(port);
-    this.monitor = Preconditions.checkNotNull(monitor);
-  }
-
-  public TMonitoredNonblockingServerSocket(int port, int clientTimeout, ConnectionMonitor monitor)
-      throws TTransportException {
-    super(port, clientTimeout);
-    this.monitor = Preconditions.checkNotNull(monitor);
-  }
-
-  public TMonitoredNonblockingServerSocket(InetSocketAddress bindAddr, ConnectionMonitor monitor)
-      throws TTransportException {
-    super(bindAddr);
-    this.monitor = Preconditions.checkNotNull(monitor);
-  }
-
-  public TMonitoredNonblockingServerSocket(InetSocketAddress bindAddr, int clientTimeout,
-      ConnectionMonitor monitor) throws TTransportException {
-    super(bindAddr, clientTimeout);
-    this.monitor = Preconditions.checkNotNull(monitor);
-  }
-
-  @Override
-  protected TNonblockingSocket acceptImpl() throws TTransportException {
-    /* TODO(William Farner): Finish implementing...may require an object proxy.
-    final TNonblockingSocket socket = super.acceptImpl();
-
-    TNonblockingSocket wrappedSocket = new TNonblockingSocket(socket.get) {
-      @Override public void close() {
-        super.close();
-        monitor.disconnected(this);
-      }
-    };
-
-    monitor.connected(wrappedSocket, socket.getSocket().getInetAddress());
-
-    return wrappedSocket;
-
-    */
-    return super.acceptImpl();
-  }
-
-  @Override
-  public void close() {
-    super.close();
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/thrift/monitoring/TMonitoredProcessor.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/thrift/monitoring/TMonitoredProcessor.java b/commons/src/main/java/org/apache/aurora/common/thrift/monitoring/TMonitoredProcessor.java
deleted file mode 100644
index a0d7d5f..0000000
--- a/commons/src/main/java/org/apache/aurora/common/thrift/monitoring/TMonitoredProcessor.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.thrift.monitoring;
-
-import com.google.common.base.Preconditions;
-import org.apache.aurora.common.net.loadbalancing.RequestTracker;
-import org.apache.thrift.TException;
-import org.apache.thrift.TProcessor;
-import org.apache.thrift.protocol.TProtocol;
-import org.apache.thrift.transport.TSocket;
-
-import java.net.InetSocketAddress;
-
-import static org.apache.aurora.common.net.loadbalancing.RequestTracker.RequestResult.*;
-
-/**
- * A TProcessor that joins a wrapped TProcessor with a monitor.
- *
- * @author William Farner
- */
-public class TMonitoredProcessor implements TProcessor {
-  private final TProcessor wrapped;
-  private final TMonitoredServerSocket monitoredServerSocket;
-  private final RequestTracker<InetSocketAddress> monitor;
-
-  public TMonitoredProcessor(TProcessor wrapped, TMonitoredServerSocket monitoredServerSocket,
-      RequestTracker<InetSocketAddress> monitor) {
-    this.wrapped = Preconditions.checkNotNull(wrapped);
-    this.monitoredServerSocket = Preconditions.checkNotNull(monitoredServerSocket);
-    this.monitor = Preconditions.checkNotNull(monitor);
-  }
-
-  @Override
-  public boolean process(TProtocol in, TProtocol out) throws TException {
-    long startNanos = System.nanoTime();
-    boolean exceptionThrown = false;
-    try {
-      return wrapped.process(in, out);
-    } catch (TException e) {
-      exceptionThrown = true;
-      throw e;
-    } finally {
-      InetSocketAddress address = monitoredServerSocket.getAddress((TSocket) in.getTransport());
-      Preconditions.checkState(address != null,
-          "Address unknown for transport " + in.getTransport());
-
-      monitor.requestResult(address, exceptionThrown ? FAILED : SUCCESS,
-          System.nanoTime() - startNanos);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/thrift/monitoring/TMonitoredServerSocket.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/thrift/monitoring/TMonitoredServerSocket.java b/commons/src/main/java/org/apache/aurora/common/thrift/monitoring/TMonitoredServerSocket.java
deleted file mode 100644
index f4405c4..0000000
--- a/commons/src/main/java/org/apache/aurora/common/thrift/monitoring/TMonitoredServerSocket.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.thrift.monitoring;
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Maps;
-import org.apache.aurora.common.net.monitoring.ConnectionMonitor;
-import org.apache.thrift.transport.TServerSocket;
-import org.apache.thrift.transport.TSocket;
-import org.apache.thrift.transport.TTransportException;
-
-import java.net.InetSocketAddress;
-import java.net.ServerSocket;
-import java.util.Collections;
-import java.util.Map;
-
-/**
- * Extension of TServerSocket that allows for tracking of connected clients.
- *
- * @author William Farner
- */
-public class TMonitoredServerSocket extends TServerSocket {
-  private ConnectionMonitor<InetSocketAddress> monitor;
-
-  public TMonitoredServerSocket(ServerSocket serverSocket,
-      ConnectionMonitor<InetSocketAddress> monitor) {
-    super(serverSocket);
-    this.monitor = Preconditions.checkNotNull(monitor);
-  }
-
-  public TMonitoredServerSocket(ServerSocket serverSocket, int clientTimeout,
-      ConnectionMonitor<InetSocketAddress> monitor) {
-    super(serverSocket, clientTimeout);
-    this.monitor = Preconditions.checkNotNull(monitor);
-  }
-
-  public TMonitoredServerSocket(int port, ConnectionMonitor<InetSocketAddress> monitor)
-      throws TTransportException {
-    super(port);
-    this.monitor = Preconditions.checkNotNull(monitor);
-  }
-
-  public TMonitoredServerSocket(int port, int clientTimeout,
-      ConnectionMonitor<InetSocketAddress> monitor) throws TTransportException {
-    super(port, clientTimeout);
-    this.monitor = Preconditions.checkNotNull(monitor);
-  }
-
-  public TMonitoredServerSocket(InetSocketAddress bindAddr,
-      ConnectionMonitor<InetSocketAddress> monitor) throws TTransportException {
-    super(bindAddr);
-    this.monitor = Preconditions.checkNotNull(monitor);
-  }
-
-  public TMonitoredServerSocket(InetSocketAddress bindAddr, int clientTimeout,
-      ConnectionMonitor<InetSocketAddress> monitor) throws TTransportException {
-    super(bindAddr, clientTimeout);
-    this.monitor = Preconditions.checkNotNull(monitor);
-  }
-
-  private final Map<TSocket, InetSocketAddress> addressMap =
-      Collections.synchronizedMap(Maps.<TSocket, InetSocketAddress>newHashMap());
-
-  public InetSocketAddress getAddress(TSocket socket) {
-    return addressMap.get(socket);
-  }
-
-  @Override
-  protected TSocket acceptImpl() throws TTransportException {
-    final TSocket socket = super.acceptImpl();
-    final InetSocketAddress remoteAddress =
-        (InetSocketAddress) socket.getSocket().getRemoteSocketAddress();
-
-    TSocket monitoredSocket = new TSocket(socket.getSocket()) {
-      boolean closed = false;
-
-      @Override public void close() {
-        try {
-          super.close();
-        } finally {
-          if (!closed) {
-            monitor.released(remoteAddress);
-            addressMap.remove(this);
-          }
-          closed = true;
-        }
-      }
-    };
-
-    addressMap.put(monitoredSocket, remoteAddress);
-
-    monitor.connected(remoteAddress);
-    return monitoredSocket;
-  }
-
-  @Override
-  public void close() {
-    super.close();
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/thrift/testing/MockTSocket.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/thrift/testing/MockTSocket.java b/commons/src/main/java/org/apache/aurora/common/thrift/testing/MockTSocket.java
deleted file mode 100644
index 2cec711..0000000
--- a/commons/src/main/java/org/apache/aurora/common/thrift/testing/MockTSocket.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.thrift.testing;
-
-import org.apache.thrift.transport.TSocket;
-
-/**
- * @author William Farner
- */
-public class MockTSocket extends TSocket {
-  public static final String HOST = "dummyHost";
-  public static final int PORT = 1000;
-
-  private boolean connected = false;
-
-  public MockTSocket() {
-    super(HOST, PORT);
-  }
-
-  @Override
-  public void open() {
-    connected = true;
-    // TODO(William Farner): Allow for failure injection here by throwing TTransportException.
-  }
-
-  @Override
-  public boolean isOpen() {
-    return connected;
-  }
-
-  public void close() {
-    connected = false;
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/thrift/testing/TestThriftTypes.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/thrift/testing/TestThriftTypes.java b/commons/src/main/java/org/apache/aurora/common/thrift/testing/TestThriftTypes.java
index 377228f..1699416 100644
--- a/commons/src/main/java/org/apache/aurora/common/thrift/testing/TestThriftTypes.java
+++ b/commons/src/main/java/org/apache/aurora/common/thrift/testing/TestThriftTypes.java
@@ -13,8 +13,12 @@
  */
 package org.apache.aurora.common.thrift.testing;
 
+import java.util.Map;
+import java.util.Map.Entry;
+
 import com.google.common.base.Preconditions;
 import com.google.common.collect.Maps;
+
 import org.apache.thrift.TBase;
 import org.apache.thrift.TBaseHelper;
 import org.apache.thrift.TException;
@@ -24,9 +28,6 @@ import org.apache.thrift.protocol.TProtocol;
 import org.apache.thrift.protocol.TStruct;
 import org.apache.thrift.protocol.TType;
 
-import java.util.Map;
-import java.util.Map.Entry;
-
 /**
  * Hand-coded thrift types for use in tests.
  *

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/util/DateUtils.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/util/DateUtils.java b/commons/src/main/java/org/apache/aurora/common/util/DateUtils.java
deleted file mode 100644
index eb20925..0000000
--- a/commons/src/main/java/org/apache/aurora/common/util/DateUtils.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.util;
-
-import java.util.Calendar;
-import java.util.Date;
-import java.util.concurrent.TimeUnit;
-
-/**
- * Utilities for working with java {@link Date}s.
- *
- * @author John Sirois
- */
-public final class DateUtils {
-
-  public static Date now() {
-    return new Date();
-  }
-
-  public static long toUnixTime(Date date) {
-    return toUnixTime(date.getTime());
-  }
-
-  public static long nowUnixTime() {
-    return toUnixTime(System.currentTimeMillis());
-  }
-
-  public static long toUnixTime(long millisSinceEpoch) {
-    return TimeUnit.MILLISECONDS.toSeconds(millisSinceEpoch);
-  }
-
-  public static Date ago(int calendarField, int amount) {
-    return ago(now(), calendarField, amount);
-  }
-
-   public static Date ago(Date referenceDate, int calendarField, int amount) {
-    Calendar calendar = Calendar.getInstance();
-    calendar.setTime(referenceDate);
-    calendar.add(calendarField, -1 * amount);
-    return calendar.getTime();
-  }
-
-  private DateUtils() {
-    // utility
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/util/FileUtils.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/util/FileUtils.java b/commons/src/main/java/org/apache/aurora/common/util/FileUtils.java
deleted file mode 100644
index 9b23ee0..0000000
--- a/commons/src/main/java/org/apache/aurora/common/util/FileUtils.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.util;
-
-import java.io.File;
-
-/**
- * Utilities for working with Files
- *
- * @author Florian Leibert
- */
-public final class FileUtils {
-
-  private FileUtils() {
-  }
-
-  /**
-   * recursively deletes the path and all it's content and returns true if it succeeds
-   * Note that the content could be partially deleted and the method return false
-   *
-   * @param path the path to delete
-   * @return true if the path was deleted
-   */
-  public static boolean forceDeletePath(File path) {
-    if (path == null) {
-      return false;
-    }
-    if (path.exists() && path.isDirectory()) {
-      File[] files = path.listFiles();
-      for (File file : files) {
-        if (file.isDirectory()) {
-          forceDeletePath(file);
-        } else {
-          file.delete();
-        }
-      }
-    }
-    return path.delete();
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/util/LowResClock.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/util/LowResClock.java b/commons/src/main/java/org/apache/aurora/common/util/LowResClock.java
deleted file mode 100644
index 69fb9ed..0000000
--- a/commons/src/main/java/org/apache/aurora/common/util/LowResClock.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.util;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
-
-import java.io.Closeable;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ScheduledFuture;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-
-/**
- * Low resolution implementation of a {@link Clock},
- * optimized for fast reads at the expense of precision.
- * It works by caching the result of the system clock for a
- * {@code resolution} amount of time.
- */
-public class LowResClock implements Clock, Closeable {
-  private static final ScheduledExecutorService GLOBAL_SCHEDULER =
-      Executors.newScheduledThreadPool(1, new ThreadFactory() {
-        public Thread newThread(Runnable r) {
-          Thread t = new Thread(r, "LowResClock");
-          t.setDaemon(true);
-          return t;
-        }
-      });
-
-  private volatile long time;
-  private final ScheduledFuture<?> updaterHandler;
-  private final Clock underlying;
-
-  @VisibleForTesting
-  LowResClock(Amount<Long, Time> resolution, ScheduledExecutorService executor, Clock clock) {
-    long sleepTimeMs = resolution.as(Time.MILLISECONDS);
-    Preconditions.checkArgument(sleepTimeMs > 0);
-    underlying = clock;
-    Runnable ticker = new Runnable() {
-      @Override public void run() {
-        time = underlying.nowMillis();
-      }
-    };
-
-    // Ensure the constructing thread sees a LowResClock with a valid (low-res) time by executing a
-    // blocking call now.
-    ticker.run();
-
-    updaterHandler =
-        executor.scheduleAtFixedRate(ticker, sleepTimeMs, sleepTimeMs, TimeUnit.MILLISECONDS);
-  }
-
-
-  /**
-   * Construct a LowResClock which wraps the system clock.
-   * This constructor will also schedule a periodic task responsible for
-   * updating the time every {@code resolution}.
-   */
-  public LowResClock(Amount<Long, Time> resolution) {
-    this(resolution, GLOBAL_SCHEDULER, Clock.SYSTEM_CLOCK);
-  }
-
-  /**
-   * Terminate the underlying updater task.
-   * Any subsequent usage of the clock will throw an {@link IllegalStateException}.
-   */
-  public void close() {
-    updaterHandler.cancel(true);
-  }
-
-  @Override
-  public long nowMillis() {
-    checkNotClosed();
-    return time;
-  }
-
-  @Override
-  public long nowNanos() {
-    return nowMillis() * 1000 * 1000;
-  }
-
-  @Override
-  public void waitFor(long millis) throws InterruptedException {
-    checkNotClosed();
-    underlying.waitFor(millis);
-  }
-
-  private void checkNotClosed() {
-    if (updaterHandler.isCancelled()) {
-      throw new IllegalStateException("LowResClock invoked after being closed!");
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/util/ParsingUtil.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/util/ParsingUtil.java b/commons/src/main/java/org/apache/aurora/common/util/ParsingUtil.java
deleted file mode 100644
index 0747e7a..0000000
--- a/commons/src/main/java/org/apache/aurora/common/util/ParsingUtil.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.util;
-
-import com.google.common.base.Preconditions;
-
-import org.apache.aurora.common.collections.Pair;
-
-/**
- * Common methods for parsing configs.
- *
- * @author John Sirois
- */
-public class ParsingUtil {
-  /**
-   * Parses a string as a range between one integer and another.  The integers must be separated by
-   * a hypen character (space padding is acceptable).  Additionally, the first integer
-   * (left-hand side) must be less than or equal to the second (right-hand side).
-   *
-   * @param rangeString The string to parse as an integer range.
-   * @return A pair of the parsed integers.
-   */
-  public static Pair<Integer, Integer> parseRange(String rangeString) {
-    if (rangeString == null) return null;
-
-    String[] startEnd = rangeString.split("-");
-    Preconditions.checkState(
-        startEnd.length == 2, "Shard range format: start-end (e.g. 1-4)");
-    int start;
-    int end;
-    try {
-      start = Integer.parseInt(startEnd[0].trim());
-      end = Integer.parseInt(startEnd[1].trim());
-    } catch (NumberFormatException e) {
-      throw new IllegalArgumentException("Failed to parse shard range.", e);
-    }
-
-    Preconditions.checkState(
-        start <= end, "The left-hand side of a shard range must be <= the right-hand side.");
-    return Pair.of(start, end);
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/util/QueueDrainer.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/util/QueueDrainer.java b/commons/src/main/java/org/apache/aurora/common/util/QueueDrainer.java
deleted file mode 100644
index 243cf33..0000000
--- a/commons/src/main/java/org/apache/aurora/common/util/QueueDrainer.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.util;
-
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.Executor;
-
-import com.google.common.base.Preconditions;
-
-/**
- * Joins a task queue with an executor service, to add control over when
- * tasks are actually made available for execution.
- *
- * @author Srinivasan Rajagopal
- */
-public class QueueDrainer<T extends Runnable> implements Runnable {
-
-  private final Executor taskExecutor;
-  private final BlockingQueue<T> blockingQueue;
-
-  /**
-   * Creates a QueueDrainer that associates the queue with an executorService.
-   *
-   * @param taskExecutor Executor to execute a task if present.
-   * @param blockingQueue Queue to poll if there is a runnable to execute.
-   */
-  public QueueDrainer(Executor taskExecutor, BlockingQueue<T> blockingQueue) {
-    this.taskExecutor = Preconditions.checkNotNull(taskExecutor);
-    this.blockingQueue = Preconditions.checkNotNull(blockingQueue);
-  }
-
-  /**
-   * Picks tasks from the Queue to execute if present else no-op.
-   */
-  @Override
-  public void run() {
-    Runnable command = blockingQueue.poll();
-    if (command != null) {
-      taskExecutor.execute(command);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/util/RangeNormalizer.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/util/RangeNormalizer.java b/commons/src/main/java/org/apache/aurora/common/util/RangeNormalizer.java
deleted file mode 100644
index 3e4de30..0000000
--- a/commons/src/main/java/org/apache/aurora/common/util/RangeNormalizer.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-//************************************************************************
-//
-//                      Summize
-//
-// This work protected by US Copyright Law and contains proprietary and
-// confidential trade secrets.
-//
-// (c) Copyright 2006 Summize,  ALL RIGHTS RESERVED.
-//
-//************************************************************************
-package org.apache.aurora.common.util;
-
-/**
- * Generic range normalizer class. Values must be positive.
- *
- * @author Abdur Chowdhury
- */
-public class RangeNormalizer {
-  public RangeNormalizer(double minA, double maxA, double minB, double maxB) {
-    _minA = minA;
-    _maxA = maxA;
-    _minB = minB;
-    _maxB = maxB;
-    _denominator = (_maxA - _minA);
-    _B = (_maxB - _minB);
-    _midB = minB + (_B / 2f);
-  }
-
-  public double normalize(double value) {
-    // if no input range, return a mid range value
-    if (_denominator == 0) {
-      return _midB;
-    }
-
-    return ((value - _minA) / _denominator) * _B + _minB;
-  }
-
-  public static double normalize(double value, double minA, double maxA, double minB, double maxB) {
-    // if the source min and max are equal, don't return 0, return something
-    // in the target range (perhaps this "default" should be another argument)
-    if (minA == maxA) {
-      return minB;
-    }
-
-    return ((value - minA) / (maxA - minA)) * (maxB - minB) + minB;
-  }
-
-  public static float normalizeToStepDistribution(double rating) {
-    int integerRating = (int) Math.round(rating);
-
-    if (integerRating == 2) {
-      integerRating = 1;
-    } else if (integerRating == 4) {
-      integerRating = 3;
-    } else if (integerRating == 6) {
-      integerRating = 5;
-    } else if (integerRating == 8) {
-      integerRating = 7;
-    } else if (integerRating == 9) {
-      integerRating = 10;
-    }
-
-    return (float) integerRating;
-  }
-
-  // *******************************************************************
-  private double _denominator;
-  private double _B;
-  private double _minA = Double.MIN_VALUE;
-  private double _maxA = Double.MAX_VALUE;
-  private double _minB = Double.MIN_VALUE;
-  private double _maxB = Double.MAX_VALUE;
-  private double _midB = Double.MAX_VALUE;
-}
-

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/util/RateLimitedCommandExecutor.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/util/RateLimitedCommandExecutor.java b/commons/src/main/java/org/apache/aurora/common/util/RateLimitedCommandExecutor.java
deleted file mode 100644
index 05b3c5f..0000000
--- a/commons/src/main/java/org/apache/aurora/common/util/RateLimitedCommandExecutor.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.util;
-
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.apache.aurora.common.base.ExceptionalCommand;
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * CommandExecutor that invokes {@code queueDrainer} with a best-effort
- * mechanism to execute with a fixed interval between requests of {@code
- * intervalBetweenRequests}.
- *
- * @author Srinivasan Rajagopal
- */
-public class RateLimitedCommandExecutor implements CommandExecutor {
-
-  private static final Logger LOG = Logger.getLogger(RateLimitedCommandExecutor.class.getName());
-
-  private final BlockingQueue<RetryingRunnable<?>> blockingQueue;
-
-  /**
-   * Create a CommandExecutor that executes enquequed tasks in the task
-   * executor with specified interval between executions.
-   *
-   * @param taskExecutor executor for periodic execution of enqueued tasks.
-   * @param intervalBetweenRequests interval between requests to rate limit
-   * request rate.
-   * @param queueDrainer A runnable that is responsible for draining the queue.
-   * @param blockingQueue Queue to keep outstanding work in.
-   */
-  public RateLimitedCommandExecutor(
-      ScheduledExecutorService taskExecutor,
-      Amount<Long, Time> intervalBetweenRequests,
-      Runnable queueDrainer,
-      BlockingQueue<RetryingRunnable<?>> blockingQueue) {
-
-    checkNotNull(taskExecutor);
-    checkNotNull(intervalBetweenRequests);
-    checkArgument(intervalBetweenRequests.as(Time.MILLISECONDS) > 0);
-    checkNotNull(queueDrainer);
-    this.blockingQueue = checkNotNull(blockingQueue);
-    taskExecutor.scheduleWithFixedDelay(
-        getSafeRunner(queueDrainer),
-        0,
-        intervalBetweenRequests.as(Time.MILLISECONDS),
-        TimeUnit.MILLISECONDS);
-  }
-
-  private static Runnable getSafeRunner(final Runnable runnable) {
-    return new Runnable() {
-      @Override public void run() {
-        try {
-          runnable.run();
-        } catch (RuntimeException t) {
-          LOG.log(Level.INFO, " error processing task " + runnable);
-        }
-      }
-    };
-  }
-
-  @Override
-  public <E extends Exception> void execute(String name, ExceptionalCommand<E> task,
-      Class<E> exceptionClass, int numTries, Amount<Long, Time> retryDelay) {
-    blockingQueue.add(new RetryingRunnable<E>(name, task, exceptionClass,
-        numTries, retryDelay, this));
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/util/RetryingRunnable.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/util/RetryingRunnable.java b/commons/src/main/java/org/apache/aurora/common/util/RetryingRunnable.java
deleted file mode 100644
index 2f66d13..0000000
--- a/commons/src/main/java/org/apache/aurora/common/util/RetryingRunnable.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.util;
-
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import com.google.common.base.Throwables;
-
-import org.apache.commons.lang.builder.ToStringBuilder;
-
-import org.apache.aurora.common.base.ExceptionalCommand;
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * A runnable task that is retried in a user-configurable fashion.
- *
- * @param <E> The type of exception that the ExceptionalCommand throws.
- *
- * @author Utkarsh Srivastava
- */
-public class RetryingRunnable<E extends Exception> implements Runnable {
-  private final String name;
-  private final int tryNum;
-  private final int numTries;
-  private final Amount<Long, Time> retryDelay;
-  private final ExceptionalCommand<E> task;
-  private final CommandExecutor commandExecutor;
-  private final Class<E> exceptionClass;
-
-  private static final Logger LOG = Logger.getLogger(RetryingRunnable.class.getName());
-
-  /**
-   * Create a Task with name {@code name} that executes at most {@code  numTries}
-   * in case of failure with an interval of {@code retryDelay} between attempts.
-   *
-   * @param name Human readable name for this task.
-   * @param task the task to execute.
-   * @param exceptionClass class of the exception thrown by the task.
-   * @param numTries the total number of times to try.
-   * @param retryDelay the delay between successive tries.
-   * @param commandExecutor Executor to resubmit retries to.
-   * @param tryNum the seq number of this try.
-   */
-  public RetryingRunnable(
-      String name,
-      ExceptionalCommand<E> task,
-      Class<E> exceptionClass,
-      int numTries,
-      Amount<Long, Time> retryDelay,
-      CommandExecutor commandExecutor,
-      int tryNum) {
-
-    this.name = checkNotNull(name);
-    this.task = checkNotNull(task);
-    this.exceptionClass = checkNotNull(exceptionClass);
-    this.retryDelay = checkNotNull(retryDelay);
-    this.commandExecutor = checkNotNull(commandExecutor);
-    checkArgument(numTries > 0);
-    this.tryNum = tryNum;
-    this.numTries = numTries;
-  }
-
-  /**
-   * Create a Task with name {@code name} that executes at most {@code numTries}
-   * in case of failure with an interval of {@code retryDelay} between attempts
-   *  and sets tryNum to be the first (=1).
-   *
-   * @param name Human readable name for this task.
-   * @param task the task to execute.
-   * @param exceptionClass class of the exception thrown by the task.
-   * @param numTries the total number of times to try.
-   * @param retryDelay the delay between successive tries.
-   * @param commandExecutor Executor to resubmit retries to.
-   */
-  public RetryingRunnable(
-      String name,
-      ExceptionalCommand<E> task,
-      Class<E> exceptionClass,
-      int numTries,
-      Amount<Long, Time> retryDelay,
-      CommandExecutor commandExecutor) {
-
-    this(name, task, exceptionClass, numTries, retryDelay, commandExecutor, /*tryNum=*/ 1);
-  }
-
-  @Override
-  public void run() {
-    try {
-      task.execute();
-    } catch (Exception e) {
-      if (e.getClass().isAssignableFrom(exceptionClass)) {
-        if (tryNum < numTries) {
-          commandExecutor.execute(name, task, exceptionClass, numTries - 1, retryDelay);
-        } else {
-          LOG.log(Level.INFO, "Giving up on task: " + name + " "
-              + "after " + "trying " + numTries + " times" + ".", e);
-        }
-      } else {
-        LOG.log(Level.INFO, "Giving up on task: " + name + " after trying "
-            + numTries + " times. " + "due to unhandled exception ", e);
-        throw Throwables.propagate(e);
-      }
-    }
-  }
-
-  @Override
-  public String toString() {
-    return new ToStringBuilder(this)
-        .append("name", name)
-        .append("tryNum", tryNum)
-        .append("numTries", numTries)
-        .append("retryDelay", retryDelay)
-        .toString();
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/util/caching/Cache.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/util/caching/Cache.java b/commons/src/main/java/org/apache/aurora/common/util/caching/Cache.java
deleted file mode 100644
index 72605ed..0000000
--- a/commons/src/main/java/org/apache/aurora/common/util/caching/Cache.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.util.caching;
-
-/**
- * Definition of basic caching functionality.  Cache keys and values are expected to always be
- * valid, non-null values.
- *
- * @author William Farner
- */
-public interface Cache<K, V> {
-
-  /**
-   * Fetches a value from the cache.
-   *
-   * @param key The key for the value to fetch, must not be {@code null}.
-   * @return The cached value corresponding with {@code key}, or {@code null} if no entry exists.
-   */
-  public V get(K key);
-
-  /**
-   * Stores a key-value pair in the cache.
-   *
-   * @param key The key to store, must not be {@code null}.
-   * @param value The value to store, must not be {@code null}.
-   */
-  public void put(K key, V value);
-
-  /**
-   * Deletes an entry from the cache.
-   *
-   * @param key Key for the value to delete, must not be {@code null}.
-   */
-  public void delete(K key);
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/util/caching/CachingMethodProxy.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/util/caching/CachingMethodProxy.java b/commons/src/main/java/org/apache/aurora/common/util/caching/CachingMethodProxy.java
deleted file mode 100644
index 96a5377..0000000
--- a/commons/src/main/java/org/apache/aurora/common/util/caching/CachingMethodProxy.java
+++ /dev/null
@@ -1,262 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.util.caching;
-
-import com.google.common.base.Function;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Predicate;
-import com.google.common.base.Predicates;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Maps;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
-/**
- * A proxy class that handles caching of return values for method calls to a wrapped object.
- *
- * Example usage:
- *
- *   Foo uncached = new Foo();
- *   CachingMethodProxy<Foo> methodProxy = CachingMethodProxy.proxyFor(uncached, Foo.class);
- *   Foo foo = methodProxy.getCachingProxy();
- *   methodProxy.cache(foo.doBar(), lruCache1)
- *              .cache(foo.doBaz(), lruCache2)
- *              .prepare();
- *
- * @author William Farner
- */
-public class CachingMethodProxy<T> {
-
-  // Dummy return values to return when in recording state.
-  private static final Map<Class<?>, Object> EMPTY_RETURN_VALUES =
-      ImmutableMap.<Class<?>, Object>builder()
-      .put(Boolean.TYPE, Boolean.FALSE)
-      .put(Byte.TYPE, Byte.valueOf((byte) 0))
-      .put(Short.TYPE, Short.valueOf((short) 0))
-      .put(Character.TYPE, Character.valueOf((char)0))
-      .put(Integer.TYPE, Integer.valueOf(0))
-      .put(Long.TYPE, Long.valueOf(0))
-      .put(Float.TYPE, Float.valueOf(0))
-      .put(Double.TYPE, Double.valueOf(0))
-      .build();
-  private static final Map<Class<?>, Class<?>> AUTO_BOXING_MAP =
-      ImmutableMap.<Class<?>, Class<?>>builder()
-      .put(Boolean.TYPE, Boolean.class)
-      .put(Byte.TYPE, Byte.class)
-      .put(Short.TYPE, Short.class)
-      .put(Character.TYPE, Character.class)
-      .put(Integer.TYPE, Integer.class)
-      .put(Long.TYPE, Long.class)
-      .put(Float.TYPE, Float.class)
-      .put(Double.TYPE, Double.class)
-      .build();
-
-  // The uncached resource, whose method calls are deemed to be expensive and cacheable.
-  private final T uncached;
-
-  // The methods that are cached, and the caches themselves.
-  private final Map<Method, MethodCache> methodCaches = Maps.newHashMap();
-  private final Class<T> type;
-
-  private Method lastMethodCall = null;
-  private boolean recordMode = true;
-
-  /**
-   * Creates a new caching method proxy that will wrap an object and cache for the provided methods.
-   *
-   * @param uncached The uncached object that will be reverted to when a cache entry is not present.
-   */
-  private CachingMethodProxy(T uncached, Class<T> type) {
-    this.uncached = Preconditions.checkNotNull(uncached);
-    this.type = Preconditions.checkNotNull(type);
-    Preconditions.checkArgument(type.isInterface(), "The proxied type must be an interface.");
-  }
-
-  private static Object invokeMethod(Object subject, Method method, Object[] args)
-      throws Throwable {
-    try {
-      return method.invoke(subject, args);
-    } catch (IllegalAccessException e) {
-      throw new RuntimeException("Cannot access " + subject.getClass() + "." + method, e);
-    } catch (InvocationTargetException e) {
-      throw e.getCause();
-    }
-  }
-
-  /**
-   * A cached method and its caching control structures.
-   *
-   * @param <K> Cache key type.
-   * @param <V> Cache value type, expected to match the return type of the method.
-   */
-  private static class MethodCache<K, V> {
-    private final Method method;
-    private final Cache<K, V> cache;
-    private final Function<Object[], K> keyBuilder;
-    private final Predicate<V> entryFilter;
-
-    MethodCache(Method method, Cache<K, V> cache, Function<Object[], K> keyBuilder,
-        Predicate<V> entryFilter) {
-      this.method = method;
-      this.cache = cache;
-      this.keyBuilder = keyBuilder;
-      this.entryFilter = entryFilter;
-    }
-
-    V doInvoke(Object uncached, Object[] args) throws Throwable {
-      K key = keyBuilder.apply(args);
-
-      V cachedValue = cache.get(key);
-
-      if (cachedValue != null) return cachedValue;
-
-      Object fetched = invokeMethod(uncached, method, args);
-
-      if (fetched == null) return null;
-
-      @SuppressWarnings("unchecked")
-      V typedValue = (V) fetched;
-
-      if (entryFilter.apply(typedValue)) cache.put(key, typedValue);
-
-      return typedValue;
-    }
-  }
-
-  /**
-   * Creates a new builder for the given type.
-   *
-   * @param uncached The uncached object that should be insulated by caching.
-   * @param type The interface that a proxy should be created for.
-   * @param <T> Type parameter to the proxied class.
-   * @return A new builder.
-   */
-  public static <T> CachingMethodProxy<T> proxyFor(T uncached, Class<T> type) {
-    return new CachingMethodProxy<T>(uncached, type);
-  }
-
-  @SuppressWarnings("unchecked")
-  public T getCachingProxy() {
-    return (T) Proxy.newProxyInstance(type.getClassLoader(), new Class[] { type },
-        new InvocationHandler() {
-          @Override public Object invoke(Object proxy, Method method, Object[] args)
-              throws Throwable {
-            return doInvoke(method, args);
-          }
-        });
-  }
-
-  private Object doInvoke(Method method, Object[] args) throws Throwable {
-    return recordMode ? recordCall(method) : cacheRequest(method, args);
-  }
-
-  private Object recordCall(Method method) {
-    Preconditions.checkArgument(method.getReturnType() != Void.TYPE,
-        "Void return methods cannot be cached: " + method);
-    Preconditions.checkArgument(method.getParameterTypes().length > 0,
-        "Methods with zero arguments cannot be cached: " + method);
-    Preconditions.checkState(lastMethodCall == null,
-        "No cache instructions provided for call to: " + lastMethodCall);
-
-    lastMethodCall = method;
-
-    Class<?> returnType = method.getReturnType();
-    return returnType.isPrimitive() ? EMPTY_RETURN_VALUES.get(returnType) : null;
-  }
-
-  private Object cacheRequest(Method method, Object[] args) throws Throwable {
-    MethodCache cache = methodCaches.get(method);
-
-    // Check if we are caching for this method.
-    if (cache == null) return invokeMethod(uncached, method, args);
-
-    return cache.doInvoke(uncached, args);
-  }
-
-  /**
-   * Instructs the proxy that cache setup is complete, and the proxy instance should begin caching
-   * and delegating uncached calls.  After this is called, any subsequent calls to any of the
-   * cache setup methods will result in an {@link IllegalStateException}.
-   */
-  public void prepare() {
-    Preconditions.checkState(!methodCaches.isEmpty(), "At least one method must be cached.");
-    Preconditions.checkState(recordMode, "prepare() may only be invoked once.");
-
-    recordMode = false;
-  }
-
-  public <V> CachingMethodProxy<T> cache(V value, Cache<List, V> cache) {
-    return cache(value, cache, Predicates.<V>alwaysTrue());
-  }
-
-  public <V> CachingMethodProxy<T> cache(V value, Cache<List, V> cache,
-      Predicate<V> valueFilter) {
-    return cache(value, cache, DEFAULT_KEY_BUILDER, valueFilter);
-  }
-
-  public <K, V> CachingMethodProxy<T> cache(V value, Cache<K, V> cache,
-      Function<Object[], K> keyBuilder) {
-    // Get the last method call and declare it the cached method.
-    return cache(value, cache, keyBuilder, Predicates.<V>alwaysTrue());
-  }
-
-  public <K, V> CachingMethodProxy<T> cache(V value, Cache<K, V> cache,
-      Function<Object[], K> keyBuilder, Predicate<V> valueFilter) {
-    Preconditions.checkNotNull(cache);
-    Preconditions.checkNotNull(keyBuilder);
-    Preconditions.checkNotNull(valueFilter);
-
-    Preconditions.checkState(recordMode, "Cache setup is not allowed after prepare() is called.");
-
-    // Get the last method call and declare it the cached method.
-    Preconditions.checkState(lastMethodCall != null, "No method call captured to be cached.");
-
-    Class<?> returnType = lastMethodCall.getReturnType();
-
-    Preconditions.checkArgument(returnType != Void.TYPE,
-        "Cannot cache results from void method: " + lastMethodCall);
-
-    if (returnType.isPrimitive()) {
-      // If a primitive type is returned, we need to make sure that the cache holds the boxed
-      // type for the primitive.
-      returnType = AUTO_BOXING_MAP.get(returnType);
-    }
-
-    // TODO(William Farner): Figure out a simple way to make this possible.  Right now, since the proxy
-    //    objects return null, we get a null here and can't check the type.
-    //Preconditions.checkArgument(value.getClass() == returnType,
-    //    String.format("Cache value type '%s' does not match method return type '%s'",
-    //        value.getClass(), lastMethodCall.getReturnType()));
-
-    methodCaches.put(lastMethodCall, new MethodCache<K, V>(lastMethodCall, cache, keyBuilder,
-        valueFilter));
-
-    lastMethodCall = null;
-
-    return this;
-  }
-
-  private static final Function<Object[], List> DEFAULT_KEY_BUILDER =
-      new Function<Object[], List>() {
-        @Override public List apply(Object[] args) {
-          return Arrays.asList(args);
-        }
-      };
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/util/caching/LRUCache.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/util/caching/LRUCache.java b/commons/src/main/java/org/apache/aurora/common/util/caching/LRUCache.java
deleted file mode 100644
index 65639e3..0000000
--- a/commons/src/main/java/org/apache/aurora/common/util/caching/LRUCache.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.util.caching;
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableList;
-import org.apache.aurora.common.base.Closure;
-import org.apache.aurora.common.base.MorePreconditions;
-import org.apache.aurora.common.collections.Pair;
-import org.apache.aurora.common.stats.Stats;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicLong;
-
-/**
- * A cache with a fixed maximum size, evicting items that were used least-recently.
- * WARNING: This is not thread-safe.  If you wish to get a thread-safe version of a constructed
- * LRUCache, you must wrap it with {@link Collections#synchronizedMap(java.util.Map)}.
- *
- * @author William Farner
- */
-public class LRUCache<K, V> implements Cache<K, V> {
-
-  private Map<K, V> map;
-
-  private final AtomicLong accesses;
-  private final AtomicLong misses;
-
-  /**
-   * Creates a new bounded cache with the given load factor.
-   *
-   * @param name Unique name for this cache.
-   * @param maxCapacity Maximum capacity for the cache, after which items will be evicted.
-   * @param loadFactor Load factor for the cache.
-   * @param makeSynchronized Whether the underlying map should be synchronized.
-   * @param evictionListener Listener to be notified when an element is evicted, or {@code null} if
-   *    eviction notifications are not needed.
-   */
-  private LRUCache(final String name, final int maxCapacity, float loadFactor,
-      boolean makeSynchronized, final Closure<Pair<K, V>> evictionListener) {
-    map = new LinkedHashMap<K, V>(maxCapacity, loadFactor, true /* Access order. */) {
-      @Override public boolean removeEldestEntry(Map.Entry<K, V> entry) {
-        boolean evict = size() > maxCapacity;
-        if (evict && evictionListener != null) {
-          evictionListener.execute(Pair.of(entry.getKey(), entry.getValue()));
-        }
-        return evict;
-      }
-    };
-
-    if (makeSynchronized) {
-      map = Collections.synchronizedMap(map);
-    }
-
-    accesses = Stats.exportLong(name + "_lru_cache_accesses");
-    misses = Stats.exportLong(name + "_lru_cache_misses");
-  }
-
-  public static <K, V> Builder<K, V> builder() {
-    return new Builder<K, V>();
-  }
-
-  public static class Builder<K, V> {
-    private String name = null;
-
-    private int maxSize = 1000;
-
-    // Sadly, LinkedHashMap doesn't expose this, so the default is pulled from the javadoc.
-    private float loadFactor = 0.75F;
-
-    private boolean makeSynchronized = true;
-
-    private Closure<Pair<K, V>> evictionListener = null;
-
-    public Builder<K, V> name(String name) {
-      this.name = MorePreconditions.checkNotBlank(name);
-      return this;
-    }
-
-    public Builder<K, V> maxSize(int maxSize) {
-      Preconditions.checkArgument(maxSize > 0);
-      this.maxSize = maxSize;
-      return this;
-    }
-
-    public Builder<K, V> loadFactor(float loadFactor) {
-      this.loadFactor = loadFactor;
-      return this;
-    }
-
-    public Builder<K, V> makeSynchronized(boolean makeSynchronized) {
-      this.makeSynchronized = makeSynchronized;
-      return this;
-    }
-
-    public Builder<K, V> evictionListener(Closure<Pair<K, V>> evictionListener) {
-      this.evictionListener = evictionListener;
-      return this;
-    }
-
-    public LRUCache<K, V> build() {
-      return new LRUCache<K, V>(name, maxSize, loadFactor, makeSynchronized, evictionListener);
-    }
-  }
-
-  @Override
-  public V get(K key) {
-    accesses.incrementAndGet();
-    V value = map.get(key);
-    if (value == null) {
-      misses.incrementAndGet();
-    }
-    return value;
-  }
-
-  @Override
-  public void put(K key, V value) {
-    map.put(key, value);
-  }
-
-  @Override
-  public void delete(K key) {
-    map.remove(key);
-  }
-
-  public int size() {
-    return map.size();
-  }
-
-  @Override
-  public String toString() {
-    return String.format("size: %d, accesses: %s, misses: %s",
-        map.size(),
-        accesses,
-        misses);
-  }
-
-  public Collection<V> copyValues() {
-    synchronized(map) {
-      return ImmutableList.copyOf(map.values());
-    }
-  }
-
-  public long getAccesses() {
-    return accesses.longValue();
-  }
-
-  public long getMisses() {
-    return misses.longValue();
-  }
-
-  public double getHitRate() {
-    double numAccesses = accesses.longValue();
-    return numAccesses == 0 ? 0 : (numAccesses - misses.longValue()) / numAccesses;
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/util/concurrent/BackingOffFutureTask.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/util/concurrent/BackingOffFutureTask.java b/commons/src/main/java/org/apache/aurora/common/util/concurrent/BackingOffFutureTask.java
deleted file mode 100644
index 2f963cf..0000000
--- a/commons/src/main/java/org/apache/aurora/common/util/concurrent/BackingOffFutureTask.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.util.concurrent;
-
-import com.google.common.base.Preconditions;
-import org.apache.aurora.common.util.BackoffStrategy;
-
-import java.util.concurrent.Callable;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
-
-/**
- * A {@link RetryingFutureTask} that will resubmit itself to a work queue with a backoff.
- *
- * @author William Farner
- */
-public class BackingOffFutureTask extends RetryingFutureTask {
-  private final ScheduledExecutorService executor;
-  private final BackoffStrategy backoffStrategy;
-  private long backoffMs = 0;
-
-  /**
-   * Creates a new retrying future task that will execute a unit of work until successfully
-   * completed, or the retry limit has been reached.
-   *
-   * @param executor   The executor service to resubmit the task to upon failure.
-   * @param callable   The unit of work.  The work is considered successful when {@code true} is
-   *                   returned.  It may return {@code false} or throw an exception when
-   *                   unsueccessful.
-   * @param maxRetries The maximum number of times to retry the task.
-   * @param backoffStrategy Strategy to use for determining backoff duration.
-   */
-  public BackingOffFutureTask(ScheduledExecutorService executor, Callable<Boolean> callable,
-      int maxRetries, BackoffStrategy backoffStrategy) {
-    super(executor, callable, maxRetries);
-    this.executor = executor;
-    this.backoffStrategy = Preconditions.checkNotNull(backoffStrategy);
-  }
-
-  @Override
-  protected void retry() {
-    backoffMs = backoffStrategy.calculateBackoffMs(backoffMs);
-    executor.schedule(this, backoffMs, TimeUnit.MILLISECONDS);
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/util/concurrent/RetryingFutureTask.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/util/concurrent/RetryingFutureTask.java b/commons/src/main/java/org/apache/aurora/common/util/concurrent/RetryingFutureTask.java
deleted file mode 100644
index 7448dc1..0000000
--- a/commons/src/main/java/org/apache/aurora/common/util/concurrent/RetryingFutureTask.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.util.concurrent;
-
-import com.google.common.base.Preconditions;
-
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.FutureTask;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * A future task that supports retries by resubmitting itself to an {@link ExecutorService}.
- *
- * @author William Farner
- */
-public class RetryingFutureTask extends FutureTask<Boolean> {
-  private static Logger LOG = Logger.getLogger(RetryingFutureTask.class.getName());
-
-  protected final ExecutorService executor;
-  protected final int maxRetries;
-  protected int numRetries = 0;
-  protected final Callable<Boolean> callable;
-
-  /**
-   * Creates a new retrying future task that will execute a unit of work until successfully
-   * completed, or the retry limit has been reached.
-   *
-   * @param executor The executor service to resubmit the task to upon failure.
-   * @param callable The unit of work.  The work is considered successful when {@code true} is
-   *    returned.  It may return {@code false} or throw an exception when unsueccessful.
-   * @param maxRetries The maximum number of times to retry the task.
-   */
-  public RetryingFutureTask(ExecutorService executor, Callable<Boolean> callable, int maxRetries) {
-    super(callable);
-    this.callable = Preconditions.checkNotNull(callable);
-    this.executor = Preconditions.checkNotNull(executor);
-    this.maxRetries = maxRetries;
-  }
-
-  /**
-   * Invokes a retry of this task.
-   */
-  protected void retry() {
-    executor.execute(this);
-  }
-
-  @Override
-  public void run() {
-    boolean success = false;
-    try {
-      success = callable.call();
-    } catch (Exception e) {
-      LOG.log(Level.WARNING, "Exception while executing task.", e);
-    }
-
-    if (!success) {
-      numRetries++;
-      if (numRetries > maxRetries) {
-        LOG.severe("Task did not complete after " + maxRetries + " retries, giving up.");
-      } else {
-        LOG.info("Task was not successful, resubmitting (num retries: " + numRetries + ")");
-        retry();
-      }
-    } else {
-      set(true);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/util/logging/ResourceLoggingConfigurator.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/util/logging/ResourceLoggingConfigurator.java b/commons/src/main/java/org/apache/aurora/common/util/logging/ResourceLoggingConfigurator.java
deleted file mode 100644
index 927fb2b..0000000
--- a/commons/src/main/java/org/apache/aurora/common/util/logging/ResourceLoggingConfigurator.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.util.logging;
-
-import com.google.common.base.Preconditions;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.logging.LogManager;
-
-/**
- * A custom java.util.logging configuration class that loads the logging configuration from a
- * properties file resource (as opposed to a file as natively supported by LogManager via
- * java.util.logging.config.file).  By default this configurator will look for the resource at
- * /logging.properties but the resource path can be overridden by setting the system property with
- * key {@link #LOGGING_PROPERTIES_RESOURCE_PATH java.util.logging.config.resource}.  To install this
- * configurator you must specify the following system property:
- * java.util.logging.config.class=com.twitter.common.util.logging.ResourceLoggingConfigurator
- *
- * @author John Sirois
- */
-public class ResourceLoggingConfigurator {
-
-  /**
-   * A system property that controls where ResourceLoggingConfigurator looks for the logging
-   * configuration on the process classpath.
-   */
-  public static final String LOGGING_PROPERTIES_RESOURCE_PATH = "java.util.logging.config.resource";
-
-  public ResourceLoggingConfigurator() throws IOException {
-    String loggingPropertiesResourcePath =
-        System.getProperty(LOGGING_PROPERTIES_RESOURCE_PATH, "/logging.properties");
-    InputStream loggingConfig = getClass().getResourceAsStream(loggingPropertiesResourcePath);
-    Preconditions.checkNotNull(loggingConfig,
-        "Could not locate logging config file at resource path: %s", loggingPropertiesResourcePath);
-    LogManager.getLogManager().readConfiguration(loggingConfig);
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/util/logging/UnresettableLogManager.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/util/logging/UnresettableLogManager.java b/commons/src/main/java/org/apache/aurora/common/util/logging/UnresettableLogManager.java
deleted file mode 100644
index 66bbb37..0000000
--- a/commons/src/main/java/org/apache/aurora/common/util/logging/UnresettableLogManager.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.util.logging;
-
-import java.util.logging.LogManager;
-
-/**
- * A LogManager which by default ignores calls to {@link #reset()}.  This is useful to avoid missing
- * log statements that occur during vm shutdown.  The standard LogManager installs a
- * {@link Runtime#addShutdownHook(Thread) shutdown hook} that disables logging and this subclass
- * nullifies that shutdown hook by disabling any reset of the LogManager by default.
- *
- * @author John Sirois
- */
-public class UnresettableLogManager extends LogManager {
-
-  /**
-   * The system property that controls which LogManager the java.util.logging subsystem should load.
-   */
-  public static final String LOGGING_MANAGER = "java.util.logging.manager";
-
-  /**
-   * A system property which can be used to control an {@code UnresettableLogManager}'s behavior.
-   * If the UnresettableLogManager is installed, but an application still wants
-   * {@link LogManager#reset()} behavior, they can set this property to "false".
-   */
-  private static final String LOGGING_MANAGER_IGNORERESET = "java.util.logging.manager.ignorereset";
-
-  @Override
-  public void reset() throws SecurityException {
-    if (Boolean.parseBoolean(System.getProperty(LOGGING_MANAGER_IGNORERESET, "true"))) {
-      System.err.println("UnresettableLogManager is ignoring a reset() request.");
-    } else {
-      super.reset();
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/zookeeper/CompoundServerSet.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/zookeeper/CompoundServerSet.java b/commons/src/main/java/org/apache/aurora/common/zookeeper/CompoundServerSet.java
deleted file mode 100644
index 42732db..0000000
--- a/commons/src/main/java/org/apache/aurora/common/zookeeper/CompoundServerSet.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.zookeeper;
-
-import java.net.InetSocketAddress;
-import java.util.List;
-import java.util.Map;
-
-import com.google.common.base.Joiner;
-import com.google.common.base.Throwables;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-
-import org.apache.aurora.common.base.Command;
-import org.apache.aurora.common.base.Commands;
-import org.apache.aurora.common.base.MorePreconditions;
-import org.apache.aurora.common.zookeeper.Group.JoinException;
-import org.apache.aurora.common.thrift.ServiceInstance;
-import org.apache.aurora.common.thrift.Status;
-
-/**
- * A ServerSet that delegates all calls to other ServerSets.
- */
-public class CompoundServerSet implements ServerSet {
-  private static final Joiner STACK_TRACE_JOINER = Joiner.on('\n');
-
-  private final List<ServerSet> serverSets;
-  private final Map<ServerSet, ImmutableSet<ServiceInstance>> instanceCache = Maps.newHashMap();
-  private final List<HostChangeMonitor<ServiceInstance>> monitors = Lists.newArrayList();
-  private Command stopWatching = null;
-  private ImmutableSet<ServiceInstance> allHosts = ImmutableSet.of();
-
-  /**
-   * Create new ServerSet from a list of serverSets.
-   *
-   * @param serverSets serverSets to which the calls will be delegated.
-   */
-  public CompoundServerSet(Iterable<ServerSet> serverSets) {
-    MorePreconditions.checkNotBlank(serverSets);
-    this.serverSets = ImmutableList.copyOf(serverSets);
-  }
-
-  private interface JoinOp {
-    EndpointStatus doJoin(ServerSet serverSet) throws JoinException, InterruptedException;
-  }
-
-  private interface StatusOp {
-    void changeStatus(EndpointStatus status) throws UpdateException;
-  }
-
-  private void changeStatus(
-      ImmutableList<EndpointStatus> statuses,
-      StatusOp statusOp) throws UpdateException {
-
-    ImmutableList.Builder<String> builder = ImmutableList.builder();
-    int errorIdx = 1;
-    for (EndpointStatus endpointStatus : statuses) {
-      try {
-        statusOp.changeStatus(endpointStatus);
-      } catch (UpdateException exception) {
-        builder.add(String.format("[%d] %s", errorIdx++,
-            Throwables.getStackTraceAsString(exception)));
-      }
-    }
-    if (errorIdx > 1) {
-      throw new UpdateException(
-          "One or more ServerSet update failed: " + STACK_TRACE_JOINER.join(builder.build()));
-    }
-  }
-
-  private EndpointStatus doJoin(JoinOp joiner) throws JoinException, InterruptedException {
-    // Get the list of endpoint status from the serverSets.
-    ImmutableList.Builder<EndpointStatus> builder = ImmutableList.builder();
-    for (ServerSet serverSet : serverSets) {
-      builder.add(joiner.doJoin(serverSet));
-    }
-
-    final ImmutableList<EndpointStatus> statuses = builder.build();
-
-    return new EndpointStatus() {
-      @Override public void leave() throws UpdateException {
-        changeStatus(statuses, new StatusOp() {
-          @Override public void changeStatus(EndpointStatus status) throws UpdateException {
-            status.leave();
-          }
-        });
-      }
-
-      @Override public void update(final Status newStatus) throws UpdateException {
-        changeStatus(statuses, new StatusOp() {
-          @Override public void changeStatus(EndpointStatus status) throws UpdateException {
-            status.update(newStatus);
-          }
-        });
-      }
-    };
-  }
-
-  @Override
-  public EndpointStatus join(
-      final InetSocketAddress endpoint,
-      final Map<String, InetSocketAddress> additionalEndpoints)
-      throws Group.JoinException, InterruptedException {
-
-    return doJoin(new JoinOp() {
-      @Override public EndpointStatus doJoin(ServerSet serverSet)
-          throws JoinException, InterruptedException {
-        return serverSet.join(endpoint, additionalEndpoints);
-      }
-    });
-  }
-
-  /*
-   * If any one of the serverSet throws an exception during respective join, the exception is
-   * propagated. Join is successful only if all the joins are successful.
-   *
-   * NOTE: If an exception occurs during the join, the serverSets in the composite can be in a
-   * partially joined state.
-   *
-   * @see ServerSet#join(InetSocketAddress, Map, Status)
-   */
-  @Override
-  public EndpointStatus join(
-      final InetSocketAddress endpoint,
-      final Map<String, InetSocketAddress> additionalEndpoints,
-      final Status status) throws Group.JoinException, InterruptedException {
-
-    return doJoin(new JoinOp() {
-      @Override public EndpointStatus doJoin(ServerSet serverSet)
-          throws JoinException, InterruptedException {
-
-        return serverSet.join(endpoint, additionalEndpoints, status);
-      }
-    });
-  }
-
-  @Override
-  public EndpointStatus join(
-      final InetSocketAddress endpoint,
-      final Map<String, InetSocketAddress> additionalEndpoints,
-      final int shardId) throws JoinException, InterruptedException {
-
-    return doJoin(new JoinOp() {
-      @Override public EndpointStatus doJoin(ServerSet serverSet)
-          throws JoinException, InterruptedException {
-
-        return serverSet.join(endpoint, additionalEndpoints, shardId);
-      }
-    });
-  }
-
-  // Handles changes to the union of hosts.
-  private synchronized void handleChange(ServerSet serverSet, ImmutableSet<ServiceInstance> hosts) {
-    instanceCache.put(serverSet, hosts);
-
-    // Get the union of hosts.
-    ImmutableSet<ServiceInstance> currentHosts =
-        ImmutableSet.copyOf(Iterables.concat(instanceCache.values()));
-
-    // Check if the hosts have changed.
-    if (!currentHosts.equals(allHosts)) {
-      allHosts = currentHosts;
-
-      // Notify the monitors.
-      for (HostChangeMonitor<ServiceInstance> monitor : monitors) {
-        monitor.onChange(allHosts);
-      }
-    }
-  }
-
-  /**
-   * Monitor the CompoundServerSet.
-   *
-   * If any one of the monitor calls to the underlying serverSet raises a MonitorException, the
-   * exception is propagated. The call is successful only if all the monitor calls to the
-   * underlying serverSets are successful.
-   *
-   * NOTE: If an exception occurs during the monitor call, the serverSets in the composite will not
-   * be monitored.
-   *
-   * @param monitor HostChangeMonitor instance used to monitor host changes.
-   * @return A command that, when executed, will stop monitoring all underlying server sets.
-   * @throws MonitorException If there was a problem monitoring any of the underlying server sets.
-   */
-  @Override
-  public synchronized Command watch(HostChangeMonitor<ServiceInstance> monitor)
-      throws MonitorException {
-    if (stopWatching == null) {
-      monitors.add(monitor);
-      ImmutableList.Builder<Command> commandsBuilder = ImmutableList.builder();
-
-      for (final ServerSet serverSet : serverSets) {
-        commandsBuilder.add(serverSet.watch(new HostChangeMonitor<ServiceInstance>() {
-          @Override public void onChange(ImmutableSet<ServiceInstance> hostSet) {
-            handleChange(serverSet, hostSet);
-          }
-        }));
-      }
-
-      stopWatching = Commands.compound(commandsBuilder.build());
-    }
-
-    return stopWatching;
-  }
-
-  @Override
-  public void monitor(HostChangeMonitor<ServiceInstance> monitor) throws MonitorException {
-    watch(monitor);
-  }
-}


[16/21] aurora git commit: Remove unused classes from commons fork.

Posted by wf...@apache.org.
http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/stats/CounterMapWithTopKey.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/stats/CounterMapWithTopKey.java b/commons/src/main/java/org/apache/aurora/common/stats/CounterMapWithTopKey.java
deleted file mode 100644
index 1e90e85..0000000
--- a/commons/src/main/java/org/apache/aurora/common/stats/CounterMapWithTopKey.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.stats;
-
-import java.util.Map;
-
-/**
- * Same as CounterMap<K>, but also keeps track of the item with the highest count.
- */
-public class CounterMapWithTopKey<K> extends CounterMap<K> {
-
-  private K mostCommonKey = null;
-
-  /**
-   * Updates the most common key, if needed.
-   *
-   * @param key The key to check.
-   * @param count The count for the key.
-   * @return The count.
-   */
-  private int updateMostCommon(K key, int count) {
-    if (count > get(mostCommonKey)) {
-      mostCommonKey = key;
-    }
-    return count;
-  }
-
-  /**
-   * Increments the counter value associated with {@code key}, and returns the new value.
-   *
-   * @param key The key to increment
-   * @return The incremented value.
-   */
-  @Override
-  public int incrementAndGet(K key) {
-    return updateMostCommon(key, super.incrementAndGet(key));
-  }
-
-  /**
-   * Assigns a value to a key.
-   *
-   * @param key The key to assign a value to.
-   * @param newValue The value to assign.
-   */
-  @Override
-  public void set(K key, int newValue) {
-    super.set(key, updateMostCommon(key, newValue));
-  }
-
-  /**
-   * Resets the value for {@code key}.  This will simply set the stored value to 0.
-   * The most common key is updated by scanning the entire map.
-   *
-   * @param key The key to reset.
-   */
-  @Override
-  public void reset(K key) {
-    super.reset(key);
-    for (Map.Entry<K, Integer> entry : this) {
-      updateMostCommon(entry.getKey(), entry.getValue());
-    }
-  }
-
-  /**
-   *
-   * @return The key with the highest count in the map. If multiple keys have this count, return
-   * an arbitrary one.
-   */
-  public K getMostCommonKey() {
-    return mostCommonKey;
-  }
-
-  @Override
-  public String toString() {
-    return new StringBuilder(super.toString()).append(String.format("Most common key: %s\n",
-        mostCommonKey.toString())).toString();
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/stats/Elapsed.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/stats/Elapsed.java b/commons/src/main/java/org/apache/aurora/common/stats/Elapsed.java
deleted file mode 100644
index 859ca7e..0000000
--- a/commons/src/main/java/org/apache/aurora/common/stats/Elapsed.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.stats;
-
-import java.util.concurrent.atomic.AtomicLong;
-
-import com.google.common.base.Preconditions;
-import com.google.common.base.Ticker;
-
-import org.apache.aurora.common.base.MorePreconditions;
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-
-/**
- * A stat that exports the amount of time since it was last reset.
- *
- * @author William Farner
- */
-public class Elapsed {
-
-  private final Ticker ticker;
-  private final AtomicLong lastEventNs = new AtomicLong();
-
-  /**
-   * Calls {@link #Elapsed(String, Time)} using a default granularity of nanoseconds.
-   *
-   * @param name Name of the stat to export.
-   */
-  public Elapsed(String name) {
-    this(name, Time.NANOSECONDS);
-  }
-
-  /**
-   * Equivalent to calling {@link #Elapsed(String, Time, Ticker)} passing {@code name},
-   * {@code granularity} and {@link com.google.common.base.Ticker#systemTicker()}.
-   * <br/>
-   * @param name Name of the stat to export.
-   * @param granularity Time unit granularity to export.
-   */
-  public Elapsed(String name, Time granularity) {
-    this(name, granularity, Ticker.systemTicker());
-  }
-
-   /**
-    * Creates and exports a new stat that maintains the difference between the tick time
-    * and the time since it was last reset.  Upon export, the counter will act as though it were just
-    * reset.
-    * <br/>
-    * @param name Name of stat to export
-    * @param granularity Time unit granularity to export.
-    * @param ticker Ticker implementation
-    */
-  public Elapsed(String name, final Time granularity, final Ticker ticker) {
-    MorePreconditions.checkNotBlank(name);
-    Preconditions.checkNotNull(granularity);
-    this.ticker = Preconditions.checkNotNull(ticker);
-
-    reset();
-
-    Stats.export(new StatImpl<Long>(name) {
-      @Override public Long read() {
-        return Amount.of(ticker.read() - lastEventNs.get(), Time.NANOSECONDS).as(granularity);
-      }
-    });
-  }
-
-  public void reset() {
-    lastEventNs.set(ticker.read());
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/stats/Entropy.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/stats/Entropy.java b/commons/src/main/java/org/apache/aurora/common/stats/Entropy.java
deleted file mode 100644
index 4e011c1..0000000
--- a/commons/src/main/java/org/apache/aurora/common/stats/Entropy.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.stats;
-
-import com.google.common.base.Preconditions;
-
-/**
- * Calculate the entropy of a discrete distribution of <T>.
- *
- * @author Gilad Mishne
- */
-public class Entropy<T> {
-  private final CounterMap<T> counts = new CounterMap<T>();
-  private int total = 0;
-
-  private static double Log2(double n) {
-    return Math.log(n) / Math.log(2);
-  }
-
-  public Entropy(Iterable<T> elements) {
-    Preconditions.checkNotNull(elements);
-    for (T element : elements) {
-      counts.incrementAndGet(element);
-      total++;
-    }
-  }
-
-  public double entropy() {
-    double entropy = 0;
-    for (int count: counts.values()) {
-      double prob = (double) count / total;
-      entropy -= prob * Log2(prob);
-    }
-    return entropy;
-  }
-
-  public double perplexity() {
-    return Math.pow(2, entropy());
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/stats/Histogram.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/stats/Histogram.java b/commons/src/main/java/org/apache/aurora/common/stats/Histogram.java
deleted file mode 100644
index 53c976d..0000000
--- a/commons/src/main/java/org/apache/aurora/common/stats/Histogram.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.stats;
-
-/**
- * An interface for Histogram
- */
-public interface Histogram {
-
-  /**
-   * Add an entry into the histogram.
-   * @param x the value to insert.
-   */
-  void add(long x);
-
-  /**
-   * Clear the histogram.
-   */
-  void clear();
-
-  /**
-   * Return the current quantile of the histogram.
-   * @param quantile value to compute.
-   */
-  long getQuantile(double quantile);
-
-  /**
-   * Return the quantiles of the histogram.
-   * @param quantiles array of values to compute.
-   */
-  long[] getQuantiles(double[] quantiles);
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/stats/Histograms.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/stats/Histograms.java b/commons/src/main/java/org/apache/aurora/common/stats/Histograms.java
deleted file mode 100644
index 6818b05..0000000
--- a/commons/src/main/java/org/apache/aurora/common/stats/Histograms.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.stats;
-
-/**
- * Helper class containing only static methods
- */
-public final class Histograms {
-
-  private Histograms() {
-    /* Disable */
-  }
-
-  /**
-   * Helper method that return an array of quantiles
-   * @param h the histogram to query
-   * @param quantiles an array of double representing the quantiles
-   * @return the array of computed quantiles
-   */
-  public static long[] extractQuantiles(Histogram h, double[] quantiles) {
-    long[] results = new long[quantiles.length];
-    for (int i = 0; i < results.length; i++) {
-      double q = quantiles[i];
-      results[i] = h.getQuantile(q);
-    }
-    return results;
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/stats/MovingAverage.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/stats/MovingAverage.java b/commons/src/main/java/org/apache/aurora/common/stats/MovingAverage.java
deleted file mode 100644
index 339737b..0000000
--- a/commons/src/main/java/org/apache/aurora/common/stats/MovingAverage.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.stats;
-
-import java.util.concurrent.LinkedBlockingDeque;
-
-import com.google.common.base.Preconditions;
-
-/**
- * Function to compute the moving average of a time series.
- *
- * @author William Farner
- */
-public class MovingAverage<T extends Number> extends SampledStat<Double> {
-
-  private static final int DEFAULT_WINDOW = 10;
-  private final Stat<T> input;
-
-  private final LinkedBlockingDeque<T> samples;
-  private double sampleSum = 0;
-
-  private MovingAverage(String name, Stat<T> input, int windowSize) {
-    super(name, 0d);
-    Preconditions.checkArgument(windowSize > 1);
-
-    this.input = Preconditions.checkNotNull(input);
-    this.samples = new LinkedBlockingDeque<T>(windowSize);
-    Stats.export(input);
-  }
-
-  public static <T extends Number> MovingAverage<T> of(Stat<T> input) {
-    return MovingAverage.of(input, DEFAULT_WINDOW);
-  }
-
-  public static <T extends Number> MovingAverage<T> of(Stat<T> input, int windowSize) {
-    return MovingAverage.of(String.format("%s_avg", input.getName()), input, windowSize);
-  }
-
-  public static <T extends Number> MovingAverage<T> of(String name, Stat<T> input,
-      int windowSize) {
-    return new MovingAverage<T>(name, input, windowSize);
-  }
-
-  @Override
-  public Double doSample() {
-    T sample = input.read();
-
-    if (samples.remainingCapacity() == 0) {
-      sampleSum -= samples.removeLast().doubleValue();
-    }
-
-    samples.addFirst(sample);
-    sampleSum += sample.doubleValue();
-
-    return sampleSum / samples.size();
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/stats/MovingWindowDelta.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/stats/MovingWindowDelta.java b/commons/src/main/java/org/apache/aurora/common/stats/MovingWindowDelta.java
deleted file mode 100644
index a20eed0..0000000
--- a/commons/src/main/java/org/apache/aurora/common/stats/MovingWindowDelta.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.stats;
-
-import com.google.common.base.Preconditions;
-import com.google.common.base.Supplier;
-
-import java.util.concurrent.LinkedBlockingDeque;
-
-import org.apache.aurora.common.base.MorePreconditions;
-
-
-/**
- * Delta over the most recent k sample periods.
- *
- * If you use this class with a counter, you can get the cumulation of counts in a sliding window.
- *
- * One sample period is the time in between doSample() calls.
- *
- * @author Feng Zhuge
- */
-public class MovingWindowDelta<T extends Number> extends SampledStat<Long> {
-  private static final int DEFAULT_WINDOW_SIZE = 60;
-  private final LinkedBlockingDeque<Long> deltaSeries;
-  private final Supplier<T> inputAccessor;
-  long sumDelta = 0l;
-  long lastInput = 0l;
-
-  private MovingWindowDelta(String name, Supplier<T> inputAccessor, int windowSize) {
-    super(name, 0l);
-
-    Preconditions.checkArgument(windowSize >= 1);
-    Preconditions.checkNotNull(inputAccessor);
-    MorePreconditions.checkNotBlank(name);
-
-    deltaSeries = new LinkedBlockingDeque<Long>(windowSize);
-    this.inputAccessor = inputAccessor;
-
-    Stats.export(this);
-  }
-
-  /**
-   * Create a new MovingWindowDelta instance.
-   *
-   * @param name The name of the value to be tracked.
-   * @param inputAccessor The accessor of the value.
-   * @param windowSize How many sample periods shall we use to calculate delta.
-   * @param <T> The type of the value.
-   * @return The created MovingWindowSum instance.
-   */
-  public static <T extends Number> MovingWindowDelta<T> of(
-      String name, Supplier<T> inputAccessor, int windowSize) {
-    return new MovingWindowDelta<T>(name, inputAccessor, windowSize);
-  }
-
-  /**
-   * Create a new MovingWindowDelta instance using the default window size (currently 60).
-   *
-   * @param name The name of the value to be tracked.
-   * @param inputAccessor The accessor of the value.
-   * @param <T> The type of the value.
-   * @return The created MovingWindowSum instance.
-   */
-  public static <T extends Number> MovingWindowDelta<T> of(String name, Supplier<T> inputAccessor) {
-    return of(name, inputAccessor, DEFAULT_WINDOW_SIZE);
-  }
-
-  @Override
-  public Long doSample() {
-    long lastDelta = 0l;
-    if (deltaSeries.remainingCapacity() == 0) {
-      lastDelta = deltaSeries.removeFirst();
-    }
-
-    long newInput = inputAccessor.get().longValue();
-    long newDelta = newInput - lastInput;
-    lastInput = newInput;
-
-    deltaSeries.addLast(newDelta);
-
-    sumDelta += newDelta - lastDelta;
-
-    return sumDelta;
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/stats/NumericStatExporter.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/stats/NumericStatExporter.java b/commons/src/main/java/org/apache/aurora/common/stats/NumericStatExporter.java
deleted file mode 100644
index 7345edc..0000000
--- a/commons/src/main/java/org/apache/aurora/common/stats/NumericStatExporter.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.stats;
-
-import java.util.Map;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
-import java.util.logging.Logger;
-
-import com.google.common.base.Function;
-import com.google.common.collect.Maps;
-
-import org.apache.aurora.common.application.ShutdownRegistry;
-import org.apache.aurora.common.base.Closure;
-import org.apache.aurora.common.base.Command;
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * Stat exporter that extracts numeric {@link Stat}s from the {@link Stats} system, and exports them
- * via a caller-defined sink.
- *
- * @author William Farner
- */
-public class NumericStatExporter {
-
-  private static final Logger LOG = Logger.getLogger(NumericStatExporter.class.getName());
-
-  private final ScheduledExecutorService executor;
-  private final Amount<Long, Time> exportInterval;
-  private final Closure<Map<String, ? extends Number>> exportSink;
-
-  private final Runnable exporter;
-
-  /**
-   * Creates a new numeric stat exporter that will export to the specified sink.
-   *
-   * @param exportSink Consumes stats.
-   * @param executor Executor to handle export thread.
-   * @param exportInterval Export period.
-   */
-  public NumericStatExporter(final Closure<Map<String, ? extends Number>> exportSink,
-      ScheduledExecutorService executor, Amount<Long, Time> exportInterval) {
-    checkNotNull(exportSink);
-    this.executor = checkNotNull(executor);
-    this.exportInterval = checkNotNull(exportInterval);
-    this.exportSink = exportSink;
-
-    exporter = new Runnable() {
-      @Override public void run() {
-          exportSink.execute(Maps.transformValues(
-            Maps.uniqueIndex(Stats.getNumericVariables(), GET_NAME), READ_STAT));
-      }
-    };
-  }
-
-  /**
-   * Starts the stat exporter.
-   *
-   * @param shutdownRegistry Shutdown hook registry to allow the exporter to cleanly halt.
-   */
-  public void start(ShutdownRegistry shutdownRegistry) {
-    long intervalSecs = exportInterval.as(Time.SECONDS);
-    executor.scheduleAtFixedRate(exporter, intervalSecs, intervalSecs, TimeUnit.SECONDS);
-
-    shutdownRegistry.addAction(new Command() {
-      @Override public void execute() {
-        stop();
-        exportSink.execute(Maps.transformValues(
-            Maps.uniqueIndex(Stats.getNumericVariables(), GET_NAME), SAMPLE_AND_READ_STAT));
-      }
-    });
-  }
-
-  /**
-   * Stops the stat exporter.  Once stopped, it may be started again by calling
-   * {@link #start(ShutdownRegistry)}.
-   */
-  public void stop() {
-    try {
-      if (!executor.awaitTermination(1, TimeUnit.SECONDS)) {
-        executor.shutdownNow();
-        if (!executor.awaitTermination(1, TimeUnit.SECONDS)) {
-          LOG.severe("Failed to stop stat exporter.");
-        }
-      }
-    } catch (InterruptedException e) {
-      executor.shutdownNow();
-      Thread.currentThread().interrupt();
-    }
-  }
-
-  public static final Function<Stat<?>, String> GET_NAME = new Function<Stat<?>, String>() {
-    @Override public String apply(Stat<?> stat) {
-      return stat.getName();
-    }
-  };
-
-  public static final Function<Stat<? extends Number>, Number> READ_STAT =
-      new Function<Stat<? extends Number>, Number>() {
-        @Override public Number apply(Stat<? extends Number> stat) {
-          return stat.read();
-        }
-      };
-
-  private static final Function<RecordingStat<? extends Number>, Number> SAMPLE_AND_READ_STAT =
-      new Function<RecordingStat<? extends Number>, Number>() {
-        @Override public Number apply(RecordingStat<? extends Number> stat) {
-          return stat.sample();
-        }
-      };
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/stats/PipelineStats.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/stats/PipelineStats.java b/commons/src/main/java/org/apache/aurora/common/stats/PipelineStats.java
deleted file mode 100644
index 014a56a..0000000
--- a/commons/src/main/java/org/apache/aurora/common/stats/PipelineStats.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.stats;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import org.apache.aurora.common.base.MorePreconditions;
-import org.apache.aurora.common.collections.Pair;
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-import org.apache.aurora.common.util.Clock;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Tracks the latency of different pipeline stages in a process.
- *
- * @author William Farner
- */
-public class PipelineStats {
-  private static final String FULL_PIPELINE_NAME = "full";
-
-  private final Time precision;
-  private final Clock clock;
-
-  private final Map<String, SlidingStats> stages;
-
-  /**
-   * Creates a new pipeline tracker with the given pipeline name and stages. The stage name "full"
-   * is reserved to represent the duration of the entire pipeline.
-   *
-   * @param pipelineName Name of the pipeline.
-   * @param stages Stage names.
-   * @param precision Precision for time interval recording.
-   */
-  public PipelineStats(String pipelineName, Set<String> stages, Time precision) {
-    this(pipelineName, stages, Clock.SYSTEM_CLOCK, precision);
-  }
-
-  @VisibleForTesting
-  PipelineStats(String pipelineName, Set<String> stages, Clock clock, Time precision) {
-    MorePreconditions.checkNotBlank(pipelineName);
-    MorePreconditions.checkNotBlank(stages);
-    Preconditions.checkArgument(!stages.contains(FULL_PIPELINE_NAME));
-
-    this.clock = Preconditions.checkNotNull(clock);
-    this.precision = Preconditions.checkNotNull(precision);
-
-    this.stages = Maps.newHashMap();
-    for (String stage : stages) {
-      this.stages.put(stage, new SlidingStats(
-          String.format("%s_%s", pipelineName, stage), precision.toString()));
-    }
-    this.stages.put(FULL_PIPELINE_NAME, new SlidingStats(
-        String.format("%s_%s", pipelineName, FULL_PIPELINE_NAME), precision.toString()));
-  }
-
-  private void record(Snapshot snapshot) {
-    for (Pair<String, Long> stage : snapshot.stages) {
-      stages.get(stage.getFirst()).accumulate(stage.getSecond());
-    }
-  }
-
-  public Snapshot newSnapshot() {
-    return new Snapshot(this);
-  }
-
-  @VisibleForTesting
-  public SlidingStats getStatsForStage(String stage) {
-    return stages.get(stage);
-  }
-
-  public class Snapshot {
-    private final List<Pair<String, Long>> stages = Lists.newLinkedList();
-    private final PipelineStats parent;
-
-    private String currentStage;
-    private long startTime;
-    private long ticker;
-
-    private Snapshot(PipelineStats parent) {
-      this.parent = parent;
-    }
-
-    /**
-     * Records the duration for the current pipeline stage, and advances to the next stage. The
-     * stage name must be one of the stages specified in the constructor.
-     *
-     * @param stageName Name of the stage to enter.
-     */
-    public void start(String stageName) {
-      record(Preconditions.checkNotNull(stageName));
-    }
-
-    private void record(String stageName) {
-      long now = Amount.of(clock.nowNanos(), Time.NANOSECONDS).as(precision);
-      if (currentStage != null) {
-        stages.add(Pair.of(currentStage, now - ticker));
-      } else {
-        startTime = now;
-      }
-
-      if (stageName == null) stages.add(Pair.of(FULL_PIPELINE_NAME, now - startTime));
-
-      ticker = now;
-      currentStage = stageName;
-    }
-
-    /**
-     * Stops the pipeline, recording the interval for the last registered stage.
-     * This is the same as calling {@link #start(String)} with {@code null};
-     *
-     */
-    public void end() {
-      record(null);
-      parent.record(this);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/stats/Precision.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/stats/Precision.java b/commons/src/main/java/org/apache/aurora/common/stats/Precision.java
deleted file mode 100644
index 7000e2f..0000000
--- a/commons/src/main/java/org/apache/aurora/common/stats/Precision.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.stats;
-
-import com.google.common.base.Preconditions;
-
-/**
- * Precision expresses the maximum epsilon tolerated for a typical size of input
- * e.g.: Precision(0.01, 1000) express that we tolerate a error of 1% for 1000 entries
- *       it means that max difference between the real quantile and the estimate one is
- *       error = 0.01*1000 = 10
- *       For an entry like (1 to 1000), q(0.5) will be [490 <= x <= 510] (real q(0.5) = 500)
- */
-public class Precision {
-  private final double epsilon;
-  private final int n;
-
-  /**
-   * Create a Precision instance representing a precision per number of entries
-   *
-   * @param epsilon is the maximum error tolerated
-   * @param n size of the data set
-   */
-  public Precision(double epsilon, int n) {
-    Preconditions.checkArgument(0.0 < epsilon, "Epsilon must be positive!");
-    Preconditions.checkArgument(1 < n, "N (expected number of elements) must be greater than 1!");
-
-    this.epsilon = epsilon;
-    this.n = n;
-  }
-
-  public double getEpsilon() {
-    return epsilon;
-  }
-
-  public int getN() {
-    return n;
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/stats/PrintableHistogram.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/stats/PrintableHistogram.java b/commons/src/main/java/org/apache/aurora/common/stats/PrintableHistogram.java
deleted file mode 100644
index a587457..0000000
--- a/commons/src/main/java/org/apache/aurora/common/stats/PrintableHistogram.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.stats;
-
-import com.google.common.base.Preconditions;
-
-public class PrintableHistogram {
-  private double[] bucketBoundaries;
-  private int[] bucketCounts;
-  private int totalCount = 0;
-
-  /**
-   * Creates a histogram with the given bucket boundaries.  The boundaries
-   * 0 and infinity are implicitly added.
-   *
-   * @param buckets Boundaries for histogram buckets.
-   */
-  public PrintableHistogram(double ... buckets) {
-    Preconditions.checkState(buckets[0] != 0);
-
-    bucketBoundaries = new double[buckets.length + 2];
-    bucketBoundaries[0] = 0;
-    bucketCounts = new int[buckets.length + 2];
-    for (int i = 0; i < buckets.length; i++) {
-      if (i > 0) {
-        Preconditions.checkState(buckets[i] > buckets[i - 1],
-            "Bucket %f must be greater than %f.", buckets[i], buckets[i - 1]);
-      }
-      bucketCounts[i] = 0;
-      bucketBoundaries[i + 1] = buckets[i];
-    }
-
-    bucketBoundaries[bucketBoundaries.length - 1] = Integer.MAX_VALUE;
-  }
-
-  public void addValue(double value) {
-    addValue(value, 1);
-  }
-
-  public void addValue(double value, int count) {
-    Preconditions.checkState(value >= 0);
-    Preconditions.checkState(count >= 0);
-    Preconditions.checkState(bucketBoundaries.length > 1);
-    int bucketId = -1;
-    for (double boundary : bucketBoundaries) {
-      if (value <= boundary) {
-        break;
-      }
-      bucketId++;
-    }
-
-    bucketId = Math.max(0, bucketId);
-    bucketId = Math.min(bucketCounts.length - 1, bucketId);
-    bucketCounts[bucketId] += count;
-    totalCount += count;
-  }
-
-  public double getBucketRatio(int bucketId) {
-    Preconditions.checkState(bucketId >= 0);
-    Preconditions.checkState(bucketId < bucketCounts.length);
-    return (double) bucketCounts[bucketId] / totalCount;
-  }
-
-  public String toString() {
-    StringBuilder display = new StringBuilder();
-    display.append("Histogram: ");
-    for (int bucketId = 0; bucketId < bucketCounts.length - 1; bucketId++) {
-      display.append(String.format("\n(%g - %g]\n\t",
-          bucketBoundaries[bucketId], bucketBoundaries[bucketId + 1]));
-      for (int i = 0; i < getBucketRatio(bucketId) * 100; i++) {
-        display.append('#');
-      }
-      display.append(
-          String.format(" %.2g%% (%d)", getBucketRatio(bucketId) * 100, bucketCounts[bucketId]));
-    }
-
-    return display.toString();
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/stats/ReservoirSampler.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/stats/ReservoirSampler.java b/commons/src/main/java/org/apache/aurora/common/stats/ReservoirSampler.java
deleted file mode 100644
index 79e7e04..0000000
--- a/commons/src/main/java/org/apache/aurora/common/stats/ReservoirSampler.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.stats;
-
-import java.util.Vector;
-
-import com.google.common.base.Preconditions;
-
-import org.apache.aurora.common.util.Random;
-
-/**
- * An in memory implementation of Reservoir Sampling for sampling from
- * a population.
- * <p>Several optimizations can be done.
- * Especially, one can avoid rolling the dice as many times as the
- * size of the population with an involved trick.
- * See "Random Sampling with a Reservoir", Vitter, 1985</p>
- * <p>TODO (delip): Fix this when the problem arises</p>
- *
- * @param <T> Type of the sample
- * @author Delip Rao
- */
-public class ReservoirSampler<T> {
-  private final Vector<T> reservoir = new Vector<T>();
-  private final int numSamples;
-
-  private final Random random;
-  private int numItemsSeen = 0;
-
-  /**
-   * Create a new sampler with a certain reservoir size using
-   * a supplied random number generator.
-   *
-   * @param numSamples Maximum number of samples to
-   *                   retain in the reservoir. Must be non-negative.
-   * @param random Instance of the random number generator
-   *               to use for sampling
-   */
-  public ReservoirSampler(int numSamples, Random random) {
-    Preconditions.checkArgument(numSamples > 0,
-        "numSamples should be positive");
-    Preconditions.checkNotNull(random);
-    this.numSamples = numSamples;
-    this.random = random;
-  }
-
-  /**
-   * Create a new sampler with a certain reservoir size using
-   * the default random number generator.
-   *
-   * @param numSamples Maximum number of samples to
-   *        retain in the reservoir. Must be non-negative.
-   */
-  public ReservoirSampler(int numSamples) {
-    this(numSamples, Random.Util.newDefaultRandom());
-  }
-
-  /**
-   * Sample an item and store in the reservoir if needed.
-   *
-   * @param item The item to sample - may not be null.
-   */
-  public void sample(T item) {
-    Preconditions.checkNotNull(item);
-    if (reservoir.size() < numSamples) {
-      // reservoir not yet full, just append
-      reservoir.add(item);
-    } else {
-      // find a sample to replace
-      int rIndex = random.nextInt(numItemsSeen + 1);
-      if (rIndex < numSamples) {
-        reservoir.set(rIndex, item);
-      }
-    }
-    numItemsSeen++;
-  }
-
-  /**
-   * Get samples collected in the reservoir.
-   *
-   * @return A sequence of the samples. No guarantee is provided on the order of the samples.
-   */
-  public Iterable<T> getSamples() {
-    return reservoir;
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/stats/Significance.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/stats/Significance.java b/commons/src/main/java/org/apache/aurora/common/stats/Significance.java
deleted file mode 100644
index ff040e9..0000000
--- a/commons/src/main/java/org/apache/aurora/common/stats/Significance.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.stats;
-
-/**
- * Calculate significance scores between an observed amount and an expected amount.
- *
- * @author Gilad Mishne
- */
-public class Significance {
-
-  /**
-   * @param observed The observed amount.
-   * @param expected The expected amount.
-   * @return [(observed - expected) ** 2 / expected] * sign(observed - expected)
-   */
-  public static double chiSqrScore(double observed, double expected) {
-    double score = Math.pow((observed - expected), 2) / expected;
-    if (observed < expected) {
-      score *= -1;
-    }
-    return score;
-  }
-
-  /**
-   * @param observed The observed amount.
-   * @param expected The expected amount.
-   * @return -2 * expected * log(observed / expected) * sign(observed - expected)
-   */
-  public static double logLikelihood(double observed, double expected) {
-    if (observed == 0) {
-      return -expected;
-    }
-    if (expected == 0) {
-      return observed;
-    }
-    double score = -2 * observed * Math.log(observed / expected);
-    if (observed < expected) {
-      score *= -1;
-    }
-    return score;
-  }
-
-  private Significance() {
-    // prevent instantiation
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/stats/Statistics.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/stats/Statistics.java b/commons/src/main/java/org/apache/aurora/common/stats/Statistics.java
deleted file mode 100644
index 498abb0..0000000
--- a/commons/src/main/java/org/apache/aurora/common/stats/Statistics.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.stats;
-
-/**
- * A simple class to keep running statistics that require O(1) storage.
- *
- * @author William Farner
- */
-public class Statistics implements StatisticsInterface {
-  private long populationSize;
-  private long sum;
-  private double accumulatedVariance;
-  private double runningMean;
-
-  private long minValue;
-  private long maxValue;
-
-  public Statistics() {
-    clear();
-  }
-
-  public void accumulate(long value) {
-    populationSize++;
-    sum += value;
-    double delta = value - runningMean;
-    runningMean += delta / populationSize;
-    accumulatedVariance += delta * (value - runningMean);
-
-    // Update max/min.
-    minValue = value < minValue ? value : minValue;
-    maxValue = value > maxValue ? value : maxValue;
-  }
-
-  public void clear() {
-    populationSize = 0;
-    sum = 0;
-    accumulatedVariance = 0;
-    runningMean = 0;
-    minValue = Long.MAX_VALUE;
-    maxValue = Long.MIN_VALUE;
-  }
-
-  public double variance() {
-    return accumulatedVariance / populationSize;
-  }
-
-  public double standardDeviation() {
-    return Math.sqrt(variance());
-  }
-
-  public double mean() {
-    return runningMean;
-  }
-
-  public long min() {
-    return minValue;
-  }
-
-  public long max() {
-    return maxValue;
-  }
-
-  public long range() {
-    return maxValue - minValue;
-  }
-
-  public long sum() {
-    return sum;
-  }
-
-  public long populationSize() {
-    return populationSize;
-  }
-
-  @Override
-  public String toString() {
-    return String.format("Mean: %f, Min: %d, Max: %d, Range: %d, Stddev: %f, Variance: %f, " +
-        "Population: %d, Sum: %d", mean(), min(), max(), range(), standardDeviation(),
-        variance(), populationSize(), sum());
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/stats/StatisticsInterface.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/stats/StatisticsInterface.java b/commons/src/main/java/org/apache/aurora/common/stats/StatisticsInterface.java
deleted file mode 100644
index 893c069..0000000
--- a/commons/src/main/java/org/apache/aurora/common/stats/StatisticsInterface.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.stats;
-
-/**
- * Interface representing statistics of a set of (long) elements.
- */
-public interface StatisticsInterface {
-  /**
-   * Add a value in the Statistics object.
-   * @param value value that you want to accumulate.
-   */
-  void accumulate(long value);
-
-  /**
-   * Clear the Statistics instance (equivalent to recreate a new one).
-   */
-  void clear();
-
-  /**
-   * Return the variance of the inserted elements.
-   */
-  double variance();
-
-  /**
-   * Return the standard deviation of the inserted elements.
-   */
-  double standardDeviation();
-
-  /**
-   * Return the mean of the inserted elements.
-   */
-  double mean();
-
-  /**
-   * Return the min of the inserted elements.
-   */
-  long min();
-
-  /**
-   * Return the max of the inserted elements.
-   */
-  long max();
-
-  /**
-   * Return the range of the inserted elements.
-   */
-  long range();
-
-  /**
-   * Return the sum of the inserted elements.
-   */
-  long sum();
-
-  /**
-   * Return the number of the inserted elements.
-   */
-  long populationSize();
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/stats/Windowed.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/stats/Windowed.java b/commons/src/main/java/org/apache/aurora/common/stats/Windowed.java
deleted file mode 100644
index 12ab468..0000000
--- a/commons/src/main/java/org/apache/aurora/common/stats/Windowed.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.stats;
-
-import java.lang.reflect.Array;
-
-import com.google.common.base.Function;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Supplier;
-
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-import org.apache.aurora.common.util.Clock;
-
-/**
- * Windowed is an abstraction that let you span a class across a sliding window.
- * It creates a ring buffer of T and reuse the buffer after clearing it or use a new one (via
- * the {@code clearer} function).
- *
- * <pre>
- *          tenured instances
- *  ++++++++++++++++++++++++++++++++++
- * [----A-----][-----B----][-----C----][-----D----]
- *                                      ++++++++++
- *                                    current instance
- * </pre>
- *
- * The schema above represents the valid instances over time
- * (A,B,C) are the tenured ones
- * D is the current instance
- */
-public abstract class Windowed<T> {
-  private Class<T> clazz;
-  protected final T[] buffers;
-  private final long sliceDuration;
-  private final Clock clock;
-  private long index = -1L;
-  private Function<T, T> clearer;
-
-  /**
-   * @param clazz the type of the underlying element T
-   * @param window the length of the window
-   * @param slices the number of slices (the window will be divided into {@code slices} slices)
-   * @param sliceProvider the supplier of element
-   * @param clearer the function that clear (or re-create) an element
-   * @param clock  the clock used for to select the appropriate histogram
-   */
-  public Windowed(Class<T> clazz, Amount<Long, Time> window, int slices,
-      Supplier<T> sliceProvider, Function<T, T> clearer, Clock clock) {
-    Preconditions.checkNotNull(window);
-    // Ensure that we have at least 1ms per slice
-    Preconditions.checkArgument(window.as(Time.MILLISECONDS) > (slices + 1));
-    Preconditions.checkArgument(window.as(Time.MILLISECONDS) > (slices + 1));
-    Preconditions.checkArgument(0 < slices);
-    Preconditions.checkNotNull(sliceProvider);
-    Preconditions.checkNotNull(clock);
-
-    this.clazz = clazz;
-    this.sliceDuration = window.as(Time.MILLISECONDS) / slices;
-    @SuppressWarnings("unchecked") // safe because we have the clazz proof of type H
-    T[] bufs = (T[]) Array.newInstance(clazz, slices + 1);
-    for (int i = 0; i < bufs.length; i++) {
-      bufs[i] = sliceProvider.get();
-    }
-    this.buffers = bufs;
-    this.clearer = clearer;
-    this.clock = clock;
-  }
-
-  /**
-   * Return the index of the latest Histogram.
-   * You have to modulo it with buffer.length before accessing the array with this number.
-   */
-  protected int getCurrentIndex() {
-    long now = clock.nowMillis();
-    return (int) (now / sliceDuration);
-  }
-
-  /**
-   * Check for expired elements and return the current one.
-   */
-  protected T getCurrent() {
-    sync(getCurrentIndex());
-    return buffers[(int) (index % buffers.length)];
-  }
-
-  /**
-   * Check for expired elements and return all the tenured (old) ones.
-   */
-  protected T[] getTenured() {
-    long currentIndex = getCurrentIndex();
-    sync(currentIndex);
-    @SuppressWarnings("unchecked") // safe because we have the clazz proof of type T
-    T[] tmp = (T[]) Array.newInstance(clazz, buffers.length - 1);
-    for (int i = 0; i < tmp.length; i++) {
-      int idx = (int) ((currentIndex + 1 + i) % buffers.length);
-      tmp[i] = buffers[idx];
-    }
-    return tmp;
-  }
-
-  /**
-   * Clear all the elements.
-   */
-  public void clear() {
-    for (int i = 0; i <= buffers.length; i++) {
-      buffers[i] = clearer.apply(buffers[i]);
-    }
-  }
-
-  /**
-   * Synchronize elements with a point in time.
-   * i.e. Check for expired ones and clear them, and update the index variable.
-   */
-  protected void sync(long currentIndex) {
-    if (index < currentIndex) {
-      long from = Math.max(index + 1, currentIndex - buffers.length + 1);
-      for (long i = from; i <= currentIndex; i++) {
-        int idx = (int) (i % buffers.length);
-        buffers[idx] = clearer.apply(buffers[idx]);
-      }
-      index = currentIndex;
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/stats/WindowedApproxHistogram.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/stats/WindowedApproxHistogram.java b/commons/src/main/java/org/apache/aurora/common/stats/WindowedApproxHistogram.java
deleted file mode 100644
index 6461a2e..0000000
--- a/commons/src/main/java/org/apache/aurora/common/stats/WindowedApproxHistogram.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.stats;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Function;
-import com.google.common.base.Supplier;
-
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Data;
-import org.apache.aurora.common.quantity.Time;
-import org.apache.aurora.common.util.Clock;
-
-/**
- * WindowedApproxHistogram is an implementation of WindowedHistogram with an
- * ApproximateHistogram as the underlying storing histogram.
- */
-public class WindowedApproxHistogram extends WindowedHistogram<ApproximateHistogram> {
-  @VisibleForTesting public static final int DEFAULT_SLICES = 3;
-  @VisibleForTesting public static final Amount<Long, Time> DEFAULT_WINDOW =
-      Amount.of(1L, Time.MINUTES);
-  @VisibleForTesting public static final Amount<Long, Data> DEFAULT_MAX_MEMORY = Amount.of(
-      (DEFAULT_SLICES + 1) * ApproximateHistogram.DEFAULT_MAX_MEMORY.as(Data.BYTES), Data.BYTES);
-
-  /**
-   * Create a {@code WindowedApproxHistogram } with a window duration of {@code window} and
-   * decomposed in {@code slices} Histograms. Those Histograms will individually take less than
-   * {@code maxMemory / (slices + 1)}. The clock will be used to find the correct index in the
-   * ring buffer.
-   *
-   * @param window duration of the window
-   * @param slices number of slices in the window
-   * @param maxMemory maximum memory used by the whole histogram
-   */
-  public WindowedApproxHistogram(Amount<Long, Time> window, final int slices,
-      final Amount<Long, Data> maxMemory, Clock clock) {
-    super(ApproximateHistogram.class, window, slices,
-        new Supplier<ApproximateHistogram>() {
-          private Amount<Long, Data> perHistogramMemory = Amount.of(
-              maxMemory.as(Data.BYTES) / (slices + 1), Data.BYTES);
-          @Override
-          public ApproximateHistogram get() {
-            return new ApproximateHistogram(perHistogramMemory);
-          }
-        },
-        new Function<ApproximateHistogram[], Histogram>() {
-          @Override
-          public Histogram apply(ApproximateHistogram[] histograms) {
-            return ApproximateHistogram.merge(histograms);
-          }
-        }, clock);
-  }
-
-  /**
-   * Create a {@code WindowedApproxHistogram } with a window duration of {@code window} and
-   * decomposed in {@code slices} Histograms. Those Histograms will individually have a
-   * precision of {@code precision / (slices + 1)}. The ticker will be used to measure elapsed
-   * time in the WindowedHistogram.
-   *
-   * @param window duration of the window
-   * @param slices number of slices in the window
-   * @param precision precision of the whole histogram
-   */
-  public WindowedApproxHistogram(Amount<Long, Time> window, final int slices,
-      final Precision precision, Clock clock) {
-    super(ApproximateHistogram.class, window, slices,
-        new Supplier<ApproximateHistogram>() {
-          private Precision perHistogramPrecision = new Precision(
-              precision.getEpsilon(), precision.getN() / (slices + 1));
-          @Override
-          public ApproximateHistogram get() {
-            return new ApproximateHistogram(perHistogramPrecision);
-          }
-        },
-        new Function<ApproximateHistogram[], Histogram>() {
-          @Override
-          public Histogram apply(ApproximateHistogram[] histograms) {
-            return ApproximateHistogram.merge(histograms);
-          }
-        }, clock);
-  }
-
-  /**
-   * Equivalent to calling
-   * {@link #WindowedApproxHistogram(Amount, int, Amount, Clock)}
-   * with the System clock.
-   */
-  public WindowedApproxHistogram(Amount<Long, Time> window, int slices,
-      Amount<Long, Data> maxMemory) {
-    this(window, slices, maxMemory, Clock.SYSTEM_CLOCK);
-  }
-
-  /**
-   * Equivalent to calling
-   * {@link #WindowedApproxHistogram(Amount, int, Amount)}
-   * with default window and slices.
-   */
-  public WindowedApproxHistogram(Amount<Long, Data> maxMemory) {
-    this(DEFAULT_WINDOW, DEFAULT_SLICES, maxMemory);
-  }
-
-  /**
-   * Equivalent to calling
-   * {@link #WindowedApproxHistogram(Amount, int, Precision, Clock)}
-   * with the System clock.
-   */
-  public WindowedApproxHistogram(Amount<Long, Time> window, int slices, Precision precision) {
-    this(window, slices, precision, Clock.SYSTEM_CLOCK);
-  }
-
-  /**
-   * Equivalent to calling
-   * {@link #WindowedApproxHistogram(Amount, int, Precision)}
-   * with default window and slices.
-   */
-  public WindowedApproxHistogram(Precision precision) {
-    this(DEFAULT_WINDOW, DEFAULT_SLICES, precision);
-  }
-
-  /**
-   * Equivalent to calling
-   * {@link #WindowedApproxHistogram(Amount, int, Amount, Clock)}
-   * with the default maxMemory parameter and System clock.
-   */
-  public WindowedApproxHistogram(Amount<Long, Time> window, int slices) {
-    this(window, slices, DEFAULT_MAX_MEMORY, Clock.SYSTEM_CLOCK);
-  }
-
-  /**
-   * WindowedApproxHistogram constructor with default values.
-   */
-  public WindowedApproxHistogram() {
-    this(DEFAULT_WINDOW, DEFAULT_SLICES, DEFAULT_MAX_MEMORY, Clock.SYSTEM_CLOCK);
-  }
-
-  /**
-   * WindowedApproxHistogram constructor with custom Clock (for testing purposes only).
-   */
-  @VisibleForTesting public WindowedApproxHistogram(Clock clock) {
-    this(DEFAULT_WINDOW, DEFAULT_SLICES, DEFAULT_MAX_MEMORY, clock);
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/stats/WindowedHistogram.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/stats/WindowedHistogram.java b/commons/src/main/java/org/apache/aurora/common/stats/WindowedHistogram.java
deleted file mode 100644
index 23e2f4f..0000000
--- a/commons/src/main/java/org/apache/aurora/common/stats/WindowedHistogram.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.stats;
-
-import com.google.common.base.Function;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Supplier;
-
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-import org.apache.aurora.common.util.Clock;
-
-/**
- * Histogram windowed over time.
- * <p>
- * This histogram is composed of a series of ({@code slices} + 1) histograms representing a window
- * of {@code range} duration. We only update the latest one, and we query the oldest ones (i.e. all
- * histograms except the head).
- * </p>
- * <pre>
- *      range
- * <------------->
- * [AAA][BBB][CCC][DDD]   here slices = 3
- * --------------------->
- *                t1  t2
- *
- *  For t in [t1,t2) we:
- *  insert elements in DDD
- *  query quantile over [AAA][BBB][CCC]
- * </pre>
- * <p>
- * When {@code t} is in {@code [t1, t2)} we insert value into the latest histogram (DDD here),
- * when we query the histogram, we 'merge' all other histograms (all except the latest) and query
- * it. when {@code t > t2} the oldest histogram become the newest (like in a ring buffer) and
- * so on ...
- * </p>
- * <p>
- * Note: We use MergedHistogram class to represent a merged histogram without actually
- * merging the underlying histograms.
- * </p>
- */
-public class WindowedHistogram<H extends Histogram> extends Windowed<H> implements Histogram {
-
-  private long mergedHistIndex = -1L;
-  private Function<H[], Histogram> merger;
-  private Histogram mergedHistogram = null;
-
-  /**
-   * Create a WindowedHistogram of {@code slices + 1} elements over a time {@code window}.
-   * This code is independent from the implementation of Histogram, you just need to provide
-   * a {@code Supplier<H>} to create the histograms and a {@code Function<H[], Histogram>} to
-   * merge them.
-   *
-   * @param clazz the type of the underlying Histogram H
-   * @param window the length of the window
-   * @param slices the number of slices (the window will be divided into {@code slices} slices)
-   * @param sliceProvider the supplier of histogram
-   * @param merger the function that merge an array of histogram H[] into a single Histogram
-   * @param clock the clock used for to select the appropriate histogram
-   */
-  public WindowedHistogram(Class<H> clazz, Amount<Long, Time> window, int slices,
-        Supplier<H> sliceProvider, Function<H[], Histogram> merger, Clock clock) {
-    super(clazz, window, slices, sliceProvider, new Function<H, H>() {
-      @Override
-      public H apply(H h) { h.clear(); return h; }
-    }, clock);
-    Preconditions.checkNotNull(merger);
-
-    this.merger = merger;
-  }
-
-  @Override
-  public synchronized void add(long x) {
-    getCurrent().add(x);
-  }
-
-  @Override
-  public synchronized void clear() {
-    for (Histogram h: buffers) {
-      h.clear();
-    }
-  }
-
-  @Override
-  public synchronized long getQuantile(double quantile) {
-    long currentIndex = getCurrentIndex();
-    if (mergedHistIndex < currentIndex) {
-      H[] tmp = getTenured();
-      mergedHistogram = merger.apply(tmp);
-      mergedHistIndex = currentIndex;
-    }
-    return mergedHistogram.getQuantile(quantile);
-  }
-
-  @Override
-  public synchronized long[] getQuantiles(double[] quantiles) {
-    return Histograms.extractQuantiles(this, quantiles);
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/stats/WindowedStatistics.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/stats/WindowedStatistics.java b/commons/src/main/java/org/apache/aurora/common/stats/WindowedStatistics.java
deleted file mode 100644
index ded3faf..0000000
--- a/commons/src/main/java/org/apache/aurora/common/stats/WindowedStatistics.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.stats;
-
-import com.google.common.base.Supplier;
-import com.google.common.base.Function;
-
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-import org.apache.aurora.common.util.Clock;
-
-/**
- * Keep track of statistics over a set of value in a sliding window.
- * WARNING: The computation of the statistics needs to be explicitly requested with
- * {@code refresh()} before reading any statistics.
- *
- * @see Windowed class for more details about how the window is parametrized.
- */
-public class WindowedStatistics extends Windowed<Statistics> implements StatisticsInterface {
-  private int lastIndex = -1;
-  private double variance = 0.0;
-  private double mean = 0.0;
-  private long sum = 0L;
-  private long min = Long.MAX_VALUE;
-  private long max = Long.MIN_VALUE;
-  private long populationSize = 0L;
-
-  public WindowedStatistics(Amount<Long, Time> window, int slices, Clock clock) {
-    super(Statistics.class, window, slices,
-        new Supplier<Statistics>() {
-          @Override public Statistics get() { return new Statistics(); }
-        },
-        new Function<Statistics, Statistics>() {
-          @Override public Statistics apply(Statistics s) { s.clear(); return s; }
-        },
-        clock);
-  }
-
-  /**
-   * Construct a Statistics sliced over time in {@code slices + 1} windows.
-   * The {@code window} parameter represents the total window, that will be sliced into
-   * {@code slices + 1} parts.
-   *
-   * Ex: WindowedStatistics(Amount.of(1L, Time.MINUTES), 3) will be sliced like this:
-   * <pre>
-   *        20s         20s         20s         20s
-   *   [----A-----][-----B----][-----C----][-----D----]
-   * </pre>
-   * The current window is 'D' (the one you insert elements into) and the tenured windows
-   * are 'A', 'B', 'C' (the ones you read elements from).
-   */
-  public WindowedStatistics(Amount<Long, Time> window, int slices) {
-    this(window, slices, Clock.SYSTEM_CLOCK);
-  }
-
-  /**
-   * Equivalent to calling {@link #WindowedStatistics(Amount, int)} with a 1 minute window
-   * and 3 slices.
-   */
-  public WindowedStatistics() {
-    this(Amount.of(1L, Time.MINUTES), 3, Clock.SYSTEM_CLOCK);
-  }
-
-  public void accumulate(long value) {
-    getCurrent().accumulate(value);
-  }
-
-  /**
-   * Compute all the statistics in one pass.
-   */
-  public void refresh() {
-    int currentIndex = getCurrentIndex();
-    if (lastIndex != currentIndex) {
-      lastIndex = currentIndex;
-      double x = 0.0;
-      variance = 0.0;
-      mean = 0.0;
-      sum = 0L;
-      populationSize = 0L;
-      min = Long.MAX_VALUE;
-      max = Long.MIN_VALUE;
-      for (Statistics s : getTenured()) {
-        if (s.populationSize() == 0) {
-          continue;
-        }
-        x += s.populationSize() * (s.variance() + s.mean() * s.mean());
-        sum += s.sum();
-        populationSize += s.populationSize();
-        min = Math.min(min, s.min());
-        max = Math.max(max, s.max());
-      }
-      if (populationSize != 0) {
-        mean = ((double) sum) / populationSize;
-        variance = x / populationSize - mean * mean;
-      }
-    }
-  }
-
-  /**
-   * WARNING: You need to call refresh() to recompute the variance
-   * @return the variance of the aggregated windows
-   */
-  public double variance() {
-    return variance;
-  }
-
-  /**
-   * WARNING: You need to call refresh() to recompute the variance
-   * @return the standard deviation of the aggregated windows
-   */
-  public double standardDeviation() {
-    return Math.sqrt(variance());
-  }
-
-  /**
-   * WARNING: You need to call refresh() to recompute the variance
-   * @return the mean of the aggregated windows
-   */
-  public double mean() {
-    return mean;
-  }
-
-  /**
-   * WARNING: You need to call refresh() to recompute the variance
-   * @return the sum of the aggregated windows
-   */
-  public long sum() {
-    return sum;
-  }
-
-  /**
-   * WARNING: You need to call refresh() to recompute the variance
-   * @return the min of the aggregated windows
-   */
-  public long min() {
-    return min;
-  }
-
-  /**
-   * WARNING: You need to call refresh() to recompute the variance
-   * @return the max of the aggregated windows
-   */
-  public long max() {
-    return max;
-  }
-
-  /**
-   * WARNING: You need to call refresh() to recompute the variance
-   * @return the range of the aggregated windows
-   */
-  public long range() {
-    return max - min;
-  }
-
-  /**
-   * WARNING: You need to call refresh() to recompute the variance
-   * @return the population size of the aggregated windows
-   */
-  public long populationSize() {
-    return populationSize;
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/stats/testing/RealHistogram.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/stats/testing/RealHistogram.java b/commons/src/main/java/org/apache/aurora/common/stats/testing/RealHistogram.java
deleted file mode 100644
index 36b1174..0000000
--- a/commons/src/main/java/org/apache/aurora/common/stats/testing/RealHistogram.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.stats.testing;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.aurora.common.stats.Histogram;
-import org.apache.aurora.common.stats.Histograms;
-
-public class RealHistogram implements Histogram {
-  private final List<Long> buffer = new ArrayList<Long>();
-
-  @Override public void add(long x) {
-    buffer.add(x);
-  }
-
-  @Override public void clear() {
-    buffer.clear();
-  }
-
-  @Override public long getQuantile(double quantile) {
-    Collections.sort(buffer);
-    return buffer.get((int) (quantile * buffer.size()));
-  }
-
-  @Override public long[] getQuantiles(double[] quantiles) {
-    return Histograms.extractQuantiles(this, quantiles);
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/testing/TearDownRegistry.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/testing/TearDownRegistry.java b/commons/src/main/java/org/apache/aurora/common/testing/TearDownRegistry.java
deleted file mode 100644
index 02db075..0000000
--- a/commons/src/main/java/org/apache/aurora/common/testing/TearDownRegistry.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.testing;
-
-import com.google.common.base.Preconditions;
-import com.google.common.testing.TearDown;
-import com.google.common.testing.TearDownAccepter;
-
-import org.apache.aurora.common.application.ShutdownRegistry;
-import org.apache.aurora.common.base.ExceptionalCommand;
-
-/**
- * An action registry suitable for use as a shutdownRegistry in tests that extend
- * {@link com.google.common.testing.junit4.TearDownTestCase}.
- *
- * @author John Sirois
- */
-public class TearDownRegistry implements ShutdownRegistry {
-  private final TearDownAccepter tearDownAccepter;
-
-  /**
-   * Creates a new tear down registry that delegates execution of shutdown actions to a
-   * {@code tearDownAccepter}.
-   *
-   * @param tearDownAccepter A tear down accepter that will be used to register shutdown actions
-   *     with.
-   */
-  public TearDownRegistry(TearDownAccepter tearDownAccepter) {
-    this.tearDownAccepter = Preconditions.checkNotNull(tearDownAccepter);
-  }
-
-  @Override
-  public <E extends Exception, T extends ExceptionalCommand<E>> void addAction(final T action) {
-    tearDownAccepter.addTearDown(new TearDown() {
-      @Override public void tearDown() throws Exception {
-        action.execute();
-      }
-    });
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/testing/mockito/MockitoTest.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/testing/mockito/MockitoTest.java b/commons/src/main/java/org/apache/aurora/common/testing/mockito/MockitoTest.java
deleted file mode 100644
index cef57cc..0000000
--- a/commons/src/main/java/org/apache/aurora/common/testing/mockito/MockitoTest.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.testing.mockito;
-
-import org.junit.Before;
-import org.mockito.MockitoAnnotations;
-
-/**
- * A base class for tests that use Mockito. Before each test, it initializes all the mocks
- * declared in the class.
- */
-public abstract class MockitoTest  {
-  /**
-   * Initializes all fields annotated with {@link org.mockito.Mock}.
-   */
-  @Before
-  public final void initMockito() {
-    MockitoAnnotations.initMocks(this);
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/thrift/Config.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/thrift/Config.java b/commons/src/main/java/org/apache/aurora/common/thrift/Config.java
deleted file mode 100644
index 7ab122b..0000000
--- a/commons/src/main/java/org/apache/aurora/common/thrift/Config.java
+++ /dev/null
@@ -1,302 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.thrift;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Predicates;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-import org.apache.aurora.common.stats.Stats;
-import org.apache.aurora.common.stats.StatsProvider;
-
-/**
- * Represents the configuration for a thrift call.  Use {@link #builder()} to create a new one or
- * or {@link #builder(Config)} to create a new config based on another config.
- *
- * <p>If a deadline is specified, it acts as a global timeout for each thrift call made.
- * Obtaining connections, performing the remote call and executing retries are all expected to
- * complete within this deadline.  When the specified deadline is not met, an
- * {@link TTimeoutException} will be thrown.
- *
- * <p>If max retries is specified as zero (never retry), then the list of retryable exceptions are
- * ignored.  It is only when max retries is greater than zero that list of retryable exceptions is
- * used to determine if a particular failed call should be retried.
- *
- * @author John Sirois
- */
-public class Config {
-
-  /**
-   * Created a builder for a new {@link Config}.  Default values are as follows:
-   * <ul>
-   * <li>{@link #getRequestTimeout()} 0
-   * <li>{@link #getMaxRetries()} 0
-   * <li>{@link #getRetryableExceptions()} []
-   * <li>{@link #isDebug()} ()} false
-   * </ul>
-   */
-  public static Builder builder() {
-    return new Builder();
-  }
-
-  /**
-   *
-   * @param config the builder configuration to use
-   */
-  public static Builder builder(Config config) {
-    Preconditions.checkNotNull(config);
-    return new Builder(config);
-  }
-
-  private static final Amount<Long,Time> DEADLINE_BLOCKING = Amount.of(0L, Time.MILLISECONDS);
-
-  @VisibleForTesting
-  static final Amount<Long,Time> DEFAULT_CONNECT_TIMEOUT = Amount.of(5L, Time.SECONDS);
-
-  private Amount<Long, Time> requestTimeout = DEADLINE_BLOCKING;
-  private Amount<Long, Time> connectTimeout = DEFAULT_CONNECT_TIMEOUT;
-  private int maxRetries;
-  private ImmutableSet<Class<? extends Exception>> retryableExceptions = ImmutableSet.of();
-  private boolean debug = false;
-  private boolean enableStats = true;
-  private StatsProvider statsProvider = Stats.STATS_PROVIDER;
-
-  private Config() {
-    // defaults
-  }
-
-  private Config(Config copyFrom) {
-    requestTimeout = copyFrom.requestTimeout;
-    maxRetries = copyFrom.maxRetries;
-    retryableExceptions = copyFrom.retryableExceptions;
-    debug = copyFrom.debug;
-    statsProvider = copyFrom.statsProvider;
-  }
-
-  /**
-   * Returns the maximum time to wait for any thrift call to complete.  A deadline of 0 means to
-   * wait forever
-   */
-  public Amount<Long, Time> getRequestTimeout() {
-    return requestTimeout;
-  }
-
-  /**
-   * Returns the maximum time to wait for a connection to be established.  A deadline of 0 means to
-   * wait forever
-   */
-  public Amount<Long, Time> getConnectTimeout() {
-    return connectTimeout;
-  }
-
-  /**
-   * Returns the maximum number of retries to perform for each thrift call.  A value of 0 means to
-   * never retry and in this case {@link #getRetryableExceptions()} will be an empty set.
-   */
-  public int getMaxRetries() {
-    return maxRetries;
-  }
-
-  /**
-   * Returns the set of exceptions to retry calls for.  The returned set will only be empty if
-   * {@link #getMaxRetries()} is 0.
-   */
-  public ImmutableSet<Class<? extends Exception>> getRetryableExceptions() {
-    return retryableExceptions;
-  }
-
-  /**
-   * Returns {@code true} if the client should log extra debugging information.  Currently this
-   * includes method call arguments when RPCs fail with exceptions.
-   */
-  public boolean isDebug() {
-    return debug;
-  }
-
-  /**
-   * Returns {@code true} if the client should track request statistics.
-   */
-  public boolean enableStats() {
-    return enableStats;
-  }
-
-  /**
-   * Returns the stats provider to use to record Thrift client stats.
-   */
-  public StatsProvider getStatsProvider() {
-    return statsProvider;
-  }
-
-  // This was made public because it seems to be causing problems for scala users when it is not
-  // public.
-  public static abstract class AbstractBuilder<T extends AbstractBuilder> {
-    private final Config config;
-
-    AbstractBuilder() {
-      this.config = new Config();
-    }
-
-    AbstractBuilder(Config template) {
-      Preconditions.checkNotNull(template);
-      this.config = new Config(template);
-    }
-
-    protected abstract T getThis();
-
-    // TODO(John Sirois): extra validation or design ... can currently do strange things like:
-    // builder.blocking().withDeadline(1, TimeUnit.MILLISECONDS)
-    // builder.noRetries().retryOn(TException.class)
-
-    /**
-     * Specifies that all calls be blocking calls with no inherent deadline.  It may be the
-     * case that underlying transports will eventually deadline, but {@link Thrift} will not
-     * enforce a deadline.
-     */
-    public final T blocking() {
-      config.requestTimeout = DEADLINE_BLOCKING;
-      return getThis();
-    }
-
-    /**
-     * Specifies that all calls be subject to a global timeout.  This deadline includes all call
-     * activities, including obtaining a free connection and any automatic retries.
-     */
-    public final T withRequestTimeout(Amount<Long, Time> timeout) {
-      Preconditions.checkNotNull(timeout);
-      Preconditions.checkArgument(timeout.getValue() >= 0,
-          "A negative deadline is invalid: %s", timeout);
-      config.requestTimeout = timeout;
-      return getThis();
-    }
-
-    /**
-     * Assigns the timeout for all connections established with the blocking client.
-     * On an asynchronous client this timeout is only used for the connection pool lock
-     * acquisition on initial calls (not retries, @see withRetries).  The actual network
-     * connection timeout for the asynchronous client is governed by socketTimeout.
-     *
-     * @param timeout Connection timeout.
-     * @return A reference to the builder.
-     */
-    public final T withConnectTimeout(Amount<Long, Time> timeout) {
-      Preconditions.checkNotNull(timeout);
-      Preconditions.checkArgument(timeout.getValue() >= 0,
-          "A negative deadline is invalid: %s", timeout);
-      config.connectTimeout = timeout;
-      return getThis();
-    }
-
-    /**
-     * Specifies that no calls be automatically retried.
-     */
-    public final T noRetries() {
-      config.maxRetries = 0;
-      config.retryableExceptions = ImmutableSet.of();
-      return getThis();
-    }
-
-    /**
-     * Specifies that failing calls meeting {@link #retryOn retry} criteria be retried up to a
-     * maximum of {@code retries} times before failing.  On an asynchronous client, these retries
-     * will be forced to be non-blocking, failing fast if they cannot immediately acquire the
-     * connection pool locks, so they only provide a best-effort retry strategy there.
-     */
-    public final T withRetries(int retries) {
-      Preconditions.checkArgument(retries >= 0, "A negative retry count is invalid: %d", retries);
-      config.maxRetries = retries;
-      return getThis();
-    }
-
-    /**
-     * Specifies the set of exception classes that are to be considered retryable (if retries are
-     * enabled).  Any exceptions thrown by the underlying thrift call will be considered retryable
-     * if they are an instance of any one of the specified exception classes.  The set of exception
-     * classes must contain at least exception class.  To specify no retries either use
-     * {@link #noRetries()} or pass zero to {@link #withRetries(int)}.
-     */
-    public final T retryOn(Iterable<? extends Class<? extends Exception>> retryableExceptions) {
-      Preconditions.checkNotNull(retryableExceptions);
-      ImmutableSet<Class<? extends Exception>> classes =
-          ImmutableSet.copyOf(Iterables.filter(retryableExceptions, Predicates.notNull()));
-      Preconditions.checkArgument(!classes.isEmpty(),
-          "Must provide at least one retryable exception class");
-      config.retryableExceptions = classes;
-      return getThis();
-    }
-
-    /**
-     * Specifies the set of exception classes that are to be considered retryable (if retries are
-     * enabled).  Any exceptions thrown by the underlying thrift call will be considered retryable
-     * if they are an instance of any one of the specified exception classes.  The set of exception
-     * classes must contain at least exception class.  To specify no retries either use
-     * {@link #noRetries()} or pass zero to {@link #withRetries(int)}.
-     */
-    public final T retryOn(Class<? extends Exception> exception) {
-      Preconditions.checkNotNull(exception);
-      config.retryableExceptions =
-          ImmutableSet.<Class<? extends Exception>>builder().add(exception).build();
-      return getThis();
-    }
-
-    /**
-     * When {@code debug == true}, specifies that extra debugging information should be logged.
-     */
-    public final T withDebug(boolean debug) {
-      config.debug = debug;
-      return getThis();
-    }
-
-    /**
-     * Disables stats collection on the client (enabled by default).
-     */
-    public T disableStats() {
-      config.enableStats = false;
-      return getThis();
-    }
-
-    /**
-     * Registers a custom stats provider to use to track various client stats.
-     */
-    public T withStatsProvider(StatsProvider statsProvider) {
-      config.statsProvider = Preconditions.checkNotNull(statsProvider);
-      return getThis();
-    }
-
-    protected final Config getConfig() {
-      return config;
-    }
-  }
-
-  public static final class Builder extends AbstractBuilder<Builder> {
-    private Builder() {
-      super();
-    }
-
-    private Builder(Config template) {
-      super(template);
-    }
-
-    @Override
-    protected Builder getThis() {
-      return this;
-    }
-
-    public Config create() {
-      return getConfig();
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/thrift/TResourceExhaustedException.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/thrift/TResourceExhaustedException.java b/commons/src/main/java/org/apache/aurora/common/thrift/TResourceExhaustedException.java
deleted file mode 100644
index 54e2bd3..0000000
--- a/commons/src/main/java/org/apache/aurora/common/thrift/TResourceExhaustedException.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.thrift;
-
-import org.apache.thrift.TException;
-
-/**
- * @author Adam Samet
- *
- * This is exception is thrown when there are no available instances of a thrift backend
- * service to serve requests.
- */
-public class TResourceExhaustedException extends TException {
-
-  private static final long serialVersionUID = 1L;
-
-  public TResourceExhaustedException(String message) {
-    super(message);
-  }
-
-  public TResourceExhaustedException(Throwable cause) {
-    super(cause);
-  }
-
-  public TResourceExhaustedException(String message, Throwable cause) {
-    super(message, cause);
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/thrift/TTimeoutException.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/thrift/TTimeoutException.java b/commons/src/main/java/org/apache/aurora/common/thrift/TTimeoutException.java
deleted file mode 100644
index 068abea..0000000
--- a/commons/src/main/java/org/apache/aurora/common/thrift/TTimeoutException.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.thrift;
-
-import org.apache.thrift.TException;
-
-/**
- * @author Adam Samet
- *
- * This is exception is thrown when accessing a thrift service resource times out.
- */
-public class TTimeoutException extends TException {
-
-  private static final long serialVersionUID = 1L;
-
-  public TTimeoutException(String message) {
-    super(message);
-  }
-
-  public TTimeoutException(Throwable cause) {
-    super(cause);
-  }
-
-  public TTimeoutException(String message, Throwable cause) {
-    super(message, cause);
-  }
-}


[08/21] aurora git commit: Remove unused classes from commons fork.

Posted by wf...@apache.org.
http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/resources/org/apache/aurora/common/common/webassets/bootstrap/2.3.2/css/bootstrap.min.css
----------------------------------------------------------------------
diff --git a/commons/src/main/resources/org/apache/aurora/common/common/webassets/bootstrap/2.3.2/css/bootstrap.min.css b/commons/src/main/resources/org/apache/aurora/common/common/webassets/bootstrap/2.3.2/css/bootstrap.min.css
deleted file mode 100644
index e09dac8..0000000
--- a/commons/src/main/resources/org/apache/aurora/common/common/webassets/bootstrap/2.3.2/css/bootstrap.min.css
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- */.clearfix{*zoom:1}.clearfix:before,.clearfix:after{display:table;line-height:0;content:""}.clearfix:after{clear:both}.hide-text{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.input-block-level{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block}audio,canvas,video{display:inline-block;*display:inline;*zoom:1}audio:not([controls]){display:none}html{font-size:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}a:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}a:hover,a:active{outline:0}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{width:auto\9;height:auto;max-width:100%;vertical-align:middle;border:0;-ms-interpolation-mode:bicubic}#map_canvas img,.google-maps img{max-widt
 h:none}button,input,select,textarea{margin:0;font-size:100%;vertical-align:middle}button,input{*overflow:visible;line-height:normal}button::-moz-focus-inner,input::-moz-focus-inner{padding:0;border:0}button,html input[type="button"],input[type="reset"],input[type="submit"]{cursor:pointer;-webkit-appearance:button}label,select,button,input[type="button"],input[type="reset"],input[type="submit"],input[type="radio"],input[type="checkbox"]{cursor:pointer}input[type="search"]{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;-webkit-appearance:textfield}input[type="search"]::-webkit-search-decoration,input[type="search"]::-webkit-search-cancel-button{-webkit-appearance:none}textarea{overflow:auto;vertical-align:top}@media print{*{color:#000!important;text-shadow:none!important;background:transparent!important;box-shadow:none!important}a,a:visited{text-decoration:underline}a[href]:after{content:" (" attr(href) ")"}abbr[title]:after{content:" (" attr(title) 
 ")"}.ir a:after,a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100%!important}@page{margin:.5cm}p,h2,h3{orphans:3;widows:3}h2,h3{page-break-after:avoid}}body{margin:0;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;line-height:20px;color:#333;background-color:#fff}a{color:#08c;text-decoration:none}a:hover,a:focus{color:#005580;text-decoration:underline}.img-rounded{-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px}.img-polaroid{padding:4px;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.2);-webkit-box-shadow:0 1px 3px rgba(0,0,0,0.1);-moz-box-shadow:0 1px 3px rgba(0,0,0,0.1);box-shadow:0 1px 3px rgba(0,0,0,0.1)}.img-circle{-webkit-border-radius:500px;-moz-border-radius:500px;border-radius:500px}.row{margin-left:-20px;*zoom:1}.row:before,.row:after{display:table;line-hei
 ght:0;content:""}.row:after{clear:both}[class*="span"]{float:left;min-height:1px;margin-left:20px}.container,.navbar-static-top .container,.navbar-fixed-top .container,.navbar-fixed-bottom .container{width:940px}.span12{width:940px}.span11{width:860px}.span10{width:780px}.span9{width:700px}.span8{width:620px}.span7{width:540px}.span6{width:460px}.span5{width:380px}.span4{width:300px}.span3{width:220px}.span2{width:140px}.span1{width:60px}.offset12{margin-left:980px}.offset11{margin-left:900px}.offset10{margin-left:820px}.offset9{margin-left:740px}.offset8{margin-left:660px}.offset7{margin-left:580px}.offset6{margin-left:500px}.offset5{margin-left:420px}.offset4{margin-left:340px}.offset3{margin-left:260px}.offset2{margin-left:180px}.offset1{margin-left:100px}.row-fluid{width:100%;*zoom:1}.row-fluid:before,.row-fluid:after{display:table;line-height:0;content:""}.row-fluid:after{clear:both}.row-fluid [class*="span"]{display:block;float:left;width:100%;min-height:30px;margin-left:2.127
 659574468085%;*margin-left:2.074468085106383%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.row-fluid [class*="span"]:first-child{margin-left:0}.row-fluid .controls-row [class*="span"]+[class*="span"]{margin-left:2.127659574468085%}.row-fluid .span12{width:100%;*width:99.94680851063829%}.row-fluid .span11{width:91.48936170212765%;*width:91.43617021276594%}.row-fluid .span10{width:82.97872340425532%;*width:82.92553191489361%}.row-fluid .span9{width:74.46808510638297%;*width:74.41489361702126%}.row-fluid .span8{width:65.95744680851064%;*width:65.90425531914893%}.row-fluid .span7{width:57.44680851063829%;*width:57.39361702127659%}.row-fluid .span6{width:48.93617021276595%;*width:48.88297872340425%}.row-fluid .span5{width:40.42553191489362%;*width:40.37234042553192%}.row-fluid .span4{width:31.914893617021278%;*width:31.861702127659576%}.row-fluid .span3{width:23.404255319148934%;*width:23.351063829787233%}.row-fluid .span2{width:14.893617021276595%;*wid
 th:14.840425531914894%}.row-fluid .span1{width:6.382978723404255%;*width:6.329787234042553%}.row-fluid .offset12{margin-left:104.25531914893617%;*margin-left:104.14893617021275%}.row-fluid .offset12:first-child{margin-left:102.12765957446808%;*margin-left:102.02127659574467%}.row-fluid .offset11{margin-left:95.74468085106382%;*margin-left:95.6382978723404%}.row-fluid .offset11:first-child{margin-left:93.61702127659574%;*margin-left:93.51063829787232%}.row-fluid .offset10{margin-left:87.23404255319149%;*margin-left:87.12765957446807%}.row-fluid .offset10:first-child{margin-left:85.1063829787234%;*margin-left:84.99999999999999%}.row-fluid .offset9{margin-left:78.72340425531914%;*margin-left:78.61702127659572%}.row-fluid .offset9:first-child{margin-left:76.59574468085106%;*margin-left:76.48936170212764%}.row-fluid .offset8{margin-left:70.2127659574468%;*margin-left:70.10638297872339%}.row-fluid .offset8:first-child{margin-left:68.08510638297872%;*margin-left:67.9787234042553%}.row-flui
 d .offset7{margin-left:61.70212765957446%;*margin-left:61.59574468085106%}.row-fluid .offset7:first-child{margin-left:59.574468085106375%;*margin-left:59.46808510638297%}.row-fluid .offset6{margin-left:53.191489361702125%;*margin-left:53.085106382978715%}.row-fluid .offset6:first-child{margin-left:51.063829787234035%;*margin-left:50.95744680851063%}.row-fluid .offset5{margin-left:44.68085106382979%;*margin-left:44.57446808510638%}.row-fluid .offset5:first-child{margin-left:42.5531914893617%;*margin-left:42.4468085106383%}.row-fluid .offset4{margin-left:36.170212765957444%;*margin-left:36.06382978723405%}.row-fluid .offset4:first-child{margin-left:34.04255319148936%;*margin-left:33.93617021276596%}.row-fluid .offset3{margin-left:27.659574468085104%;*margin-left:27.5531914893617%}.row-fluid .offset3:first-child{margin-left:25.53191489361702%;*margin-left:25.425531914893618%}.row-fluid .offset2{margin-left:19.148936170212764%;*margin-left:19.04255319148936%}.row-fluid .offset2:first-ch
 ild{margin-left:17.02127659574468%;*margin-left:16.914893617021278%}.row-fluid .offset1{margin-left:10.638297872340425%;*margin-left:10.53191489361702%}.row-fluid .offset1:first-child{margin-left:8.51063829787234%;*margin-left:8.404255319148938%}[class*="span"].hide,.row-fluid [class*="span"].hide{display:none}[class*="span"].pull-right,.row-fluid [class*="span"].pull-right{float:right}.container{margin-right:auto;margin-left:auto;*zoom:1}.container:before,.container:after{display:table;line-height:0;content:""}.container:after{clear:both}.container-fluid{padding-right:20px;padding-left:20px;*zoom:1}.container-fluid:before,.container-fluid:after{display:table;line-height:0;content:""}.container-fluid:after{clear:both}p{margin:0 0 10px}.lead{margin-bottom:20px;font-size:21px;font-weight:200;line-height:30px}small{font-size:85%}strong{font-weight:bold}em{font-style:italic}cite{font-style:normal}.muted{color:#999}a.muted:hover,a.muted:focus{color:#808080}.text-warning{color:#c09853}a.t
 ext-warning:hover,a.text-warning:focus{color:#a47e3c}.text-error{color:#b94a48}a.text-error:hover,a.text-error:focus{color:#953b39}.text-info{color:#3a87ad}a.text-info:hover,a.text-info:focus{color:#2d6987}.text-success{color:#468847}a.text-success:hover,a.text-success:focus{color:#356635}.text-left{text-align:left}.text-right{text-align:right}.text-center{text-align:center}h1,h2,h3,h4,h5,h6{margin:10px 0;font-family:inherit;font-weight:bold;line-height:20px;color:inherit;text-rendering:optimizelegibility}h1 small,h2 small,h3 small,h4 small,h5 small,h6 small{font-weight:normal;line-height:1;color:#999}h1,h2,h3{line-height:40px}h1{font-size:38.5px}h2{font-size:31.5px}h3{font-size:24.5px}h4{font-size:17.5px}h5{font-size:14px}h6{font-size:11.9px}h1 small{font-size:24.5px}h2 small{font-size:17.5px}h3 small{font-size:14px}h4 small{font-size:14px}.page-header{padding-bottom:9px;margin:20px 0 30px;border-bottom:1px solid #eee}ul,ol{padding:0;margin:0 0 10px 25px}ul ul,ul ol,ol ol,ol ul{mar
 gin-bottom:0}li{line-height:20px}ul.unstyled,ol.unstyled{margin-left:0;list-style:none}ul.inline,ol.inline{margin-left:0;list-style:none}ul.inline>li,ol.inline>li{display:inline-block;*display:inline;padding-right:5px;padding-left:5px;*zoom:1}dl{margin-bottom:20px}dt,dd{line-height:20px}dt{font-weight:bold}dd{margin-left:10px}.dl-horizontal{*zoom:1}.dl-horizontal:before,.dl-horizontal:after{display:table;line-height:0;content:""}.dl-horizontal:after{clear:both}.dl-horizontal dt{float:left;width:160px;overflow:hidden;clear:left;text-align:right;text-overflow:ellipsis;white-space:nowrap}.dl-horizontal dd{margin-left:180px}hr{margin:20px 0;border:0;border-top:1px solid #eee;border-bottom:1px solid #fff}abbr[title],abbr[data-original-title]{cursor:help;border-bottom:1px dotted #999}abbr.initialism{font-size:90%;text-transform:uppercase}blockquote{padding:0 0 0 15px;margin:0 0 20px;border-left:5px solid #eee}blockquote p{margin-bottom:0;font-size:17.5px;font-weight:300;line-height:1.25}b
 lockquote small{display:block;line-height:20px;color:#999}blockquote small:before{content:'\2014 \00A0'}blockquote.pull-right{float:right;padding-right:15px;padding-left:0;border-right:5px solid #eee;border-left:0}blockquote.pull-right p,blockquote.pull-right small{text-align:right}blockquote.pull-right small:before{content:''}blockquote.pull-right small:after{content:'\00A0 \2014'}q:before,q:after,blockquote:before,blockquote:after{content:""}address{display:block;margin-bottom:20px;font-style:normal;line-height:20px}code,pre{padding:0 3px 2px;font-family:Monaco,Menlo,Consolas,"Courier New",monospace;font-size:12px;color:#333;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}code{padding:2px 4px;color:#d14;white-space:nowrap;background-color:#f7f7f9;border:1px solid #e1e1e8}pre{display:block;padding:9.5px;margin:0 0 10px;font-size:13px;line-height:20px;word-break:break-all;word-wrap:break-word;white-space:pre;white-space:pre-wrap;background-color:#f5f5f5;border:1px
  solid #ccc;border:1px solid rgba(0,0,0,0.15);-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}pre.prettyprint{margin-bottom:20px}pre code{padding:0;color:inherit;white-space:pre;white-space:pre-wrap;background-color:transparent;border:0}.pre-scrollable{max-height:340px;overflow-y:scroll}form{margin:0 0 20px}fieldset{padding:0;margin:0;border:0}legend{display:block;width:100%;padding:0;margin-bottom:20px;font-size:21px;line-height:40px;color:#333;border:0;border-bottom:1px solid #e5e5e5}legend small{font-size:15px;color:#999}label,input,button,select,textarea{font-size:14px;font-weight:normal;line-height:20px}input,button,select,textarea{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif}label{display:block;margin-bottom:5px}select,textarea,input[type="text"],input[type="password"],input[type="datetime"],input[type="datetime-local"],input[type="date"],input[type="month"],input[type="time"],input[type="week"],input[type="number"],input[type="email"],input[type=
 "url"],input[type="search"],input[type="tel"],input[type="color"],.uneditable-input{display:inline-block;height:20px;padding:4px 6px;margin-bottom:10px;font-size:14px;line-height:20px;color:#555;vertical-align:middle;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}input,textarea,.uneditable-input{width:206px}textarea{height:auto}textarea,input[type="text"],input[type="password"],input[type="datetime"],input[type="datetime-local"],input[type="date"],input[type="month"],input[type="time"],input[type="week"],input[type="number"],input[type="email"],input[type="url"],input[type="search"],input[type="tel"],input[type="color"],.uneditable-input{background-color:#fff;border:1px solid #ccc;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-webkit-transition:border linear .2s,box-shadow linear .2s;-moz-transition:border linear .2s,box-shadow linear .2s;-o-transition:border lin
 ear .2s,box-shadow linear .2s;transition:border linear .2s,box-shadow linear .2s}textarea:focus,input[type="text"]:focus,input[type="password"]:focus,input[type="datetime"]:focus,input[type="datetime-local"]:focus,input[type="date"]:focus,input[type="month"]:focus,input[type="time"]:focus,input[type="week"]:focus,input[type="number"]:focus,input[type="email"]:focus,input[type="url"]:focus,input[type="search"]:focus,input[type="tel"]:focus,input[type="color"]:focus,.uneditable-input:focus{border-color:rgba(82,168,236,0.8);outline:0;outline:thin dotted \9;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(82,168,236,0.6);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(82,168,236,0.6);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(82,168,236,0.6)}input[type="radio"],input[type="checkbox"]{margin:4px 0 0;margin-top:1px \9;*margin-top:0;line-height:normal}input[type="file"],input[type="image"],input[type="submit"],input[type="reset"],input[type="b
 utton"],input[type="radio"],input[type="checkbox"]{width:auto}select,input[type="file"]{height:30px;*margin-top:4px;line-height:30px}select{width:220px;background-color:#fff;border:1px solid #ccc}select[multiple],select[size]{height:auto}select:focus,input[type="file"]:focus,input[type="radio"]:focus,input[type="checkbox"]:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.uneditable-input,.uneditable-textarea{color:#999;cursor:not-allowed;background-color:#fcfcfc;border-color:#ccc;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.025);-moz-box-shadow:inset 0 1px 2px rgba(0,0,0,0.025);box-shadow:inset 0 1px 2px rgba(0,0,0,0.025)}.uneditable-input{overflow:hidden;white-space:nowrap}.uneditable-textarea{width:auto;height:auto}input:-moz-placeholder,textarea:-moz-placeholder{color:#999}input:-ms-input-placeholder,textarea:-ms-input-placeholder{color:#999}input::-webkit-input-placeholder,textarea::-webkit-input-placeholder{color:#999}.radio,.chec
 kbox{min-height:20px;padding-left:20px}.radio input[type="radio"],.checkbox input[type="checkbox"]{float:left;margin-left:-20px}.controls>.radio:first-child,.controls>.checkbox:first-child{padding-top:5px}.radio.inline,.checkbox.inline{display:inline-block;padding-top:5px;margin-bottom:0;vertical-align:middle}.radio.inline+.radio.inline,.checkbox.inline+.checkbox.inline{margin-left:10px}.input-mini{width:60px}.input-small{width:90px}.input-medium{width:150px}.input-large{width:210px}.input-xlarge{width:270px}.input-xxlarge{width:530px}input[class*="span"],select[class*="span"],textarea[class*="span"],.uneditable-input[class*="span"],.row-fluid input[class*="span"],.row-fluid select[class*="span"],.row-fluid textarea[class*="span"],.row-fluid .uneditable-input[class*="span"]{float:none;margin-left:0}.input-append input[class*="span"],.input-append .uneditable-input[class*="span"],.input-prepend input[class*="span"],.input-prepend .uneditable-input[class*="span"],.row-fluid input[clas
 s*="span"],.row-fluid select[class*="span"],.row-fluid textarea[class*="span"],.row-fluid .uneditable-input[class*="span"],.row-fluid .input-prepend [class*="span"],.row-fluid .input-append [class*="span"]{display:inline-block}input,textarea,.uneditable-input{margin-left:0}.controls-row [class*="span"]+[class*="span"]{margin-left:20px}input.span12,textarea.span12,.uneditable-input.span12{width:926px}input.span11,textarea.span11,.uneditable-input.span11{width:846px}input.span10,textarea.span10,.uneditable-input.span10{width:766px}input.span9,textarea.span9,.uneditable-input.span9{width:686px}input.span8,textarea.span8,.uneditable-input.span8{width:606px}input.span7,textarea.span7,.uneditable-input.span7{width:526px}input.span6,textarea.span6,.uneditable-input.span6{width:446px}input.span5,textarea.span5,.uneditable-input.span5{width:366px}input.span4,textarea.span4,.uneditable-input.span4{width:286px}input.span3,textarea.span3,.uneditable-input.span3{width:206px}input.span2,textarea.
 span2,.uneditable-input.span2{width:126px}input.span1,textarea.span1,.uneditable-input.span1{width:46px}.controls-row{*zoom:1}.controls-row:before,.controls-row:after{display:table;line-height:0;content:""}.controls-row:after{clear:both}.controls-row [class*="span"],.row-fluid .controls-row [class*="span"]{float:left}.controls-row .checkbox[class*="span"],.controls-row .radio[class*="span"]{padding-top:5px}input[disabled],select[disabled],textarea[disabled],input[readonly],select[readonly],textarea[readonly]{cursor:not-allowed;background-color:#eee}input[type="radio"][disabled],input[type="checkbox"][disabled],input[type="radio"][readonly],input[type="checkbox"][readonly]{background-color:transparent}.control-group.warning .control-label,.control-group.warning .help-block,.control-group.warning .help-inline{color:#c09853}.control-group.warning .checkbox,.control-group.warning .radio,.control-group.warning input,.control-group.warning select,.control-group.warning textarea{color:#c09
 853}.control-group.warning input,.control-group.warning select,.control-group.warning textarea{border-color:#c09853;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.control-group.warning input:focus,.control-group.warning select:focus,.control-group.warning textarea:focus{border-color:#a47e3c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #dbc59e;-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #dbc59e;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #dbc59e}.control-group.warning .input-prepend .add-on,.control-group.warning .input-append .add-on{color:#c09853;background-color:#fcf8e3;border-color:#c09853}.control-group.error .control-label,.control-group.error .help-block,.control-group.error .help-inline{color:#b94a48}.control-group.error .checkbox,.control-group.error .radio,.control-group.error input,.control-group.error select,.control-group.error text
 area{color:#b94a48}.control-group.error input,.control-group.error select,.control-group.error textarea{border-color:#b94a48;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.control-group.error input:focus,.control-group.error select:focus,.control-group.error textarea:focus{border-color:#953b39;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #d59392;-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #d59392;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #d59392}.control-group.error .input-prepend .add-on,.control-group.error .input-append .add-on{color:#b94a48;background-color:#f2dede;border-color:#b94a48}.control-group.success .control-label,.control-group.success .help-block,.control-group.success .help-inline{color:#468847}.control-group.success .checkbox,.control-group.success .radio,.control-group.success input,.control-group.success select,.control-gro
 up.success textarea{color:#468847}.control-group.success input,.control-group.success select,.control-group.success textarea{border-color:#468847;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.control-group.success input:focus,.control-group.success select:focus,.control-group.success textarea:focus{border-color:#356635;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7aba7b;-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7aba7b;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7aba7b}.control-group.success .input-prepend .add-on,.control-group.success .input-append .add-on{color:#468847;background-color:#dff0d8;border-color:#468847}.control-group.info .control-label,.control-group.info .help-block,.control-group.info .help-inline{color:#3a87ad}.control-group.info .checkbox,.control-group.info .radio,.control-group.info input,.control-group.info select,.c
 ontrol-group.info textarea{color:#3a87ad}.control-group.info input,.control-group.info select,.control-group.info textarea{border-color:#3a87ad;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.control-group.info input:focus,.control-group.info select:focus,.control-group.info textarea:focus{border-color:#2d6987;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7ab5d3;-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7ab5d3;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7ab5d3}.control-group.info .input-prepend .add-on,.control-group.info .input-append .add-on{color:#3a87ad;background-color:#d9edf7;border-color:#3a87ad}input:focus:invalid,textarea:focus:invalid,select:focus:invalid{color:#b94a48;border-color:#ee5f5b}input:focus:invalid:focus,textarea:focus:invalid:focus,select:focus:invalid:focus{border-color:#e9322d;-webkit-box-shadow:0 0 6px #f8b9b7;-moz-b
 ox-shadow:0 0 6px #f8b9b7;box-shadow:0 0 6px #f8b9b7}.form-actions{padding:19px 20px 20px;margin-top:20px;margin-bottom:20px;background-color:#f5f5f5;border-top:1px solid #e5e5e5;*zoom:1}.form-actions:before,.form-actions:after{display:table;line-height:0;content:""}.form-actions:after{clear:both}.help-block,.help-inline{color:#595959}.help-block{display:block;margin-bottom:10px}.help-inline{display:inline-block;*display:inline;padding-left:5px;vertical-align:middle;*zoom:1}.input-append,.input-prepend{display:inline-block;margin-bottom:10px;font-size:0;white-space:nowrap;vertical-align:middle}.input-append input,.input-prepend input,.input-append select,.input-prepend select,.input-append .uneditable-input,.input-prepend .uneditable-input,.input-append .dropdown-menu,.input-prepend .dropdown-menu,.input-append .popover,.input-prepend .popover{font-size:14px}.input-append input,.input-prepend input,.input-append select,.input-prepend select,.input-append .uneditable-input,.input-pre
 pend .uneditable-input{position:relative;margin-bottom:0;*margin-left:0;vertical-align:top;-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0}.input-append input:focus,.input-prepend input:focus,.input-append select:focus,.input-prepend select:focus,.input-append .uneditable-input:focus,.input-prepend .uneditable-input:focus{z-index:2}.input-append .add-on,.input-prepend .add-on{display:inline-block;width:auto;height:20px;min-width:16px;padding:4px 5px;font-size:14px;font-weight:normal;line-height:20px;text-align:center;text-shadow:0 1px 0 #fff;background-color:#eee;border:1px solid #ccc}.input-append .add-on,.input-prepend .add-on,.input-append .btn,.input-prepend .btn,.input-append .btn-group>.dropdown-toggle,.input-prepend .btn-group>.dropdown-toggle{vertical-align:top;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.input-append .active,.input-prepend .active{background-color:#a9dba9;border-color:#46a546}.input-prepend .add-on
 ,.input-prepend .btn{margin-right:-1px}.input-prepend .add-on:first-child,.input-prepend .btn:first-child{-webkit-border-radius:4px 0 0 4px;-moz-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px}.input-append input,.input-append select,.input-append .uneditable-input{-webkit-border-radius:4px 0 0 4px;-moz-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px}.input-append input+.btn-group .btn:last-child,.input-append select+.btn-group .btn:last-child,.input-append .uneditable-input+.btn-group .btn:last-child{-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0}.input-append .add-on,.input-append .btn,.input-append .btn-group{margin-left:-1px}.input-append .add-on:last-child,.input-append .btn:last-child,.input-append .btn-group:last-child>.dropdown-toggle{-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0}.input-prepend.input-append input,.input-prepend.input-append select,.input-prepend.input-append .une
 ditable-input{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.input-prepend.input-append input+.btn-group .btn,.input-prepend.input-append select+.btn-group .btn,.input-prepend.input-append .uneditable-input+.btn-group .btn{-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0}.input-prepend.input-append .add-on:first-child,.input-prepend.input-append .btn:first-child{margin-right:-1px;-webkit-border-radius:4px 0 0 4px;-moz-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px}.input-prepend.input-append .add-on:last-child,.input-prepend.input-append .btn:last-child{margin-left:-1px;-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0}.input-prepend.input-append .btn-group:first-child{margin-left:0}input.search-query{padding-right:14px;padding-right:4px \9;padding-left:14px;padding-left:4px \9;margin-bottom:0;-webkit-border-radius:15px;-moz-border-radius:15px;border-radius:15px}.form-search .input
 -append .search-query,.form-search .input-prepend .search-query{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.form-search .input-append .search-query{-webkit-border-radius:14px 0 0 14px;-moz-border-radius:14px 0 0 14px;border-radius:14px 0 0 14px}.form-search .input-append .btn{-webkit-border-radius:0 14px 14px 0;-moz-border-radius:0 14px 14px 0;border-radius:0 14px 14px 0}.form-search .input-prepend .search-query{-webkit-border-radius:0 14px 14px 0;-moz-border-radius:0 14px 14px 0;border-radius:0 14px 14px 0}.form-search .input-prepend .btn{-webkit-border-radius:14px 0 0 14px;-moz-border-radius:14px 0 0 14px;border-radius:14px 0 0 14px}.form-search input,.form-inline input,.form-horizontal input,.form-search textarea,.form-inline textarea,.form-horizontal textarea,.form-search select,.form-inline select,.form-horizontal select,.form-search .help-inline,.form-inline .help-inline,.form-horizontal .help-inline,.form-search .uneditable-input,.form-inline .uneditable-inp
 ut,.form-horizontal .uneditable-input,.form-search .input-prepend,.form-inline .input-prepend,.form-horizontal .input-prepend,.form-search .input-append,.form-inline .input-append,.form-horizontal .input-append{display:inline-block;*display:inline;margin-bottom:0;vertical-align:middle;*zoom:1}.form-search .hide,.form-inline .hide,.form-horizontal .hide{display:none}.form-search label,.form-inline label,.form-search .btn-group,.form-inline .btn-group{display:inline-block}.form-search .input-append,.form-inline .input-append,.form-search .input-prepend,.form-inline .input-prepend{margin-bottom:0}.form-search .radio,.form-search .checkbox,.form-inline .radio,.form-inline .checkbox{padding-left:0;margin-bottom:0;vertical-align:middle}.form-search .radio input[type="radio"],.form-search .checkbox input[type="checkbox"],.form-inline .radio input[type="radio"],.form-inline .checkbox input[type="checkbox"]{float:left;margin-right:3px;margin-left:0}.control-group{margin-bottom:10px}legend+.c
 ontrol-group{margin-top:20px;-webkit-margin-top-collapse:separate}.form-horizontal .control-group{margin-bottom:20px;*zoom:1}.form-horizontal .control-group:before,.form-horizontal .control-group:after{display:table;line-height:0;content:""}.form-horizontal .control-group:after{clear:both}.form-horizontal .control-label{float:left;width:160px;padding-top:5px;text-align:right}.form-horizontal .controls{*display:inline-block;*padding-left:20px;margin-left:180px;*margin-left:0}.form-horizontal .controls:first-child{*padding-left:180px}.form-horizontal .help-block{margin-bottom:0}.form-horizontal input+.help-block,.form-horizontal select+.help-block,.form-horizontal textarea+.help-block,.form-horizontal .uneditable-input+.help-block,.form-horizontal .input-prepend+.help-block,.form-horizontal .input-append+.help-block{margin-top:10px}.form-horizontal .form-actions{padding-left:180px}table{max-width:100%;background-color:transparent;border-collapse:collapse;border-spacing:0}.table{width:
 100%;margin-bottom:20px}.table th,.table td{padding:8px;line-height:20px;text-align:left;vertical-align:top;border-top:1px solid #ddd}.table th{font-weight:bold}.table thead th{vertical-align:bottom}.table caption+thead tr:first-child th,.table caption+thead tr:first-child td,.table colgroup+thead tr:first-child th,.table colgroup+thead tr:first-child td,.table thead:first-child tr:first-child th,.table thead:first-child tr:first-child td{border-top:0}.table tbody+tbody{border-top:2px solid #ddd}.table .table{background-color:#fff}.table-condensed th,.table-condensed td{padding:4px 5px}.table-bordered{border:1px solid #ddd;border-collapse:separate;*border-collapse:collapse;border-left:0;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.table-bordered th,.table-bordered td{border-left:1px solid #ddd}.table-bordered caption+thead tr:first-child th,.table-bordered caption+tbody tr:first-child th,.table-bordered caption+tbody tr:first-child td,.table-bordered colgroup+
 thead tr:first-child th,.table-bordered colgroup+tbody tr:first-child th,.table-bordered colgroup+tbody tr:first-child td,.table-bordered thead:first-child tr:first-child th,.table-bordered tbody:first-child tr:first-child th,.table-bordered tbody:first-child tr:first-child td{border-top:0}.table-bordered thead:first-child tr:first-child>th:first-child,.table-bordered tbody:first-child tr:first-child>td:first-child,.table-bordered tbody:first-child tr:first-child>th:first-child{-webkit-border-top-left-radius:4px;border-top-left-radius:4px;-moz-border-radius-topleft:4px}.table-bordered thead:first-child tr:first-child>th:last-child,.table-bordered tbody:first-child tr:first-child>td:last-child,.table-bordered tbody:first-child tr:first-child>th:last-child{-webkit-border-top-right-radius:4px;border-top-right-radius:4px;-moz-border-radius-topright:4px}.table-bordered thead:last-child tr:last-child>th:first-child,.table-bordered tbody:last-child tr:last-child>td:first-child,.table-borde
 red tbody:last-child tr:last-child>th:first-child,.table-bordered tfoot:last-child tr:last-child>td:first-child,.table-bordered tfoot:last-child tr:last-child>th:first-child{-webkit-border-bottom-left-radius:4px;border-bottom-left-radius:4px;-moz-border-radius-bottomleft:4px}.table-bordered thead:last-child tr:last-child>th:last-child,.table-bordered tbody:last-child tr:last-child>td:last-child,.table-bordered tbody:last-child tr:last-child>th:last-child,.table-bordered tfoot:last-child tr:last-child>td:last-child,.table-bordered tfoot:last-child tr:last-child>th:last-child{-webkit-border-bottom-right-radius:4px;border-bottom-right-radius:4px;-moz-border-radius-bottomright:4px}.table-bordered tfoot+tbody:last-child tr:last-child td:first-child{-webkit-border-bottom-left-radius:0;border-bottom-left-radius:0;-moz-border-radius-bottomleft:0}.table-bordered tfoot+tbody:last-child tr:last-child td:last-child{-webkit-border-bottom-right-radius:0;border-bottom-right-radius:0;-moz-border-ra
 dius-bottomright:0}.table-bordered caption+thead tr:first-child th:first-child,.table-bordered caption+tbody tr:first-child td:first-child,.table-bordered colgroup+thead tr:first-child th:first-child,.table-bordered colgroup+tbody tr:first-child td:first-child{-webkit-border-top-left-radius:4px;border-top-left-radius:4px;-moz-border-radius-topleft:4px}.table-bordered caption+thead tr:first-child th:last-child,.table-bordered caption+tbody tr:first-child td:last-child,.table-bordered colgroup+thead tr:first-child th:last-child,.table-bordered colgroup+tbody tr:first-child td:last-child{-webkit-border-top-right-radius:4px;border-top-right-radius:4px;-moz-border-radius-topright:4px}.table-striped tbody>tr:nth-child(odd)>td,.table-striped tbody>tr:nth-child(odd)>th{background-color:#f9f9f9}.table-hover tbody tr:hover>td,.table-hover tbody tr:hover>th{background-color:#f5f5f5}table td[class*="span"],table th[class*="span"],.row-fluid table td[class*="span"],.row-fluid table th[class*="sp
 an"]{display:table-cell;float:none;margin-left:0}.table td.span1,.table th.span1{float:none;width:44px;margin-left:0}.table td.span2,.table th.span2{float:none;width:124px;margin-left:0}.table td.span3,.table th.span3{float:none;width:204px;margin-left:0}.table td.span4,.table th.span4{float:none;width:284px;margin-left:0}.table td.span5,.table th.span5{float:none;width:364px;margin-left:0}.table td.span6,.table th.span6{float:none;width:444px;margin-left:0}.table td.span7,.table th.span7{float:none;width:524px;margin-left:0}.table td.span8,.table th.span8{float:none;width:604px;margin-left:0}.table td.span9,.table th.span9{float:none;width:684px;margin-left:0}.table td.span10,.table th.span10{float:none;width:764px;margin-left:0}.table td.span11,.table th.span11{float:none;width:844px;margin-left:0}.table td.span12,.table th.span12{float:none;width:924px;margin-left:0}.table tbody tr.success>td{background-color:#dff0d8}.table tbody tr.error>td{background-color:#f2dede}.table tbody 
 tr.warning>td{background-color:#fcf8e3}.table tbody tr.info>td{background-color:#d9edf7}.table-hover tbody tr.success:hover>td{background-color:#d0e9c6}.table-hover tbody tr.error:hover>td{background-color:#ebcccc}.table-hover tbody tr.warning:hover>td{background-color:#faf2cc}.table-hover tbody tr.info:hover>td{background-color:#c4e3f3}[class^="icon-"],[class*=" icon-"]{display:inline-block;width:14px;height:14px;margin-top:1px;*margin-right:.3em;line-height:14px;vertical-align:text-top;background-image:url("../img/glyphicons-halflings.png");background-position:14px 14px;background-repeat:no-repeat}.icon-white,.nav-pills>.active>a>[class^="icon-"],.nav-pills>.active>a>[class*=" icon-"],.nav-list>.active>a>[class^="icon-"],.nav-list>.active>a>[class*=" icon-"],.navbar-inverse .nav>.active>a>[class^="icon-"],.navbar-inverse .nav>.active>a>[class*=" icon-"],.dropdown-menu>li>a:hover>[class^="icon-"],.dropdown-menu>li>a:focus>[class^="icon-"],.dropdown-menu>li>a:hover>[class*=" icon-"]
 ,.dropdown-menu>li>a:focus>[class*=" icon-"],.dropdown-menu>.active>a>[class^="icon-"],.dropdown-menu>.active>a>[class*=" icon-"],.dropdown-submenu:hover>a>[class^="icon-"],.dropdown-submenu:focus>a>[class^="icon-"],.dropdown-submenu:hover>a>[class*=" icon-"],.dropdown-submenu:focus>a>[class*=" icon-"]{background-image:url("../img/glyphicons-halflings-white.png")}.icon-glass{background-position:0 0}.icon-music{background-position:-24px 0}.icon-search{background-position:-48px 0}.icon-envelope{background-position:-72px 0}.icon-heart{background-position:-96px 0}.icon-star{background-position:-120px 0}.icon-star-empty{background-position:-144px 0}.icon-user{background-position:-168px 0}.icon-film{background-position:-192px 0}.icon-th-large{background-position:-216px 0}.icon-th{background-position:-240px 0}.icon-th-list{background-position:-264px 0}.icon-ok{background-position:-288px 0}.icon-remove{background-position:-312px 0}.icon-zoom-in{background-position:-336px 0}.icon-zoom-out{ba
 ckground-position:-360px 0}.icon-off{background-position:-384px 0}.icon-signal{background-position:-408px 0}.icon-cog{background-position:-432px 0}.icon-trash{background-position:-456px 0}.icon-home{background-position:0 -24px}.icon-file{background-position:-24px -24px}.icon-time{background-position:-48px -24px}.icon-road{background-position:-72px -24px}.icon-download-alt{background-position:-96px -24px}.icon-download{background-position:-120px -24px}.icon-upload{background-position:-144px -24px}.icon-inbox{background-position:-168px -24px}.icon-play-circle{background-position:-192px -24px}.icon-repeat{background-position:-216px -24px}.icon-refresh{background-position:-240px -24px}.icon-list-alt{background-position:-264px -24px}.icon-lock{background-position:-287px -24px}.icon-flag{background-position:-312px -24px}.icon-headphones{background-position:-336px -24px}.icon-volume-off{background-position:-360px -24px}.icon-volume-down{background-position:-384px -24px}.icon-volume-up{back
 ground-position:-408px -24px}.icon-qrcode{background-position:-432px -24px}.icon-barcode{background-position:-456px -24px}.icon-tag{background-position:0 -48px}.icon-tags{background-position:-25px -48px}.icon-book{background-position:-48px -48px}.icon-bookmark{background-position:-72px -48px}.icon-print{background-position:-96px -48px}.icon-camera{background-position:-120px -48px}.icon-font{background-position:-144px -48px}.icon-bold{background-position:-167px -48px}.icon-italic{background-position:-192px -48px}.icon-text-height{background-position:-216px -48px}.icon-text-width{background-position:-240px -48px}.icon-align-left{background-position:-264px -48px}.icon-align-center{background-position:-288px -48px}.icon-align-right{background-position:-312px -48px}.icon-align-justify{background-position:-336px -48px}.icon-list{background-position:-360px -48px}.icon-indent-left{background-position:-384px -48px}.icon-indent-right{background-position:-408px -48px}.icon-facetime-video{backg
 round-position:-432px -48px}.icon-picture{background-position:-456px -48px}.icon-pencil{background-position:0 -72px}.icon-map-marker{background-position:-24px -72px}.icon-adjust{background-position:-48px -72px}.icon-tint{background-position:-72px -72px}.icon-edit{background-position:-96px -72px}.icon-share{background-position:-120px -72px}.icon-check{background-position:-144px -72px}.icon-move{background-position:-168px -72px}.icon-step-backward{background-position:-192px -72px}.icon-fast-backward{background-position:-216px -72px}.icon-backward{background-position:-240px -72px}.icon-play{background-position:-264px -72px}.icon-pause{background-position:-288px -72px}.icon-stop{background-position:-312px -72px}.icon-forward{background-position:-336px -72px}.icon-fast-forward{background-position:-360px -72px}.icon-step-forward{background-position:-384px -72px}.icon-eject{background-position:-408px -72px}.icon-chevron-left{background-position:-432px -72px}.icon-chevron-right{background-p
 osition:-456px -72px}.icon-plus-sign{background-position:0 -96px}.icon-minus-sign{background-position:-24px -96px}.icon-remove-sign{background-position:-48px -96px}.icon-ok-sign{background-position:-72px -96px}.icon-question-sign{background-position:-96px -96px}.icon-info-sign{background-position:-120px -96px}.icon-screenshot{background-position:-144px -96px}.icon-remove-circle{background-position:-168px -96px}.icon-ok-circle{background-position:-192px -96px}.icon-ban-circle{background-position:-216px -96px}.icon-arrow-left{background-position:-240px -96px}.icon-arrow-right{background-position:-264px -96px}.icon-arrow-up{background-position:-289px -96px}.icon-arrow-down{background-position:-312px -96px}.icon-share-alt{background-position:-336px -96px}.icon-resize-full{background-position:-360px -96px}.icon-resize-small{background-position:-384px -96px}.icon-plus{background-position:-408px -96px}.icon-minus{background-position:-433px -96px}.icon-asterisk{background-position:-456px -9
 6px}.icon-exclamation-sign{background-position:0 -120px}.icon-gift{background-position:-24px -120px}.icon-leaf{background-position:-48px -120px}.icon-fire{background-position:-72px -120px}.icon-eye-open{background-position:-96px -120px}.icon-eye-close{background-position:-120px -120px}.icon-warning-sign{background-position:-144px -120px}.icon-plane{background-position:-168px -120px}.icon-calendar{background-position:-192px -120px}.icon-random{width:16px;background-position:-216px -120px}.icon-comment{background-position:-240px -120px}.icon-magnet{background-position:-264px -120px}.icon-chevron-up{background-position:-288px -120px}.icon-chevron-down{background-position:-313px -119px}.icon-retweet{background-position:-336px -120px}.icon-shopping-cart{background-position:-360px -120px}.icon-folder-close{width:16px;background-position:-384px -120px}.icon-folder-open{width:16px;background-position:-408px -120px}.icon-resize-vertical{background-position:-432px -119px}.icon-resize-horizont
 al{background-position:-456px -118px}.icon-hdd{background-position:0 -144px}.icon-bullhorn{background-position:-24px -144px}.icon-bell{background-position:-48px -144px}.icon-certificate{background-position:-72px -144px}.icon-thumbs-up{background-position:-96px -144px}.icon-thumbs-down{background-position:-120px -144px}.icon-hand-right{background-position:-144px -144px}.icon-hand-left{background-position:-168px -144px}.icon-hand-up{background-position:-192px -144px}.icon-hand-down{background-position:-216px -144px}.icon-circle-arrow-right{background-position:-240px -144px}.icon-circle-arrow-left{background-position:-264px -144px}.icon-circle-arrow-up{background-position:-288px -144px}.icon-circle-arrow-down{background-position:-312px -144px}.icon-globe{background-position:-336px -144px}.icon-wrench{background-position:-360px -144px}.icon-tasks{background-position:-384px -144px}.icon-filter{background-position:-408px -144px}.icon-briefcase{background-position:-432px -144px}.icon-fulls
 creen{background-position:-456px -144px}.dropup,.dropdown{position:relative}.dropdown-toggle{*margin-bottom:-3px}.dropdown-toggle:active,.open .dropdown-toggle{outline:0}.caret{display:inline-block;width:0;height:0;vertical-align:top;border-top:4px solid #000;border-right:4px solid transparent;border-left:4px solid transparent;content:""}.dropdown .caret{margin-top:8px;margin-left:2px}.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:160px;padding:5px 0;margin:2px 0 0;list-style:none;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.2);*border-right-width:2px;*border-bottom-width:2px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,0.2);-moz-box-shadow:0 5px 10px rgba(0,0,0,0.2);box-shadow:0 5px 10px rgba(0,0,0,0.2);-webkit-background-clip:padding-box;-moz-background-clip:padding;background-clip:padding-box}.dropdown-menu.pull-right{right:0;left:auto}.drop
 down-menu .divider{*width:100%;height:1px;margin:9px 1px;*margin:-5px 0 5px;overflow:hidden;background-color:#e5e5e5;border-bottom:1px solid #fff}.dropdown-menu>li>a{display:block;padding:3px 20px;clear:both;font-weight:normal;line-height:20px;color:#333;white-space:nowrap}.dropdown-menu>li>a:hover,.dropdown-menu>li>a:focus,.dropdown-submenu:hover>a,.dropdown-submenu:focus>a{color:#fff;text-decoration:none;background-color:#0081c2;background-image:-moz-linear-gradient(top,#08c,#0077b3);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#0077b3));background-image:-webkit-linear-gradient(top,#08c,#0077b3);background-image:-o-linear-gradient(top,#08c,#0077b3);background-image:linear-gradient(to bottom,#08c,#0077b3);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc',endColorstr='#ff0077b3',GradientType=0)}.dropdown-menu>.active>a,.dropdown-menu>.active>a:hover,.dropdown-menu>.active>a:focus{color:#fff;text-decoration:non
 e;background-color:#0081c2;background-image:-moz-linear-gradient(top,#08c,#0077b3);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#0077b3));background-image:-webkit-linear-gradient(top,#08c,#0077b3);background-image:-o-linear-gradient(top,#08c,#0077b3);background-image:linear-gradient(to bottom,#08c,#0077b3);background-repeat:repeat-x;outline:0;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc',endColorstr='#ff0077b3',GradientType=0)}.dropdown-menu>.disabled>a,.dropdown-menu>.disabled>a:hover,.dropdown-menu>.disabled>a:focus{color:#999}.dropdown-menu>.disabled>a:hover,.dropdown-menu>.disabled>a:focus{text-decoration:none;cursor:default;background-color:transparent;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.open{*z-index:1000}.open>.dropdown-menu{display:block}.dropdown-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:990}.pull-right>.dropdown-menu{right:0;left:auto}.dropup .caret,.n
 avbar-fixed-bottom .dropdown .caret{border-top:0;border-bottom:4px solid #000;content:""}.dropup .dropdown-menu,.navbar-fixed-bottom .dropdown .dropdown-menu{top:auto;bottom:100%;margin-bottom:1px}.dropdown-submenu{position:relative}.dropdown-submenu>.dropdown-menu{top:0;left:100%;margin-top:-6px;margin-left:-1px;-webkit-border-radius:0 6px 6px 6px;-moz-border-radius:0 6px 6px 6px;border-radius:0 6px 6px 6px}.dropdown-submenu:hover>.dropdown-menu{display:block}.dropup .dropdown-submenu>.dropdown-menu{top:auto;bottom:0;margin-top:0;margin-bottom:-2px;-webkit-border-radius:5px 5px 5px 0;-moz-border-radius:5px 5px 5px 0;border-radius:5px 5px 5px 0}.dropdown-submenu>a:after{display:block;float:right;width:0;height:0;margin-top:5px;margin-right:-10px;border-color:transparent;border-left-color:#ccc;border-style:solid;border-width:5px 0 5px 5px;content:" "}.dropdown-submenu:hover>a:after{border-left-color:#fff}.dropdown-submenu.pull-left{float:none}.dropdown-submenu.pull-left>.dropdown-men
 u{left:-100%;margin-left:10px;-webkit-border-radius:6px 0 6px 6px;-moz-border-radius:6px 0 6px 6px;border-radius:6px 0 6px 6px}.dropdown .dropdown-menu .nav-header{padding-right:20px;padding-left:20px}.typeahead{z-index:1051;margin-top:2px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.well{min-height:20px;padding:19px;margin-bottom:20px;background-color:#f5f5f5;border:1px solid #e3e3e3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.05);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.05);box-shadow:inset 0 1px 1px rgba(0,0,0,0.05)}.well blockquote{border-color:#ddd;border-color:rgba(0,0,0,0.15)}.well-large{padding:24px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px}.well-small{padding:9px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.fade{opacity:0;-webkit-transition:opacity .15s linear;-moz-transition:opacity .15s linear;-o-transition:opacity .15s linear;t
 ransition:opacity .15s linear}.fade.in{opacity:1}.collapse{position:relative;height:0;overflow:hidden;-webkit-transition:height .35s ease;-moz-transition:height .35s ease;-o-transition:height .35s ease;transition:height .35s ease}.collapse.in{height:auto}.close{float:right;font-size:20px;font-weight:bold;line-height:20px;color:#000;text-shadow:0 1px 0 #fff;opacity:.2;filter:alpha(opacity=20)}.close:hover,.close:focus{color:#000;text-decoration:none;cursor:pointer;opacity:.4;filter:alpha(opacity=40)}button.close{padding:0;cursor:pointer;background:transparent;border:0;-webkit-appearance:none}.btn{display:inline-block;*display:inline;padding:4px 12px;margin-bottom:0;*margin-left:.3em;font-size:14px;line-height:20px;color:#333;text-align:center;text-shadow:0 1px 1px rgba(255,255,255,0.75);vertical-align:middle;cursor:pointer;background-color:#f5f5f5;*background-color:#e6e6e6;background-image:-moz-linear-gradient(top,#fff,#e6e6e6);background-image:-webkit-gradient(linear,0 0,0 100%,from
 (#fff),to(#e6e6e6));background-image:-webkit-linear-gradient(top,#fff,#e6e6e6);background-image:-o-linear-gradient(top,#fff,#e6e6e6);background-image:linear-gradient(to bottom,#fff,#e6e6e6);background-repeat:repeat-x;border:1px solid #ccc;*border:0;border-color:#e6e6e6 #e6e6e6 #bfbfbf;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);border-bottom-color:#b3b3b3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff',endColorstr='#ffe6e6e6',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);*zoom:1;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05);box-shadow:inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05)}.btn:hover,.btn:focus,.btn:active,.btn.active,.btn.disabled,.btn[disabled]{color:#333;background-color:#e6e6e6;*background-color:#
 d9d9d9}.btn:active,.btn.active{background-color:#ccc \9}.btn:first-child{*margin-left:0}.btn:hover,.btn:focus{color:#333;text-decoration:none;background-position:0 -15px;-webkit-transition:background-position .1s linear;-moz-transition:background-position .1s linear;-o-transition:background-position .1s linear;transition:background-position .1s linear}.btn:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.btn.active,.btn:active{background-image:none;outline:0;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,0.15),0 1px 2px rgba(0,0,0,0.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,0.15),0 1px 2px rgba(0,0,0,0.05);box-shadow:inset 0 2px 4px rgba(0,0,0,0.15),0 1px 2px rgba(0,0,0,0.05)}.btn.disabled,.btn[disabled]{cursor:default;background-image:none;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.btn-large{padding:11px 19px;font-size:17.5px;-webkit-border-radius:6px;-moz-border-radius:6px;bord
 er-radius:6px}.btn-large [class^="icon-"],.btn-large [class*=" icon-"]{margin-top:4px}.btn-small{padding:2px 10px;font-size:11.9px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.btn-small [class^="icon-"],.btn-small [class*=" icon-"]{margin-top:0}.btn-mini [class^="icon-"],.btn-mini [class*=" icon-"]{margin-top:-1px}.btn-mini{padding:0 6px;font-size:10.5px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.btn-block{display:block;width:100%;padding-right:0;padding-left:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.btn-block+.btn-block{margin-top:5px}input[type="submit"].btn-block,input[type="reset"].btn-block,input[type="button"].btn-block{width:100%}.btn-primary.active,.btn-warning.active,.btn-danger.active,.btn-success.active,.btn-info.active,.btn-inverse.active{color:rgba(255,255,255,0.75)}.btn-primary{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#006dcc;*background-color:#04c;backgroun
 d-image:-moz-linear-gradient(top,#08c,#04c);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#04c));background-image:-webkit-linear-gradient(top,#08c,#04c);background-image:-o-linear-gradient(top,#08c,#04c);background-image:linear-gradient(to bottom,#08c,#04c);background-repeat:repeat-x;border-color:#04c #04c #002a80;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc',endColorstr='#ff0044cc',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-primary:hover,.btn-primary:focus,.btn-primary:active,.btn-primary.active,.btn-primary.disabled,.btn-primary[disabled]{color:#fff;background-color:#04c;*background-color:#003bb3}.btn-primary:active,.btn-primary.active{background-color:#039 \9}.btn-warning{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#faa732;*background-color:#f89406;background-image:-moz-linear-gradient(top,#fbb450,#f89406)
 ;background-image:-webkit-gradient(linear,0 0,0 100%,from(#fbb450),to(#f89406));background-image:-webkit-linear-gradient(top,#fbb450,#f89406);background-image:-o-linear-gradient(top,#fbb450,#f89406);background-image:linear-gradient(to bottom,#fbb450,#f89406);background-repeat:repeat-x;border-color:#f89406 #f89406 #ad6704;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffbb450',endColorstr='#fff89406',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-warning:hover,.btn-warning:focus,.btn-warning:active,.btn-warning.active,.btn-warning.disabled,.btn-warning[disabled]{color:#fff;background-color:#f89406;*background-color:#df8505}.btn-warning:active,.btn-warning.active{background-color:#c67605 \9}.btn-danger{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#da4f49;*background-color:#bd362f;background-image:-moz-linear-gradient(top,#ee5f5b,#bd362f);backgro
 und-image:-webkit-gradient(linear,0 0,0 100%,from(#ee5f5b),to(#bd362f));background-image:-webkit-linear-gradient(top,#ee5f5b,#bd362f);background-image:-o-linear-gradient(top,#ee5f5b,#bd362f);background-image:linear-gradient(to bottom,#ee5f5b,#bd362f);background-repeat:repeat-x;border-color:#bd362f #bd362f #802420;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffee5f5b',endColorstr='#ffbd362f',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-danger:hover,.btn-danger:focus,.btn-danger:active,.btn-danger.active,.btn-danger.disabled,.btn-danger[disabled]{color:#fff;background-color:#bd362f;*background-color:#a9302a}.btn-danger:active,.btn-danger.active{background-color:#942a25 \9}.btn-success{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#5bb75b;*background-color:#51a351;background-image:-moz-linear-gradient(top,#62c462,#51a351);background-image:-webk
 it-gradient(linear,0 0,0 100%,from(#62c462),to(#51a351));background-image:-webkit-linear-gradient(top,#62c462,#51a351);background-image:-o-linear-gradient(top,#62c462,#51a351);background-image:linear-gradient(to bottom,#62c462,#51a351);background-repeat:repeat-x;border-color:#51a351 #51a351 #387038;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff62c462',endColorstr='#ff51a351',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-success:hover,.btn-success:focus,.btn-success:active,.btn-success.active,.btn-success.disabled,.btn-success[disabled]{color:#fff;background-color:#51a351;*background-color:#499249}.btn-success:active,.btn-success.active{background-color:#408140 \9}.btn-info{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#49afcd;*background-color:#2f96b4;background-image:-moz-linear-gradient(top,#5bc0de,#2f96b4);background-image:-webkit-gradien
 t(linear,0 0,0 100%,from(#5bc0de),to(#2f96b4));background-image:-webkit-linear-gradient(top,#5bc0de,#2f96b4);background-image:-o-linear-gradient(top,#5bc0de,#2f96b4);background-image:linear-gradient(to bottom,#5bc0de,#2f96b4);background-repeat:repeat-x;border-color:#2f96b4 #2f96b4 #1f6377;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de',endColorstr='#ff2f96b4',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-info:hover,.btn-info:focus,.btn-info:active,.btn-info.active,.btn-info.disabled,.btn-info[disabled]{color:#fff;background-color:#2f96b4;*background-color:#2a85a0}.btn-info:active,.btn-info.active{background-color:#24748c \9}.btn-inverse{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#363636;*background-color:#222;background-image:-moz-linear-gradient(top,#444,#222);background-image:-webkit-gradient(linear,0 0,0 100%,from(#444),to(#222))
 ;background-image:-webkit-linear-gradient(top,#444,#222);background-image:-o-linear-gradient(top,#444,#222);background-image:linear-gradient(to bottom,#444,#222);background-repeat:repeat-x;border-color:#222 #222 #000;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff444444',endColorstr='#ff222222',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-inverse:hover,.btn-inverse:focus,.btn-inverse:active,.btn-inverse.active,.btn-inverse.disabled,.btn-inverse[disabled]{color:#fff;background-color:#222;*background-color:#151515}.btn-inverse:active,.btn-inverse.active{background-color:#080808 \9}button.btn,input[type="submit"].btn{*padding-top:3px;*padding-bottom:3px}button.btn::-moz-focus-inner,input[type="submit"].btn::-moz-focus-inner{padding:0;border:0}button.btn.btn-large,input[type="submit"].btn.btn-large{*padding-top:7px;*padding-bottom:7px}button.btn.btn-small,input[typ
 e="submit"].btn.btn-small{*padding-top:3px;*padding-bottom:3px}button.btn.btn-mini,input[type="submit"].btn.btn-mini{*padding-top:1px;*padding-bottom:1px}.btn-link,.btn-link:active,.btn-link[disabled]{background-color:transparent;background-image:none;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.btn-link{color:#08c;cursor:pointer;border-color:transparent;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.btn-link:hover,.btn-link:focus{color:#005580;text-decoration:underline;background-color:transparent}.btn-link[disabled]:hover,.btn-link[disabled]:focus{color:#333;text-decoration:none}.btn-group{position:relative;display:inline-block;*display:inline;*margin-left:.3em;font-size:0;white-space:nowrap;vertical-align:middle;*zoom:1}.btn-group:first-child{*margin-left:0}.btn-group+.btn-group{margin-left:5px}.btn-toolbar{margin-top:10px;margin-bottom:10px;font-size:0}.btn-toolbar>.btn+.btn,.btn-toolbar>.btn-group+.btn,.btn-toolbar>.btn+.btn-group{margin-left:5px
 }.btn-group>.btn{position:relative;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.btn-group>.btn+.btn{margin-left:-1px}.btn-group>.btn,.btn-group>.dropdown-menu,.btn-group>.popover{font-size:14px}.btn-group>.btn-mini{font-size:10.5px}.btn-group>.btn-small{font-size:11.9px}.btn-group>.btn-large{font-size:17.5px}.btn-group>.btn:first-child{margin-left:0;-webkit-border-bottom-left-radius:4px;border-bottom-left-radius:4px;-webkit-border-top-left-radius:4px;border-top-left-radius:4px;-moz-border-radius-bottomleft:4px;-moz-border-radius-topleft:4px}.btn-group>.btn:last-child,.btn-group>.dropdown-toggle{-webkit-border-top-right-radius:4px;border-top-right-radius:4px;-webkit-border-bottom-right-radius:4px;border-bottom-right-radius:4px;-moz-border-radius-topright:4px;-moz-border-radius-bottomright:4px}.btn-group>.btn.large:first-child{margin-left:0;-webkit-border-bottom-left-radius:6px;border-bottom-left-radius:6px;-webkit-border-top-left-radius:6px;border-top-left-radius:6px
 ;-moz-border-radius-bottomleft:6px;-moz-border-radius-topleft:6px}.btn-group>.btn.large:last-child,.btn-group>.large.dropdown-toggle{-webkit-border-top-right-radius:6px;border-top-right-radius:6px;-webkit-border-bottom-right-radius:6px;border-bottom-right-radius:6px;-moz-border-radius-topright:6px;-moz-border-radius-bottomright:6px}.btn-group>.btn:hover,.btn-group>.btn:focus,.btn-group>.btn:active,.btn-group>.btn.active{z-index:2}.btn-group .dropdown-toggle:active,.btn-group.open .dropdown-toggle{outline:0}.btn-group>.btn+.dropdown-toggle{*padding-top:5px;padding-right:8px;*padding-bottom:5px;padding-left:8px;-webkit-box-shadow:inset 1px 0 0 rgba(255,255,255,0.125),inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05);-moz-box-shadow:inset 1px 0 0 rgba(255,255,255,0.125),inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05);box-shadow:inset 1px 0 0 rgba(255,255,255,0.125),inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05)}.btn-group>.btn-mini+.dropdown-
 toggle{*padding-top:2px;padding-right:5px;*padding-bottom:2px;padding-left:5px}.btn-group>.btn-small+.dropdown-toggle{*padding-top:5px;*padding-bottom:4px}.btn-group>.btn-large+.dropdown-toggle{*padding-top:7px;padding-right:12px;*padding-bottom:7px;padding-left:12px}.btn-group.open .dropdown-toggle{background-image:none;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,0.15),0 1px 2px rgba(0,0,0,0.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,0.15),0 1px 2px rgba(0,0,0,0.05);box-shadow:inset 0 2px 4px rgba(0,0,0,0.15),0 1px 2px rgba(0,0,0,0.05)}.btn-group.open .btn.dropdown-toggle{background-color:#e6e6e6}.btn-group.open .btn-primary.dropdown-toggle{background-color:#04c}.btn-group.open .btn-warning.dropdown-toggle{background-color:#f89406}.btn-group.open .btn-danger.dropdown-toggle{background-color:#bd362f}.btn-group.open .btn-success.dropdown-toggle{background-color:#51a351}.btn-group.open .btn-info.dropdown-toggle{background-color:#2f96b4}.btn-group.open .btn-inverse.dropdown-toggl
 e{background-color:#222}.btn .caret{margin-top:8px;margin-left:0}.btn-large .caret{margin-top:6px}.btn-large .caret{border-top-width:5px;border-right-width:5px;border-left-width:5px}.btn-mini .caret,.btn-small .caret{margin-top:8px}.dropup .btn-large .caret{border-bottom-width:5px}.btn-primary .caret,.btn-warning .caret,.btn-danger .caret,.btn-info .caret,.btn-success .caret,.btn-inverse .caret{border-top-color:#fff;border-bottom-color:#fff}.btn-group-vertical{display:inline-block;*display:inline;*zoom:1}.btn-group-vertical>.btn{display:block;float:none;max-width:100%;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.btn-group-vertical>.btn+.btn{margin-top:-1px;margin-left:0}.btn-group-vertical>.btn:first-child{-webkit-border-radius:4px 4px 0 0;-moz-border-radius:4px 4px 0 0;border-radius:4px 4px 0 0}.btn-group-vertical>.btn:last-child{-webkit-border-radius:0 0 4px 4px;-moz-border-radius:0 0 4px 4px;border-radius:0 0 4px 4px}.btn-group-vertical>.btn-large:first-child{-we
 bkit-border-radius:6px 6px 0 0;-moz-border-radius:6px 6px 0 0;border-radius:6px 6px 0 0}.btn-group-vertical>.btn-large:last-child{-webkit-border-radius:0 0 6px 6px;-moz-border-radius:0 0 6px 6px;border-radius:0 0 6px 6px}.alert{padding:8px 35px 8px 14px;margin-bottom:20px;text-shadow:0 1px 0 rgba(255,255,255,0.5);background-color:#fcf8e3;border:1px solid #fbeed5;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.alert,.alert h4{color:#c09853}.alert h4{margin:0}.alert .close{position:relative;top:-2px;right:-21px;line-height:20px}.alert-success{color:#468847;background-color:#dff0d8;border-color:#d6e9c6}.alert-success h4{color:#468847}.alert-danger,.alert-error{color:#b94a48;background-color:#f2dede;border-color:#eed3d7}.alert-danger h4,.alert-error h4{color:#b94a48}.alert-info{color:#3a87ad;background-color:#d9edf7;border-color:#bce8f1}.alert-info h4{color:#3a87ad}.alert-block{padding-top:14px;padding-bottom:14px}.alert-block>p,.alert-block>ul{margin-bottom:0}.alert
 -block p+p{margin-top:5px}.nav{margin-bottom:20px;margin-left:0;list-style:none}.nav>li>a{display:block}.nav>li>a:hover,.nav>li>a:focus{text-decoration:none;background-color:#eee}.nav>li>a>img{max-width:none}.nav>.pull-right{float:right}.nav-header{display:block;padding:3px 15px;font-size:11px;font-weight:bold;line-height:20px;color:#999;text-shadow:0 1px 0 rgba(255,255,255,0.5);text-transform:uppercase}.nav li+.nav-header{margin-top:9px}.nav-list{padding-right:15px;padding-left:15px;margin-bottom:0}.nav-list>li>a,.nav-list .nav-header{margin-right:-15px;margin-left:-15px;text-shadow:0 1px 0 rgba(255,255,255,0.5)}.nav-list>li>a{padding:3px 15px}.nav-list>.active>a,.nav-list>.active>a:hover,.nav-list>.active>a:focus{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.2);background-color:#08c}.nav-list [class^="icon-"],.nav-list [class*=" icon-"]{margin-right:2px}.nav-list .divider{*width:100%;height:1px;margin:9px 1px;*margin:-5px 0 5px;overflow:hidden;background-color:#e5e5e5;border-bottom
 :1px solid #fff}.nav-tabs,.nav-pills{*zoom:1}.nav-tabs:before,.nav-pills:before,.nav-tabs:after,.nav-pills:after{display:table;line-height:0;content:""}.nav-tabs:after,.nav-pills:after{clear:both}.nav-tabs>li,.nav-pills>li{float:left}.nav-tabs>li>a,.nav-pills>li>a{padding-right:12px;padding-left:12px;margin-right:2px;line-height:14px}.nav-tabs{border-bottom:1px solid #ddd}.nav-tabs>li{margin-bottom:-1px}.nav-tabs>li>a{padding-top:8px;padding-bottom:8px;line-height:20px;border:1px solid transparent;-webkit-border-radius:4px 4px 0 0;-moz-border-radius:4px 4px 0 0;border-radius:4px 4px 0 0}.nav-tabs>li>a:hover,.nav-tabs>li>a:focus{border-color:#eee #eee #ddd}.nav-tabs>.active>a,.nav-tabs>.active>a:hover,.nav-tabs>.active>a:focus{color:#555;cursor:default;background-color:#fff;border:1px solid #ddd;border-bottom-color:transparent}.nav-pills>li>a{padding-top:8px;padding-bottom:8px;margin-top:2px;margin-bottom:2px;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px}.nav-pil
 ls>.active>a,.nav-pills>.active>a:hover,.nav-pills>.active>a:focus{color:#fff;background-color:#08c}.nav-stacked>li{float:none}.nav-stacked>li>a{margin-right:0}.nav-tabs.nav-stacked{border-bottom:0}.nav-tabs.nav-stacked>li>a{border:1px solid #ddd;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.nav-tabs.nav-stacked>li:first-child>a{-webkit-border-top-right-radius:4px;border-top-right-radius:4px;-webkit-border-top-left-radius:4px;border-top-left-radius:4px;-moz-border-radius-topright:4px;-moz-border-radius-topleft:4px}.nav-tabs.nav-stacked>li:last-child>a{-webkit-border-bottom-right-radius:4px;border-bottom-right-radius:4px;-webkit-border-bottom-left-radius:4px;border-bottom-left-radius:4px;-moz-border-radius-bottomright:4px;-moz-border-radius-bottomleft:4px}.nav-tabs.nav-stacked>li>a:hover,.nav-tabs.nav-stacked>li>a:focus{z-index:2;border-color:#ddd}.nav-pills.nav-stacked>li>a{margin-bottom:3px}.nav-pills.nav-stacked>li:last-child>a{margin-bottom:1px}.nav-tabs .dropdown
 -menu{-webkit-border-radius:0 0 6px 6px;-moz-border-radius:0 0 6px 6px;border-radius:0 0 6px 6px}.nav-pills .dropdown-menu{-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px}.nav .dropdown-toggle .caret{margin-top:6px;border-top-color:#08c;border-bottom-color:#08c}.nav .dropdown-toggle:hover .caret,.nav .dropdown-toggle:focus .caret{border-top-color:#005580;border-bottom-color:#005580}.nav-tabs .dropdown-toggle .caret{margin-top:8px}.nav .active .dropdown-toggle .caret{border-top-color:#fff;border-bottom-color:#fff}.nav-tabs .active .dropdown-toggle .caret{border-top-color:#555;border-bottom-color:#555}.nav>.dropdown.active>a:hover,.nav>.dropdown.active>a:focus{cursor:pointer}.nav-tabs .open .dropdown-toggle,.nav-pills .open .dropdown-toggle,.nav>li.dropdown.open.active>a:hover,.nav>li.dropdown.open.active>a:focus{color:#fff;background-color:#999;border-color:#999}.nav li.dropdown.open .caret,.nav li.dropdown.open.active .caret,.nav li.dropdown.open a:hover .caret,.n
 av li.dropdown.open a:focus .caret{border-top-color:#fff;border-bottom-color:#fff;opacity:1;filter:alpha(opacity=100)}.tabs-stacked .open>a:hover,.tabs-stacked .open>a:focus{border-color:#999}.tabbable{*zoom:1}.tabbable:before,.tabbable:after{display:table;line-height:0;content:""}.tabbable:after{clear:both}.tab-content{overflow:auto}.tabs-below>.nav-tabs,.tabs-right>.nav-tabs,.tabs-left>.nav-tabs{border-bottom:0}.tab-content>.tab-pane,.pill-content>.pill-pane{display:none}.tab-content>.active,.pill-content>.active{display:block}.tabs-below>.nav-tabs{border-top:1px solid #ddd}.tabs-below>.nav-tabs>li{margin-top:-1px;margin-bottom:0}.tabs-below>.nav-tabs>li>a{-webkit-border-radius:0 0 4px 4px;-moz-border-radius:0 0 4px 4px;border-radius:0 0 4px 4px}.tabs-below>.nav-tabs>li>a:hover,.tabs-below>.nav-tabs>li>a:focus{border-top-color:#ddd;border-bottom-color:transparent}.tabs-below>.nav-tabs>.active>a,.tabs-below>.nav-tabs>.active>a:hover,.tabs-below>.nav-tabs>.active>a:focus{border-colo
 r:transparent #ddd #ddd #ddd}.tabs-left>.nav-tabs>li,.tabs-right>.nav-tabs>li{float:none}.tabs-left>.nav-tabs>li>a,.tabs-right>.nav-tabs>li>a{min-width:74px;margin-right:0;margin-bottom:3px}.tabs-left>.nav-tabs{float:left;margin-right:19px;border-right:1px solid #ddd}.tabs-left>.nav-tabs>li>a{margin-right:-1px;-webkit-border-radius:4px 0 0 4px;-moz-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px}.tabs-left>.nav-tabs>li>a:hover,.tabs-left>.nav-tabs>li>a:focus{border-color:#eee #ddd #eee #eee}.tabs-left>.nav-tabs .active>a,.tabs-left>.nav-tabs .active>a:hover,.tabs-left>.nav-tabs .active>a:focus{border-color:#ddd transparent #ddd #ddd;*border-right-color:#fff}.tabs-right>.nav-tabs{float:right;margin-left:19px;border-left:1px solid #ddd}.tabs-right>.nav-tabs>li>a{margin-left:-1px;-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0}.tabs-right>.nav-tabs>li>a:hover,.tabs-right>.nav-tabs>li>a:focus{border-color:#eee #eee #eee #ddd}.tabs-right>.na
 v-tabs .active>a,.tabs-right>.nav-tabs .active>a:hover,.tabs-right>.nav-tabs .active>a:focus{border-color:#ddd #ddd #ddd transparent;*border-left-color:#fff}.nav>.disabled>a{color:#999}.nav>.disabled>a:hover,.nav>.disabled>a:focus{text-decoration:none;cursor:default;background-color:transparent}.navbar{*position:relative;*z-index:2;margin-bottom:20px;overflow:visible}.navbar-inner{min-height:40px;padding-right:20px;padding-left:20px;background-color:#fafafa;background-image:-moz-linear-gradient(top,#fff,#f2f2f2);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#f2f2f2));background-image:-webkit-linear-gradient(top,#fff,#f2f2f2);background-image:-o-linear-gradient(top,#fff,#f2f2f2);background-image:linear-gradient(to bottom,#fff,#f2f2f2);background-repeat:repeat-x;border:1px solid #d4d4d4;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff',endColorstr='#fff2f2f2',GradientType=0
 );*zoom:1;-webkit-box-shadow:0 1px 4px rgba(0,0,0,0.065);-moz-box-shadow:0 1px 4px rgba(0,0,0,0.065);box-shadow:0 1px 4px rgba(0,0,0,0.065)}.navbar-inner:before,.navbar-inner:after{display:table;line-height:0;content:""}.navbar-inner:after{clear:both}.navbar .container{width:auto}.nav-collapse.collapse{height:auto;overflow:visible}.navbar .brand{display:block;float:left;padding:10px 20px 10px;margin-left:-20px;font-size:20px;font-weight:200;color:#777;text-shadow:0 1px 0 #fff}.navbar .brand:hover,.navbar .brand:focus{text-decoration:none}.navbar-text{margin-bottom:0;line-height:40px;color:#777}.navbar-link{color:#777}.navbar-link:hover,.navbar-link:focus{color:#333}.navbar .divider-vertical{height:40px;margin:0 9px;border-right:1px solid #fff;border-left:1px solid #f2f2f2}.navbar .btn,.navbar .btn-group{margin-top:5px}.navbar .btn-group .btn,.navbar .input-prepend .btn,.navbar .input-append .btn,.navbar .input-prepend .btn-group,.navbar .input-append .btn-group{margin-top:0}.navbar-
 form{margin-bottom:0;*zoom:1}.navbar-form:before,.navbar-form:after{display:table;line-height:0;content:""}.navbar-form:after{clear:both}.navbar-form input,.navbar-form select,.navbar-form .radio,.navbar-form .checkbox{margin-top:5px}.navbar-form input,.navbar-form select,.navbar-form .btn{display:inline-block;margin-bottom:0}.navbar-form input[type="image"],.navbar-form input[type="checkbox"],.navbar-form input[type="radio"]{margin-top:3px}.navbar-form .input-append,.navbar-form .input-prepend{margin-top:5px;white-space:nowrap}.navbar-form .input-append input,.navbar-form .input-prepend input{margin-top:0}.navbar-search{position:relative;float:left;margin-top:5px;margin-bottom:0}.navbar-search .search-query{padding:4px 14px;margin-bottom:0;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:13px;font-weight:normal;line-height:1;-webkit-border-radius:15px;-moz-border-radius:15px;border-radius:15px}.navbar-static-top{position:static;margin-bottom:0}.navbar-static-top .n
 avbar-inner{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.navbar-fixed-top,.navbar-fixed-bottom{position:fixed;right:0;left:0;z-index:1030;margin-bottom:0}.navbar-fixed-top .navbar-inner,.navbar-static-top .navbar-inner{border-width:0 0 1px}.navbar-fixed-bottom .navbar-inner{border-width:1px 0 0}.navbar-fixed-top .navbar-inner,.navbar-fixed-bottom .navbar-inner{padding-right:0;padding-left:0;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.navbar-static-top .container,.navbar-fixed-top .container,.navbar-fixed-bottom .container{width:940px}.navbar-fixed-top{top:0}.navbar-fixed-top .navbar-inner,.navbar-static-top .navbar-inner{-webkit-box-shadow:0 1px 10px rgba(0,0,0,0.1);-moz-box-shadow:0 1px 10px rgba(0,0,0,0.1);box-shadow:0 1px 10px rgba(0,0,0,0.1)}.navbar-fixed-bottom{bottom:0}.navbar-fixed-bottom .navbar-inner{-webkit-box-shadow:0 -1px 10px rgba(0,0,0,0.1);-moz-box-shadow:0 -1px 10px rgba(0,0,0,0.1);box-shadow:0 -1px 10px rgba(0,0,0,0.1)}.navbar .na
 v{position:relative;left:0;display:block;float:left;margin:0 10px 0 0}.navbar .nav.pull-right{float:right;margin-right:0}.navbar .nav>li{float:left}.navbar .nav>li>a{float:none;padding:10px 15px 10px;color:#777;text-decoration:none;text-shadow:0 1px 0 #fff}.navbar .nav .dropdown-toggle .caret{margin-top:8px}.navbar .nav>li>a:focus,.navbar .nav>li>a:hover{color:#333;text-decoration:none;background-color:transparent}.navbar .nav>.active>a,.navbar .nav>.active>a:hover,.navbar .nav>.active>a:focus{color:#555;text-decoration:none;background-color:#e5e5e5;-webkit-box-shadow:inset 0 3px 8px rgba(0,0,0,0.125);-moz-box-shadow:inset 0 3px 8px rgba(0,0,0,0.125);box-shadow:inset 0 3px 8px rgba(0,0,0,0.125)}.navbar .btn-navbar{display:none;float:right;padding:7px 10px;margin-right:5px;margin-left:5px;color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#ededed;*background-color:#e5e5e5;background-image:-moz-linear-gradient(top,#f2f2f2,#e5e5e5);background-image:-webkit-gradient(linea
 r,0 0,0 100%,from(#f2f2f2),to(#e5e5e5));background-image:-webkit-linear-gradient(top,#f2f2f2,#e5e5e5);background-image:-o-linear-gradient(top,#f2f2f2,#e5e5e5);background-image:linear-gradient(to bottom,#f2f2f2,#e5e5e5);background-repeat:repeat-x;border-color:#e5e5e5 #e5e5e5 #bfbfbf;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2f2f2',endColorstr='#ffe5e5e5',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.075);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.075);box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.075)}.navbar .btn-navbar:hover,.navbar .btn-navbar:focus,.navbar .btn-navbar:active,.navbar .btn-navbar.active,.navbar .btn-navbar.disabled,.navbar .btn-navbar[disabled]{color:#fff;background-color:#e5e5e5;*background-color:#d
 9d9d9}.navbar .btn-navbar:active,.navbar .btn-navbar.active{background-color:#ccc \9}.navbar .btn-navbar .icon-bar{display:block;width:18px;height:2px;background-color:#f5f5f5;-webkit-border-radius:1px;-moz-border-radius:1px;border-radius:1px;-webkit-box-shadow:0 1px 0 rgba(0,0,0,0.25);-moz-box-shadow:0 1px 0 rgba(0,0,0,0.25);box-shadow:0 1px 0 rgba(0,0,0,0.25)}.btn-navbar .icon-bar+.icon-bar{margin-top:3px}.navbar .nav>li>.dropdown-menu:before{position:absolute;top:-7px;left:9px;display:inline-block;border-right:7px solid transparent;border-bottom:7px solid #ccc;border-left:7px solid transparent;border-bottom-color:rgba(0,0,0,0.2);content:''}.navbar .nav>li>.dropdown-menu:after{position:absolute;top:-6px;left:10px;display:inline-block;border-right:6px solid transparent;border-bottom:6px solid #fff;border-left:6px solid transparent;content:''}.navbar-fixed-bottom .nav>li>.dropdown-menu:before{top:auto;bottom:-7px;border-top:7px solid #ccc;border-bottom:0;border-top-color:rgba(0,0,0,
 0.2)}.navbar-fixed-bottom .nav>li>.dropdown-menu:after{top:auto;bottom:-6px;border-top:6px solid #fff;border-bottom:0}.navbar .nav li.dropdown>a:hover .caret,.navbar .nav li.dropdown>a:focus .caret{border-top-color:#333;border-bottom-color:#333}.navbar .nav li.dropdown.open>.dropdown-toggle,.navbar .nav li.dropdown.active>.dropdown-toggle,.navbar .nav li.dropdown.open.active>.dropdown-toggle{color:#555;background-color:#e5e5e5}.navbar .nav li.dropdown>.dropdown-toggle .caret{border-top-color:#777;border-bottom-color:#777}.navbar .nav li.dropdown.open>.dropdown-toggle .caret,.navbar .nav li.dropdown.active>.dropdown-toggle .caret,.navbar .nav li.dropdown.open.active>.dropdown-toggle .caret{border-top-color:#555;border-bottom-color:#555}.navbar .pull-right>li>.dropdown-menu,.navbar .nav>li>.dropdown-menu.pull-right{right:0;left:auto}.navbar .pull-right>li>.dropdown-menu:before,.navbar .nav>li>.dropdown-menu.pull-right:before{right:12px;left:auto}.navbar .pull-right>li>.dropdown-menu:a
 fter,.navbar .nav>li>.dropdown-menu.pull-right:after{right:13px;left:auto}.navbar .pull-right>li>.dropdown-menu .dropdown-menu,.navbar .nav>li>.dropdown-menu.pull-right .dropdown-menu{right:100%;left:auto;margin-right:-1px;margin-left:0;-webkit-border-radius:6px 0 6px 6px;-moz-border-radius:6px 0 6px 6px;border-radius:6px 0 6px 6px}.navbar-inverse .navbar-inner{background-color:#1b1b1b;background-image:-moz-linear-gradient(top,#222,#111);background-image:-webkit-gradient(linear,0 0,0 100%,from(#222),to(#111));background-image:-webkit-linear-gradient(top,#222,#111);background-image:-o-linear-gradient(top,#222,#111);background-image:linear-gradient(to bottom,#222,#111);background-repeat:repeat-x;border-color:#252525;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff222222',endColorstr='#ff111111',GradientType=0)}.navbar-inverse .brand,.navbar-inverse .nav>li>a{color:#999;text-shadow:0 -1px 0 rgba(0,0,0,0.25)}.navbar-inverse .brand:hover,.navbar-inverse .nav>li>a:hove
 r,.navbar-inverse .brand:focus,.navbar-inverse .nav>li>a:focus{color:#fff}.navbar-inverse .brand{color:#999}.navbar-inverse .navbar-text{color:#999}.navbar-inverse .nav>li>a:focus,.navbar-inverse .nav>li>a:hover{color:#fff;background-color:transparent}.navbar-inverse .nav .active>a,.navbar-inverse .nav .active>a:hover,.navbar-inverse .nav .active>a:focus{color:#fff;background-color:#111}.navbar-inverse .navbar-link{color:#999}.navbar-inverse .navbar-link:hover,.navbar-inverse .navbar-link:focus{color:#fff}.navbar-inverse .divider-vertical{border-right-color:#222;border-left-color:#111}.navbar-inverse .nav li.dropdown.open>.dropdown-toggle,.navbar-inverse .nav li.dropdown.active>.dropdown-toggle,.navbar-inverse .nav li.dropdown.open.active>.dropdown-toggle{color:#fff;background-color:#111}.navbar-inverse .nav li.dropdown>a:hover .caret,.navbar-inverse .nav li.dropdown>a:focus .caret{border-top-color:#fff;border-bottom-color:#fff}.navbar-inverse .nav li.dropdown>.dropdown-toggle .care
 t{border-top-color:#999;border-bottom-color:#999}.navbar-inverse .nav li.dropdown.open>.dropdown-toggle .caret,.navbar-inverse .nav li.dropdown.active>.dropdown-toggle .caret,.navbar-inverse .nav li.dropdown.open.active>.dropdown-toggle .caret{border-top-color:#fff;border-bottom-color:#fff}.navbar-inverse .navbar-search .search-query{color:#fff;background-color:#515151;border-color:#111;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1),0 1px 0 rgba(255,255,255,0.15);-moz-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1),0 1px 0 rgba(255,255,255,0.15);box-shadow:inset 0 1px 2px rgba(0,0,0,0.1),0 1px 0 rgba(255,255,255,0.15);-webkit-transition:none;-moz-transition:none;-o-transition:none;transition:none}.navbar-inverse .navbar-search .search-query:-moz-placeholder{color:#ccc}.navbar-inverse .navbar-search .search-query:-ms-input-placeholder{color:#ccc}.navbar-inverse .navbar-search .search-query::-webkit-input-placeholder{color:#ccc}.navbar-inverse .navbar-search .search-query:focus,.navbar
 -inverse .navbar-search .search-query.focused{padding:5px 15px;color:#333;text-shadow:0 1px 0 #fff;background-color:#fff;border:0;outline:0;-webkit-box-shadow:0 0 3px rgba(0,0,0,0.15);-moz-box-shadow:0 0 3px rgba(0,0,0,0.15);box-shadow:0 0 3px rgba(0,0,0,0.15)}.navbar-inverse .btn-navbar{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#0e0e0e;*background-color:#040404;background-image:-moz-linear-gradient(top,#151515,#040404);background-image:-webkit-gradient(linear,0 0,0 100%,from(#151515),to(#040404));background-image:-webkit-linear-gradient(top,#151515,#040404);background-image:-o-linear-gradient(top,#151515,#040404);background-image:linear-gradient(to bottom,#151515,#040404);background-repeat:repeat-x;border-color:#040404 #040404 #000;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff151515',endColorstr='#ff040404',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(en
 abled=false)}.navbar-inverse .btn-navbar:hover,.navbar-inverse .btn-navbar:focus,.navbar-inverse .btn-navbar:active,.navbar-inverse .btn-navbar.active,.navbar-inverse .btn-navbar.disabled,.navbar-inverse .btn-navbar[disabled]{color:#fff;background-color:#040404;*background-color:#000}.navbar-inverse .btn-navbar:active,.navbar-inverse .btn-navbar.active{background-color:#000 \9}.breadcrumb{padding:8px 15px;margin:0 0 20px;list-style:none;background-color:#f5f5f5;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.breadcrumb>li{display:inline-block;*display:inline;text-shadow:0 1px 0 #fff;*zoom:1}.breadcrumb>li>.divider{padding:0 5px;color:#ccc}.breadcrumb>.active{color:#999}.pagination{margin:20px 0}.pagination ul{display:inline-block;*display:inline;margin-bottom:0;margin-left:0;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;*zoom:1;-webkit-box-shadow:0 1px 2px rgba(0,0,0,0.05);-moz-box-shadow:0 1px 2px rgba(0,0,0,0.05);box-shadow:0 1px 2px rgba(0
 ,0,0,0.05)}.pagination ul>li{display:inline}.pagination ul>li>a,.pagination ul>li>span{float:left;padding:4px 12px;line-height:20px;text-decoration:none;background-color:#fff;border:1px solid #ddd;border-left-width:0}.pagination ul>li>a:hover,.pagination ul>li>a:focus,.pagination ul>.active>a,.pagination ul>.active>span{background-color:#f5f5f5}.pagination ul>.active>a,.pagination ul>.active>span{color:#999;cursor:default}.pagination ul>.disabled>span,.pagination ul>.disabled>a,.pagination ul>.disabled>a:hover,.pagination ul>.disabled>a:focus{color:#999;cursor:default;background-color:transparent}.pagination ul>li:first-child>a,.pagination ul>li:first-child>span{border-left-width:1px;-webkit-border-bottom-left-radius:4px;border-bottom-left-radius:4px;-webkit-border-top-left-radius:4px;border-top-left-radius:4px;-moz-border-radius-bottomleft:4px;-moz-border-radius-topleft:4px}.pagination ul>li:last-child>a,.pagination ul>li:last-child>span{-webkit-border-top-right-radius:4px;border-t
 op-right-radius:4px;-webkit-border-bottom-right-radius:4px;border-bottom-right-radius:4px;-moz-border-radius-topright:4px;-moz-border-radius-bottomright:4px}.pagination-centered{text-align:center}.pagination-right{text-align:right}.pagination-large ul>li>a,.pagination-large ul>li>span{padding:11px 19px;font-size:17.5px}.pagination-large ul>li:first-child>a,.pagination-large ul>li:first-child>span{-webkit-border-bottom-left-radius:6px;border-bottom-left-radius:6px;-webkit-border-top-left-radius:6px;border-top-left-radius:6px;-moz-border-radius-bottomleft:6px;-moz-border-radius-topleft:6px}.pagination-large ul>li:last-child>a,.pagination-large ul>li:last-child>span{-webkit-border-top-right-radius:6px;border-top-right-radius:6px;-webkit-border-bottom-right-radius:6px;border-bottom-right-radius:6px;-moz-border-radius-topright:6px;-moz-border-radius-bottomright:6px}.pagination-mini ul>li:first-child>a,.pagination-small ul>li:first-child>a,.pagination-mini ul>li:first-child>span,.paginati
 on-small ul>li:first-child>span{-webkit-border-bottom-left-radius:3px;border-bottom-left-radius:3px;-webkit-border-top-left-radius:3px;border-top-left-radius:3px;-moz-border-radius-bottomleft:3px;-moz-border-radius-topleft:3px}.pagination-mini ul>li:last-child>a,.pagination-small ul>li:last-child>a,.pagination-mini ul>li:last-child>span,.pagination-small ul>li:last-child>span{-webkit-border-top-right-radius:3px;border-top-right-radius:3px;-webkit-border-bottom-right-radius:3px;border-bottom-right-radius:3px;-moz-border-radius-topright:3px;-moz-border-radius-bottomright:3px}.pagination-small ul>li>a,.pagination-small ul>li>span{padding:2px 10px;font-size:11.9px}.pagination-mini ul>li>a,.pagination-mini ul>li>span{padding:0 6px;font-size:10.5px}.pager{margin:20px 0;text-align:center;list-style:none;*zoom:1}.pager:before,.pager:after{display:table;line-height:0;content:""}.pager:after{clear:both}.pager li{display:inline}.pager li>a,.pager li>span{display:inline-block;padding:5px 14px;b
 ackground-color:#fff;border:1px solid #ddd;-webkit-border-radius:15px;-moz-border-radius:15px;border-radius:15px}.pager li>a:hover,.pager li>a:focus{text-decoration:none;background-color:#f5f5f5}.pager .next>a,.pager .next>span{float:right}.pager .previous>a,.pager .previous>span{float:left}.pager .disabled>a,.pager .disabled>a:hover,.pager .disabled>a:focus,.pager .disabled>span{color:#999;cursor:default;background-color:#fff}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;background-color:#000}.modal-backdrop.fade{opacity:0}.modal-backdrop,.modal-backdrop.fade.in{opacity:.8;filter:alpha(opacity=80)}.modal{position:fixed;top:10%;left:50%;z-index:1050;width:560px;margin-left:-280px;background-color:#fff;border:1px solid #999;border:1px solid rgba(0,0,0,0.3);*border:1px solid #999;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;outline:0;-webkit-box-shadow:0 3px 7px rgba(0,0,0,0.3);-moz-box-shadow:0 3px 7px rgba(0,0,0,0.3);box-shadow:0 3px
  7px rgba(0,0,0,0.3);-webkit-background-clip:padding-box;-moz-background-clip:padding-box;background-clip:padding-box}.modal.fade{top:-25%;-webkit-transition:opacity .3s linear,top .3s ease-out;-moz-transition:opacity .3s linear,top .3s ease-out;-o-transition:opacity .3s linear,top .3s ease-out;transition:opacity .3s linear,top .3s ease-out}.modal.fade.in{top:10%}.modal-header{padding:9px 15px;border-bottom:1px solid #eee}.modal-header .close{margin-top:2px}.modal-header h3{margin:0;line-height:30px}.modal-body{position:relative;max-height:400px;padding:15px;overflow-y:auto}.modal-form{margin-bottom:0}.modal-footer{padding:14px 15px 15px;margin-bottom:0;text-align:right;background-color:#f5f5f5;border-top:1px solid #ddd;-webkit-border-radius:0 0 6px 6px;-moz-border-radius:0 0 6px 6px;border-radius:0 0 6px 6px;*zoom:1;-webkit-box-shadow:inset 0 1px 0 #fff;-moz-box-shadow:inset 0 1px 0 #fff;box-shadow:inset 0 1px 0 #fff}.modal-footer:before,.modal-footer:after{display:table;line-heigh
 t:0;content:""}.modal-footer:after{clear:both}.modal-footer .btn+.btn{margin-bottom:0;margin-left:5px}.modal-footer .btn-group .btn+.btn{margin-left:-1px}.modal-footer .btn-block+.btn-block{margin-left:0}.tooltip{position:absolute;z-index:1030;display:block;font-size:11px;line-height:1.4;opacity:0;filter:alpha(opacity=0);visibility:visible}.tooltip.in{opacity:.8;filter:alpha(opacity=80)}.tooltip.top{padding:5px 0;margin-top:-3px}.tooltip.right{padding:0 5px;margin-left:3px}.tooltip.bottom{padding:5px 0;margin-top:3px}.tooltip.left{padding:0 5px;margin-left:-3px}.tooltip-inner{max-width:200px;padding:8px;color:#fff;text-align:center;text-decoration:none;background-color:#000;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.tooltip-arrow{position:absolute;width:0;height:0;border-color:transparent;border-style:solid}.tooltip.top .tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-top-color:#000;border-width:5px 5px 0}.tooltip.right .tooltip-arrow{top:50%;left:0;
 margin-top:-5px;border-right-color:#000;border-width:5px 5px 5px 0}.tooltip.left .tooltip-arrow{top:50%;right:0;margin-top:-5px;border-left-color:#000;border-width:5px 0 5px 5px}.tooltip.bottom .tooltip-arrow{top:0;left:50%;margin-left:-5px;border-bottom-color:#000;border-width:0 5px 5px}.popover{position:absolute;top:0;left:0;z-index:1010;display:none;max-width:276px;padding:1px;text-align:left;white-space:normal;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.2);-webkit-border-radius

<TRUNCATED>

[13/21] aurora git commit: Remove unused classes from commons fork.

Posted by wf...@apache.org.
http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/zookeeper/DistributedLock.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/zookeeper/DistributedLock.java b/commons/src/main/java/org/apache/aurora/common/zookeeper/DistributedLock.java
deleted file mode 100644
index 1e8fc48..0000000
--- a/commons/src/main/java/org/apache/aurora/common/zookeeper/DistributedLock.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.zookeeper;
-
-import java.util.concurrent.TimeUnit;
-
-/**
- * DistributedLock
- *
- * @author Florian Leibert
- */
-public interface DistributedLock {
-  void lock() throws LockingException;
-
-  boolean tryLock(long timeout, TimeUnit unit);
-
-  void unlock() throws LockingException;
-
-  public static class LockingException extends RuntimeException {
-    public LockingException(String msg, Exception e) {
-      super(msg, e);
-    }
-
-    public LockingException(String msg) {
-      super(msg);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/zookeeper/DistributedLockImpl.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/zookeeper/DistributedLockImpl.java b/commons/src/main/java/org/apache/aurora/common/zookeeper/DistributedLockImpl.java
deleted file mode 100644
index 99a5774..0000000
--- a/commons/src/main/java/org/apache/aurora/common/zookeeper/DistributedLockImpl.java
+++ /dev/null
@@ -1,286 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.zookeeper;
-
-import java.util.List;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.annotation.concurrent.ThreadSafe;
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Ordering;
-
-import org.apache.zookeeper.CreateMode;
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.WatchedEvent;
-import org.apache.zookeeper.Watcher;
-import org.apache.zookeeper.ZooDefs;
-import org.apache.zookeeper.data.ACL;
-import org.apache.zookeeper.data.Stat;
-
-import org.apache.aurora.common.base.MorePreconditions;
-
-/**
- * Distributed locking via ZooKeeper. Assuming there are N clients that all try to acquire a lock,
- * the algorithm works as follows. Each host creates an ephemeral|sequential node, and requests a
- * list of children for the lock node. Due to the nature of sequential, all the ids are increasing
- * in order, therefore the client with the least ID according to natural ordering will hold the
- * lock. Every other client watches the id immediately preceding its own id and checks for the lock
- * in case of notification. The client holding the lock does the work and finally deletes the node,
- * thereby triggering the next client in line to acquire the lock. Deadlocks are possible but
- * avoided in most cases because if a client drops dead while holding the lock, the ZK session
- * should timeout and since the node is ephemeral, it will be removed in such a case. Deadlocks
- * could occur if the the worker thread on a client hangs but the zk-client thread is still alive.
- * There could be an external monitor client that ensures that alerts are triggered if the least-id
- * ephemeral node is present past a time-out.
- * <p/>
- * Note: Locking attempts will fail in case session expires!
- *
- * @author Florian Leibert
- */
-@ThreadSafe
-public class DistributedLockImpl implements DistributedLock {
-
-  private static final Logger LOG = Logger.getLogger(DistributedLockImpl.class.getName());
-
-  private final ZooKeeperClient zkClient;
-  private final String lockPath;
-  private final ImmutableList<ACL> acl;
-
-  private final AtomicBoolean aborted = new AtomicBoolean(false);
-  private CountDownLatch syncPoint;
-  private boolean holdsLock = false;
-  private String currentId;
-  private String currentNode;
-  private String watchedNode;
-  private LockWatcher watcher;
-
-  /**
-   * Equivalent to {@link #DistributedLockImpl(ZooKeeperClient, String, Iterable)} with a default
-   * wide open {@code acl} ({@link ZooDefs.Ids#OPEN_ACL_UNSAFE}).
-   */
-  public DistributedLockImpl(ZooKeeperClient zkClient, String lockPath) {
-    this(zkClient, lockPath, ZooDefs.Ids.OPEN_ACL_UNSAFE);
-  }
-
-  /**
-   * Creates a distributed lock using the given {@code zkClient} to coordinate locking.
-   *
-   * @param zkClient The ZooKeeper client to use.
-   * @param lockPath The path used to manage the lock under.
-   * @param acl The acl to apply to newly created lock nodes.
-   */
-  public DistributedLockImpl(ZooKeeperClient zkClient, String lockPath, Iterable<ACL> acl) {
-    this.zkClient = Preconditions.checkNotNull(zkClient);
-    this.lockPath = MorePreconditions.checkNotBlank(lockPath);
-    this.acl = ImmutableList.copyOf(acl);
-    this.syncPoint = new CountDownLatch(1);
-  }
-
-  private synchronized void prepare()
-    throws ZooKeeperClient.ZooKeeperConnectionException, InterruptedException, KeeperException {
-
-    ZooKeeperUtils.ensurePath(zkClient, acl, lockPath);
-    LOG.log(Level.FINE, "Working with locking path:" + lockPath);
-
-    // Create an EPHEMERAL_SEQUENTIAL node.
-    currentNode =
-        zkClient.get().create(lockPath + "/member_", null, acl, CreateMode.EPHEMERAL_SEQUENTIAL);
-
-    // We only care about our actual id since we want to compare ourselves to siblings.
-    if (currentNode.contains("/")) {
-      currentId = currentNode.substring(currentNode.lastIndexOf("/") + 1);
-    }
-    LOG.log(Level.FINE, "Received ID from zk:" + currentId);
-    this.watcher = new LockWatcher();
-  }
-
-  @Override
-  public synchronized void lock() throws LockingException {
-    if (holdsLock) {
-      throw new LockingException("Error, already holding a lock. Call unlock first!");
-    }
-    try {
-      prepare();
-      watcher.checkForLock();
-      syncPoint.await();
-      if (!holdsLock) {
-        throw new LockingException("Error, couldn't acquire the lock!");
-      }
-    } catch (InterruptedException e) {
-      cancelAttempt();
-      throw new LockingException("InterruptedException while trying to acquire lock!", e);
-    } catch (KeeperException e) {
-      // No need to clean up since the node wasn't created yet.
-      throw new LockingException("KeeperException while trying to acquire lock!", e);
-    } catch (ZooKeeperClient.ZooKeeperConnectionException e) {
-      // No need to clean up since the node wasn't created yet.
-      throw new LockingException("ZooKeeperConnectionException while trying to acquire lock", e);
-    }
-  }
-
-  @Override
-  public synchronized boolean tryLock(long timeout, TimeUnit unit) {
-    if (holdsLock) {
-      throw new LockingException("Error, already holding a lock. Call unlock first!");
-    }
-    try {
-      prepare();
-      watcher.checkForLock();
-      boolean success = syncPoint.await(timeout, unit);
-      if (!success) {
-        return false;
-      }
-      if (!holdsLock) {
-        throw new LockingException("Error, couldn't acquire the lock!");
-      }
-    } catch (InterruptedException e) {
-      cancelAttempt();
-      return false;
-    } catch (KeeperException e) {
-      // No need to clean up since the node wasn't created yet.
-      throw new LockingException("KeeperException while trying to acquire lock!", e);
-    } catch (ZooKeeperClient.ZooKeeperConnectionException e) {
-      // No need to clean up since the node wasn't created yet.
-      throw new LockingException("ZooKeeperConnectionException while trying to acquire lock", e);
-    }
-    return true;
-  }
-
-  @Override
-  public synchronized void unlock() throws LockingException {
-    if (currentId == null) {
-      throw new LockingException("Error, neither attempting to lock nor holding a lock!");
-    }
-    Preconditions.checkNotNull(currentId);
-    // Try aborting!
-    if (!holdsLock) {
-      aborted.set(true);
-      LOG.log(Level.INFO, "Not holding lock, aborting acquisition attempt!");
-    } else {
-      LOG.log(Level.INFO, "Cleaning up this locks ephemeral node.");
-      cleanup();
-    }
-  }
-
-  //TODO(Florian Leibert): Make sure this isn't a runtime exception. Put exceptions into the token?
-
-  private synchronized void cancelAttempt() {
-    LOG.log(Level.INFO, "Cancelling lock attempt!");
-    cleanup();
-    // Bubble up failure...
-    holdsLock = false;
-    syncPoint.countDown();
-  }
-
-  private void cleanup() {
-    LOG.info("Cleaning up!");
-    Preconditions.checkNotNull(currentId);
-    try {
-      Stat stat = zkClient.get().exists(currentNode, false);
-      if (stat != null) {
-        zkClient.get().delete(currentNode, ZooKeeperUtils.ANY_VERSION);
-      } else {
-        LOG.log(Level.WARNING, "Called cleanup but nothing to cleanup!");
-      }
-    } catch (Exception e) {
-      throw new RuntimeException(e);
-    }
-    holdsLock = false;
-    aborted.set(false);
-    currentId = null;
-    currentNode = null;
-    watcher = null;
-    syncPoint = new CountDownLatch(1);
-  }
-
-  class LockWatcher implements Watcher {
-
-    public synchronized void checkForLock() {
-      MorePreconditions.checkNotBlank(currentId);
-
-      try {
-        List<String> candidates = zkClient.get().getChildren(lockPath, null);
-        ImmutableList<String> sortedMembers = Ordering.natural().immutableSortedCopy(candidates);
-
-        // Unexpected behavior if there are no children!
-        if (sortedMembers.isEmpty()) {
-          throw new LockingException("Error, member list is empty!");
-        }
-
-        int memberIndex = sortedMembers.indexOf(currentId);
-
-        // If we hold the lock
-        if (memberIndex == 0) {
-          holdsLock = true;
-          syncPoint.countDown();
-        } else {
-          final String nextLowestNode = sortedMembers.get(memberIndex - 1);
-          LOG.log(Level.INFO, String.format("Current LockWatcher with ephemeral node [%s], is " +
-              "waiting for [%s] to release lock.", currentId, nextLowestNode));
-
-          watchedNode = String.format("%s/%s", lockPath, nextLowestNode);
-          Stat stat = zkClient.get().exists(watchedNode, this);
-          if (stat == null) {
-            checkForLock();
-          }
-        }
-      } catch (InterruptedException e) {
-        LOG.log(Level.WARNING, String.format("Current LockWatcher with ephemeral node [%s] " +
-            "got interrupted. Trying to cancel lock acquisition.", currentId), e);
-        cancelAttempt();
-      } catch (KeeperException e) {
-        LOG.log(Level.WARNING, String.format("Current LockWatcher with ephemeral node [%s] " +
-            "got a KeeperException. Trying to cancel lock acquisition.", currentId), e);
-        cancelAttempt();
-      } catch (ZooKeeperClient.ZooKeeperConnectionException e) {
-        LOG.log(Level.WARNING, String.format("Current LockWatcher with ephemeral node [%s] " +
-            "got a ConnectionException. Trying to cancel lock acquisition.", currentId), e);
-        cancelAttempt();
-      }
-    }
-
-    @Override
-    public synchronized void process(WatchedEvent event) {
-      // this handles the case where we have aborted a lock and deleted ourselves but still have a
-      // watch on the nextLowestNode. This is a workaround since ZK doesn't support unsub.
-      if (!event.getPath().equals(watchedNode)) {
-        LOG.log(Level.INFO, "Ignoring call for node:" + watchedNode);
-        return;
-      }
-      //TODO(Florian Leibert): Pull this into the outer class.
-      if (event.getType() == Watcher.Event.EventType.None) {
-        switch (event.getState()) {
-          case SyncConnected:
-            // TODO(Florian Leibert): maybe we should just try to "fail-fast" in this case and abort.
-            LOG.info("Reconnected...");
-            break;
-          case Expired:
-            LOG.log(Level.WARNING, String.format("Current ZK session expired![%s]", currentId));
-            cancelAttempt();
-            break;
-        }
-      } else if (event.getType() == Event.EventType.NodeDeleted) {
-        checkForLock();
-      } else {
-        LOG.log(Level.WARNING, String.format("Unexpected ZK event: %s", event.getType().name()));
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/zookeeper/Partitioner.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/zookeeper/Partitioner.java b/commons/src/main/java/org/apache/aurora/common/zookeeper/Partitioner.java
deleted file mode 100644
index 91ea345..0000000
--- a/commons/src/main/java/org/apache/aurora/common/zookeeper/Partitioner.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.zookeeper;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Predicate;
-import com.google.common.collect.Ordering;
-import org.apache.aurora.common.zookeeper.Group.GroupChangeListener;
-import org.apache.aurora.common.zookeeper.Group.JoinException;
-import org.apache.aurora.common.zookeeper.Group.Membership;
-import org.apache.aurora.common.zookeeper.Group.UpdateException;
-import org.apache.aurora.common.zookeeper.Group.WatchException;
-import org.apache.zookeeper.data.ACL;
-
-import javax.annotation.Nullable;
-import java.util.List;
-import java.util.logging.Logger;
-
-/**
- * A distributed mechanism for eventually arriving at an evenly partitioned space of long values.
- * A typical usage would have a client on each of several hosts joining a logical partition (a
- * "partition group") that represents some shared work.  Clients could then process a subset of a
- * full body of work by testing any given item of work with their partition filter.
- *
- * <p>Note that clients must be able to tolerate periods of duplicate processing by more than 1
- * partition as explained in {@link #join()}.
- *
- * @author John Sirois
- */
-public class Partitioner {
-
-  private static final Logger LOG = Logger.getLogger(Partitioner.class.getName());
-
-  private volatile int groupSize;
-  private volatile int groupIndex;
-  private final Group group;
-
-  /**
-   * Constructs a representation of a partition group but does not join it.  Note that the partition
-   * group path will be created as a persistent zookeeper path if it does not already exist.
-   *
-   * @param zkClient a client to use for joining the partition group and watching its membership
-   * @param acl the acl for this partition group
-   * @param path a zookeeper path that represents the partition group
-   */
-  public Partitioner(ZooKeeperClient zkClient, List<ACL> acl, String path) {
-    group = new Group(zkClient, acl, path);
-  }
-
-  @VisibleForTesting
-  int getGroupSize() {
-    return groupSize;
-  }
-
-  /**
-   * Represents a slice of a partition group.  The partition is dynamic and will adjust its size as
-   * members join and leave its partition group.
-   */
-  public abstract static class Partition implements Predicate<Long>, Membership {
-
-    /**
-     * Returns {@code true} if the given {@code value} is a member of this partition at this time.
-     */
-    public abstract boolean isMember(long value);
-
-    /**
-     * Gets number of members in the group at this time.
-     *
-     * @return number of members in the ZK group at this time.
-     */
-    public abstract int getNumPartitions();
-
-    /**
-     * Evaluates partition membership based on the given {@code value}'s hash code.  If the value
-     * is null it is never a member of a partition.
-     */
-    boolean isMember(Object value) {
-      return (value != null) && isMember(value.hashCode());
-    }
-
-    /**
-     * Equivalent to {@link #isMember(long)} for all non-null values; however incurs unboxing
-     * overhead.
-     */
-    @Override
-    public boolean apply(@Nullable Long input) {
-      return (input != null) && isMember(input);
-    }
-  }
-
-  /**
-   * Attempts to join the partition group and claim a slice.  When successful, a predicate is
-   * returned that can be used to test whether or not an item belongs to this partition.  The
-   * predicate is dynamic such that as the group is further partitioned or partitions merge the
-   * predicate will claim a narrower or wider swath of the partition space respectively.  Partition
-   * creation and merging is not instantaneous and clients should expect independent partitions to
-   * claim ownership of some items when partition membership is in flux.  It is only in the steady
-   * state that a client should expect independent partitions to divide the partition space evenly
-   * and without overlap.
-   *
-   * <p>TODO(John Sirois): consider adding a version with a global timeout for the join operation.
-   *
-   * @return the partition representing the slice of the partition group this member can claim
-   * @throws JoinException if there was a problem joining the partition group
-   * @throws InterruptedException if interrupted while waiting to join the partition group
-   */
-  public final Partition join() throws JoinException, InterruptedException {
-    final Membership membership = group.join();
-    try {
-      group.watch(createGroupChangeListener(membership));
-    } catch (WatchException e) {
-      membership.cancel();
-      throw new JoinException("Problem establishing watch on group after joining it", e);
-    }
-    return new Partition() {
-      @Override public boolean isMember(long value) {
-        return (value % groupSize) == groupIndex;
-      }
-
-      @Override public int getNumPartitions() {
-        return groupSize;
-      }
-
-      @Override public String getGroupPath() {
-        return membership.getGroupPath();
-      }
-
-      @Override public String getMemberId() {
-        return membership.getMemberId();
-      }
-
-      @Override public String getMemberPath() {
-        return membership.getMemberPath();
-      }
-
-      @Override public byte[] updateMemberData() throws UpdateException {
-        return membership.updateMemberData();
-      }
-
-      @Override public void cancel() throws JoinException {
-        membership.cancel();
-      }
-    };
-  }
-
-  @VisibleForTesting GroupChangeListener createGroupChangeListener(final Membership membership) {
-    return new GroupChangeListener() {
-      @Override public void onGroupChange(Iterable<String> memberIds) {
-        List<String> members = Ordering.natural().sortedCopy(memberIds);
-        int newSize = members.size();
-        int newIndex = members.indexOf(membership.getMemberId());
-
-        LOG.info(String.format("Rebuilding group %s:%s [%d:%d]->[%d:%d]",
-            membership.getGroupPath(), members, groupSize, groupIndex, newSize, newIndex));
-
-        groupSize = newSize;
-        groupIndex = newIndex;
-      }
-    };
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/zookeeper/ServerSets.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/zookeeper/ServerSets.java b/commons/src/main/java/org/apache/aurora/common/zookeeper/ServerSets.java
index 2b99268..18aff9f 100644
--- a/commons/src/main/java/org/apache/aurora/common/zookeeper/ServerSets.java
+++ b/commons/src/main/java/org/apache/aurora/common/zookeeper/ServerSets.java
@@ -18,14 +18,8 @@ import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.net.InetSocketAddress;
 import java.util.Map;
-import java.util.Set;
 
 import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
-
-import org.apache.zookeeper.data.ACL;
 
 import org.apache.aurora.common.base.Function;
 import org.apache.aurora.common.base.MorePreconditions;
@@ -33,6 +27,7 @@ import org.apache.aurora.common.io.Codec;
 import org.apache.aurora.common.thrift.Endpoint;
 import org.apache.aurora.common.thrift.ServiceInstance;
 import org.apache.aurora.common.thrift.Status;
+import org.apache.zookeeper.data.ACL;
 
 /**
  * Common ServerSet related functions
@@ -63,32 +58,11 @@ public class ServerSets {
    * @return A server set that registers at {@code zkPath}.
    */
   public static ServerSet create(ZooKeeperClient zkClient, Iterable<ACL> acl, String zkPath) {
-    return create(zkClient, acl, ImmutableSet.of(zkPath));
-  }
-
-  /**
-   * Creates a server set that registers at one or multiple paths applying the given ACL to all
-   * nodes created in the paths.
-   *
-   * @param zkClient ZooKeeper client to register with.
-   * @param acl The ACL to apply to the {@code zkPath} nodes the ServerSet creates.
-   * @param zkPaths Paths to register at, must be non-empty.
-   * @return A server set that registers at the given {@code zkPath}s.
-   */
-  public static ServerSet create(ZooKeeperClient zkClient, Iterable<ACL> acl, Set<String> zkPaths) {
     Preconditions.checkNotNull(zkClient);
     MorePreconditions.checkNotBlank(acl);
-    MorePreconditions.checkNotBlank(zkPaths);
+    MorePreconditions.checkNotBlank(zkPath);
 
-    if (zkPaths.size() == 1) {
-      return new ServerSetImpl(zkClient, acl, Iterables.getOnlyElement(zkPaths));
-    } else {
-      ImmutableList.Builder<ServerSet> builder = ImmutableList.builder();
-      for (String path : zkPaths) {
-        builder.add(new ServerSetImpl(zkClient, acl, path));
-      }
-      return new CompoundServerSet(builder.build());
-    }
+    return new ServerSetImpl(zkClient, acl, zkPath);
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/zookeeper/StaticServerSet.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/zookeeper/StaticServerSet.java b/commons/src/main/java/org/apache/aurora/common/zookeeper/StaticServerSet.java
deleted file mode 100644
index 99c290e..0000000
--- a/commons/src/main/java/org/apache/aurora/common/zookeeper/StaticServerSet.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.zookeeper;
-
-import java.net.InetSocketAddress;
-import java.util.Map;
-import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import com.google.common.base.Function;
-import com.google.common.base.Optional;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Maps;
-
-import org.apache.aurora.common.base.Command;
-import org.apache.aurora.common.base.Commands;
-import org.apache.aurora.common.zookeeper.Group.JoinException;
-import org.apache.aurora.common.thrift.Endpoint;
-import org.apache.aurora.common.thrift.ServiceInstance;
-import org.apache.aurora.common.thrift.Status;
-
-/**
- * A server set that represents a fixed set of hosts.
- * This may be composed under {@link CompoundServerSet} to ensure a minimum set of hosts is
- * present.
- * A static server set does not support joining, but will allow normal join calls and status update
- * calls to be made.
- */
-public class StaticServerSet implements ServerSet {
-
-  private static final Logger LOG = Logger.getLogger(StaticServerSet.class.getName());
-
-  private static final Function<Endpoint, ServiceInstance> ENDPOINT_TO_INSTANCE =
-      new Function<Endpoint, ServiceInstance>() {
-        @Override public ServiceInstance apply(Endpoint endpoint) {
-          return new ServiceInstance(endpoint, ImmutableMap.<String, Endpoint>of(), Status.ALIVE);
-        }
-      };
-
-  private final ImmutableSet<ServiceInstance> hosts;
-
-  /**
-   * Creates a static server set that will reply to monitor calls immediately and exactly once with
-   * the provided service instances.
-   *
-   * @param hosts Hosts in the static set.
-   */
-  public StaticServerSet(Set<ServiceInstance> hosts) {
-    this.hosts = ImmutableSet.copyOf(hosts);
-  }
-
-  /**
-   * Creates a static server set containing the provided endpoints (and no auxiliary ports) which
-   * will all be in the {@link Status#ALIVE} state.
-   *
-   * @param endpoints Endpoints in the static set.
-   * @return A static server set that will advertise the provided endpoints.
-   */
-  public static StaticServerSet fromEndpoints(Set<Endpoint> endpoints) {
-    return new StaticServerSet(
-        ImmutableSet.copyOf(Iterables.transform(endpoints, ENDPOINT_TO_INSTANCE)));
-  }
-
-  private EndpointStatus join(
-      InetSocketAddress endpoint,
-      Map<String, InetSocketAddress> auxEndpoints,
-      Optional<Integer> shardId) {
-
-    LOG.warning("Attempt to join fixed server set ignored.");
-    ServiceInstance joining = new ServiceInstance(
-        ServerSets.toEndpoint(endpoint),
-        Maps.transformValues(auxEndpoints, ServerSets.TO_ENDPOINT),
-        Status.ALIVE);
-    if (shardId.isPresent()) {
-      joining.setShard(shardId.get());
-    }
-    if (!hosts.contains(joining)) {
-      LOG.log(Level.SEVERE,
-          "Joining instance " + joining + " does not match any member of the static set.");
-    }
-
-    return new EndpointStatus() {
-      @Override public void leave() throws UpdateException {
-        LOG.warning("Attempt to adjust state of fixed server set ignored.");
-      }
-
-      @Override public void update(Status status) throws UpdateException {
-        LOG.warning("Attempt to adjust state of fixed server set ignored.");
-      }
-    };
-  }
-
-  @Override
-  public EndpointStatus join(
-      InetSocketAddress endpoint,
-      Map<String, InetSocketAddress> auxEndpoints,
-      Status status) {
-
-    LOG.warning("This method is deprecated. Please do not specify a status field.");
-    return join(endpoint, auxEndpoints, Optional.<Integer>absent());
-  }
-
-  @Override
-  public EndpointStatus join(
-      InetSocketAddress endpoint,
-      Map<String, InetSocketAddress> auxEndpoints) {
-
-    LOG.warning("Joining a ServerSet without a shard ID is deprecated and will soon break.");
-    return join(endpoint, auxEndpoints, Optional.<Integer>absent());
-  }
-
-  @Override
-  public EndpointStatus join(
-      InetSocketAddress endpoint,
-      Map<String, InetSocketAddress> auxEndpoints,
-      int shardId) throws JoinException, InterruptedException {
-
-    return join(endpoint, auxEndpoints, Optional.of(shardId));
-  }
-
-  @Override
-  public Command watch(HostChangeMonitor<ServiceInstance> monitor) {
-    monitor.onChange(hosts);
-    return Commands.NOOP;
-  }
-
-  @Override
-  public void monitor(HostChangeMonitor<ServiceInstance> monitor) throws MonitorException {
-    watch(monitor);
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/zookeeper/ZooKeeperMap.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/zookeeper/ZooKeeperMap.java b/commons/src/main/java/org/apache/aurora/common/zookeeper/ZooKeeperMap.java
deleted file mode 100644
index 29db55a..0000000
--- a/commons/src/main/java/org/apache/aurora/common/zookeeper/ZooKeeperMap.java
+++ /dev/null
@@ -1,411 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.zookeeper;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Function;
-import com.google.common.base.Functions;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ForwardingMap;
-import com.google.common.collect.Sets;
-
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.WatchedEvent;
-import org.apache.zookeeper.Watcher;
-
-import org.apache.aurora.common.base.Command;
-import org.apache.aurora.common.base.ExceptionalSupplier;
-import org.apache.aurora.common.base.MorePreconditions;
-import org.apache.aurora.common.util.BackoffHelper;
-import org.apache.aurora.common.zookeeper.ZooKeeperClient.ZooKeeperConnectionException;
-
-/**
- * A ZooKeeper backed {@link Map}.  Initialized with a node path, this map represents child nodes
- * under that path as keys, with the data in those nodes as values.  This map is readonly from
- * clients of this class, and only can be modified via direct zookeeper operations.
- *
- * Note that instances of this class maintain a zookeeper watch for each zookeeper node under the
- * parent, as well as on the parent itself.  Instances of this class should be created via the
- * {@link #create} factory method.
- *
- * As of ZooKeeper Version 3.1, the maximum allowable size of a data node is 1 MB.  A single
- * client should be able to hold up to maintain several thousand watches, but this depends on rate
- * of data change as well.
- *
- * Talk to your zookeeper cluster administrator if you expect number of map entries times number
- * of live clients to exceed a thousand, as a zookeeper cluster is limited by total number of
- * server-side watches enabled.
- *
- * For an example of a set of tools to maintain one of these maps, please see
- * src/scripts/HenAccess.py in the hen repository.
- *
- * @param <V> the type of values this map stores
- */
-public class ZooKeeperMap<V> extends ForwardingMap<String, V> {
-
-  /**
-   * An optional listener which can be supplied and triggered when entries in a ZooKeeperMap
-   * are added, changed or removed. For a ZooKeeperMap of type <V>, the listener will fire a
-   * "nodeChanged" event with the name of the ZNode that changed, and its resulting value as
-   * interpreted by the provided deserializer. Removal of child nodes triggers the "nodeRemoved"
-   * method indicating the name of the ZNode which is no longer present in the map.
-   */
-  public interface Listener<V> {
-
-    /**
-     * Fired when a node is added to the ZooKeeperMap or changed.
-     *
-     * @param nodeName indicates the name of the ZNode that was added or changed.
-     * @param value is the new value of the node after passing through your supplied deserializer.
-     */
-    void nodeChanged(String nodeName, V value);
-
-    /**
-     * Fired when a node is removed from the ZooKeeperMap.
-     *
-     * @param nodeName indicates the name of the ZNode that was removed from the ZooKeeperMap.
-     */
-    void nodeRemoved(String nodeName);
-  }
-
-  /**
-   * Default deserializer for the constructor if you want to simply store the zookeeper byte[] data
-   * in this map.
-   */
-  public static final Function<byte[], byte[]> BYTE_ARRAY_VALUES = Functions.identity();
-
-  /**
-   * A listener that ignores all events.
-   */
-  public static <T> Listener<T> noopListener() {
-    return new Listener<T>() {
-      @Override public void nodeChanged(String nodeName, T value) { }
-      @Override public void nodeRemoved(String nodeName) { }
-    };
-  }
-
-  private static final Logger LOG = Logger.getLogger(ZooKeeperMap.class.getName());
-
-  private final ZooKeeperClient zkClient;
-  private final String nodePath;
-  private final Function<byte[], V> deserializer;
-
-  private final ConcurrentMap<String, V> localMap;
-  private final Map<String, V> unmodifiableLocalMap;
-  private final BackoffHelper backoffHelper;
-
-  private final Listener<V> mapListener;
-
-  // Whether it's safe to re-establish watches if our zookeeper session has expired.
-  private final Object safeToRewatchLock;
-  private volatile boolean safeToRewatch;
-
-  /**
-   * Returns an initialized ZooKeeperMap.  The given path must exist at the time of
-   * creation or a {@link KeeperException} will be thrown.
-   *
-   * @param zkClient a zookeeper client
-   * @param nodePath path to a node whose data will be watched
-   * @param deserializer a function that converts byte[] data from a zk node to this map's
-   *     value type V
-   * @param listener is a Listener which fires when values are added, changed, or removed.
-   *
-   * @throws InterruptedException if the underlying zookeeper server transaction is interrupted
-   * @throws KeeperException.NoNodeException if the given nodePath doesn't exist
-   * @throws KeeperException if the server signals an error
-   * @throws ZooKeeperConnectionException if there was a problem connecting to the zookeeper
-   *     cluster
-   */
-  public static <V> ZooKeeperMap<V> create(
-      ZooKeeperClient zkClient,
-      String nodePath,
-      Function<byte[], V> deserializer,
-      Listener<V> listener)
-      throws InterruptedException, KeeperException, ZooKeeperConnectionException {
-
-    ZooKeeperMap<V> zkMap = new ZooKeeperMap<V>(zkClient, nodePath, deserializer, listener);
-    zkMap.init();
-    return zkMap;
-  }
-
-
-  /**
-   * Returns an initialized ZooKeeperMap.  The given path must exist at the time of
-   * creation or a {@link KeeperException} will be thrown.
-   *
-   * @param zkClient a zookeeper client
-   * @param nodePath path to a node whose data will be watched
-   * @param deserializer a function that converts byte[] data from a zk node to this map's
-   *     value type V
-   *
-   * @throws InterruptedException if the underlying zookeeper server transaction is interrupted
-   * @throws KeeperException.NoNodeException if the given nodePath doesn't exist
-   * @throws KeeperException if the server signals an error
-   * @throws ZooKeeperConnectionException if there was a problem connecting to the zookeeper
-   *     cluster
-   */
-  public static <V> ZooKeeperMap<V> create(
-      ZooKeeperClient zkClient,
-      String nodePath,
-      Function<byte[], V> deserializer)
-      throws InterruptedException, KeeperException, ZooKeeperConnectionException {
-
-    return ZooKeeperMap.create(zkClient, nodePath, deserializer, ZooKeeperMap.<V>noopListener());
-  }
-
-  /**
-   * Initializes a ZooKeeperMap.  The given path must exist at the time of object creation or
-   * a {@link KeeperException} will be thrown.
-   *
-   * Please note that this object will not track any remote zookeeper data until {@link #init()}
-   * is successfully called.  After construction and before that call, this {@link Map} will
-   * be empty.
-   *
-   * @param zkClient a zookeeper client
-   * @param nodePath top-level node path under which the map data lives
-   * @param deserializer a function that converts byte[] data from a zk node to this map's
-   *     value type V
-   * @param mapListener is a Listener which fires when values are added, changed, or removed.
-   *
-   * @throws InterruptedException if the underlying zookeeper server transaction is interrupted
-   * @throws KeeperException.NoNodeException if the given nodePath doesn't exist
-   * @throws KeeperException if the server signals an error
-   * @throws ZooKeeperConnectionException if there was a problem connecting to the zookeeper
-   *     cluster
-   */
-  @VisibleForTesting
-  ZooKeeperMap(
-      ZooKeeperClient zkClient,
-      String nodePath,
-      Function<byte[], V> deserializer,
-      Listener<V> mapListener)
-      throws InterruptedException, KeeperException, ZooKeeperConnectionException {
-
-    super();
-
-    this.mapListener = Preconditions.checkNotNull(mapListener);
-    this.zkClient = Preconditions.checkNotNull(zkClient);
-    this.nodePath = MorePreconditions.checkNotBlank(nodePath);
-    this.deserializer = Preconditions.checkNotNull(deserializer);
-
-    localMap = new ConcurrentHashMap<String, V>();
-    unmodifiableLocalMap = Collections.unmodifiableMap(localMap);
-    backoffHelper = new BackoffHelper();
-    safeToRewatchLock = new Object();
-    safeToRewatch = false;
-
-    if (zkClient.get().exists(nodePath, null) == null) {
-      throw new KeeperException.NoNodeException();
-    }
-  }
-
-  /**
-   * Initialize zookeeper tracking for this {@link Map}.  Once this call returns, this object
-   * will be tracking data in zookeeper.
-   *
-   * @throws InterruptedException if the underlying zookeeper server transaction is interrupted
-   * @throws KeeperException if the server signals an error
-   * @throws ZooKeeperConnectionException if there was a problem connecting to the zookeeper
-   *     cluster
-   */
-  @VisibleForTesting
-  void init() throws InterruptedException, KeeperException, ZooKeeperConnectionException {
-    Watcher watcher = zkClient.registerExpirationHandler(new Command() {
-      @Override public void execute() {
-        /*
-         * First rewatch all of our locally cached children.  Some of them may not exist anymore,
-         * which will lead to caught KeeperException.NoNode whereafter we'll remove that child
-         * from the cached map.
-         *
-         * Next, we'll establish our top level child watch and add any new nodes that might exist.
-         */
-        try {
-          synchronized (safeToRewatchLock) {
-            if (safeToRewatch) {
-              rewatchDataNodes();
-              tryWatchChildren();
-            }
-          }
-        } catch (InterruptedException e) {
-          LOG.log(Level.WARNING, "Interrupted while trying to re-establish watch.", e);
-          Thread.currentThread().interrupt();
-        }
-      }
-    });
-
-    try {
-      // Synchronize to prevent the race of watchChildren completing and then the session expiring
-      // before we update safeToRewatch.
-      synchronized (safeToRewatchLock) {
-        watchChildren();
-        safeToRewatch = true;
-      }
-    } catch (InterruptedException e) {
-      zkClient.unregister(watcher);
-      throw e;
-    } catch (KeeperException e) {
-      zkClient.unregister(watcher);
-      throw e;
-    } catch (ZooKeeperConnectionException e) {
-      zkClient.unregister(watcher);
-      throw e;
-    }
-  }
-
-  @Override
-  protected Map<String, V> delegate() {
-    return unmodifiableLocalMap;
-  }
-
-  private void tryWatchChildren() throws InterruptedException {
-    backoffHelper.doUntilSuccess(new ExceptionalSupplier<Boolean, InterruptedException>() {
-      @Override public Boolean get() throws InterruptedException {
-        try {
-          watchChildren();
-          return true;
-        } catch (KeeperException e) {
-          return false;
-        } catch (ZooKeeperConnectionException e) {
-          return false;
-        }
-      }
-    });
-  }
-
-  private synchronized void watchChildren()
-      throws InterruptedException, KeeperException, ZooKeeperConnectionException {
-
-    /*
-     * Add a watch on the parent node itself, and attempt to rewatch if it
-     * gets deleted
-     */
-    zkClient.get().exists(nodePath, new Watcher() {
-      @Override public void process(WatchedEvent event) {
-        if (event.getType() == Watcher.Event.EventType.NodeDeleted) {
-          // If the parent node no longer exists
-          localMap.clear();
-          try {
-            tryWatchChildren();
-          } catch (InterruptedException e) {
-            LOG.log(Level.WARNING, "Interrupted while trying to watch children.", e);
-            Thread.currentThread().interrupt();
-          }
-        }
-      }});
-
-    final Watcher childWatcher = new Watcher() {
-      @Override
-      public void process(WatchedEvent event) {
-        if (event.getType() == Watcher.Event.EventType.NodeChildrenChanged) {
-          try {
-            tryWatchChildren();
-          } catch (InterruptedException e) {
-            LOG.log(Level.WARNING, "Interrupted while trying to watch children.", e);
-            Thread.currentThread().interrupt();
-          }
-        }
-      }
-    };
-
-    List<String> children = zkClient.get().getChildren(nodePath, childWatcher);
-    updateChildren(Sets.newHashSet(children));
-  }
-
-  private void tryAddChild(final String child) throws InterruptedException {
-    backoffHelper.doUntilSuccess(new ExceptionalSupplier<Boolean, InterruptedException>() {
-      @Override public Boolean get() throws InterruptedException {
-        try {
-          addChild(child);
-          return true;
-        } catch (KeeperException e) {
-          return false;
-        } catch (ZooKeeperConnectionException e) {
-          return false;
-        }
-      }
-    });
-  }
-
-  // TODO(Adam Samet) - Make this use the ZooKeeperNode class.
-  private void addChild(final String child)
-      throws InterruptedException, KeeperException, ZooKeeperConnectionException {
-
-    final Watcher nodeWatcher = new Watcher() {
-      @Override
-      public void process(WatchedEvent event) {
-        if (event.getType() == Watcher.Event.EventType.NodeDataChanged) {
-          try {
-            tryAddChild(child);
-          } catch (InterruptedException e) {
-            LOG.log(Level.WARNING, "Interrupted while trying to add a child.", e);
-            Thread.currentThread().interrupt();
-          }
-        } else if (event.getType() == Watcher.Event.EventType.NodeDeleted) {
-          removeEntry(child);
-        }
-      }
-    };
-
-    try {
-      V value = deserializer.apply(zkClient.get().getData(makePath(child), nodeWatcher, null));
-      putEntry(child, value);
-    } catch (KeeperException.NoNodeException e) {
-      // This node doesn't exist anymore, remove it from the map and we're done.
-      removeEntry(child);
-    }
-  }
-
-  @VisibleForTesting
-  void removeEntry(String key) {
-    localMap.remove(key);
-    mapListener.nodeRemoved(key);
-  }
-
-  @VisibleForTesting
-  void putEntry(String key, V value) {
-    localMap.put(key, value);
-    mapListener.nodeChanged(key, value);
-  }
-
-  private void rewatchDataNodes() throws InterruptedException {
-    for (String child : keySet()) {
-      tryAddChild(child);
-    }
-  }
-
-  private String makePath(final String child) {
-    return nodePath + "/" + child;
-  }
-
-  private void updateChildren(Set<String> zkChildren) throws InterruptedException {
-    Set<String> addedChildren = Sets.difference(zkChildren, keySet());
-    Set<String> removedChildren = Sets.difference(keySet(), zkChildren);
-    for (String child : addedChildren) {
-      tryAddChild(child);
-    }
-    for (String child : removedChildren) {
-      removeEntry(child);
-    }
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/zookeeper/ZooKeeperNode.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/zookeeper/ZooKeeperNode.java b/commons/src/main/java/org/apache/aurora/common/zookeeper/ZooKeeperNode.java
deleted file mode 100644
index 3829ca7..0000000
--- a/commons/src/main/java/org/apache/aurora/common/zookeeper/ZooKeeperNode.java
+++ /dev/null
@@ -1,349 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.zookeeper;
-
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.annotation.Nullable;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Function;
-import com.google.common.base.Functions;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Supplier;
-
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.WatchedEvent;
-import org.apache.zookeeper.Watcher;
-import org.apache.zookeeper.Watcher.Event.KeeperState;
-import org.apache.zookeeper.data.Stat;
-
-import org.apache.aurora.common.base.Closure;
-import org.apache.aurora.common.base.Closures;
-import org.apache.aurora.common.base.Command;
-import org.apache.aurora.common.base.ExceptionalSupplier;
-import org.apache.aurora.common.base.MorePreconditions;
-import org.apache.aurora.common.util.BackoffHelper;
-import org.apache.aurora.common.zookeeper.ZooKeeperClient.ZooKeeperConnectionException;
-
-/**
- * An implementation of {@link Supplier} that offers a readonly view of a
- * zookeeper data node.  This class is thread-safe.
- *
- * Instances of this class each maintain a zookeeper watch for the remote data node.  Instances
- * of this class should be created via the {@link #create} factory method.
- *
- * Please see zookeeper documentation and talk to your cluster administrator for guidance on
- * appropriate node size and total number of nodes you should be using.
- *
- * @param <T> the type of data this node stores
- */
-public class ZooKeeperNode<T> implements Supplier<T> {
-  /**
-   * Deserializer for the constructor if you want to simply store the zookeeper byte[] data
-   * as-is.
-   */
-  public static final Function<byte[], byte[]> BYTE_ARRAY_VALUE = Functions.identity();
-
-  private static final Logger LOG = Logger.getLogger(ZooKeeperNode.class.getName());
-
-  private final ZooKeeperClient zkClient;
-  private final String nodePath;
-  private final NodeDeserializer<T> deserializer;
-
-  private final BackoffHelper backoffHelper;
-
-  // Whether it's safe to re-establish watches if our zookeeper session has expired.
-  private final Object safeToRewatchLock;
-  private volatile boolean safeToRewatch;
-
-  private final T NO_DATA = null;
-  @Nullable private volatile T nodeData;
-  private final Closure<T> dataUpdateListener;
-
-  /**
-   * When a call to ZooKeeper.getData is made, the Watcher is added to a Set before the the network
-   * request is made and if the request fails, the Watcher remains. There's a problem where Watcher
-   * can accumulate when there are failed requests, so they are set to instance fields and reused.
-   */
-  private final Watcher nodeWatcher;
-  private final Watcher existenceWatcher;
-
-  /**
-   * Returns an initialized ZooKeeperNode.  The given node must exist at the time of object
-   * creation or a {@link KeeperException} will be thrown.
-   *
-   * @param zkClient a zookeeper client
-   * @param nodePath path to a node whose data will be watched
-   * @param deserializer a function that converts byte[] data from a zk node to this supplier's
-   *     type T
-   *
-   * @throws InterruptedException if the underlying zookeeper server transaction is interrupted
-   * @throws KeeperException.NoNodeException if the given nodePath doesn't exist
-   * @throws KeeperException if the server signals an error
-   * @throws ZooKeeperConnectionException if there was a problem connecting to the zookeeper
-   *     cluster
-   */
-  public static <T> ZooKeeperNode<T> create(ZooKeeperClient zkClient, String nodePath,
-      Function<byte[], T> deserializer) throws InterruptedException, KeeperException,
-      ZooKeeperConnectionException {
-    return create(zkClient, nodePath, deserializer, Closures.<T>noop());
-  }
-
-  /**
-   * Like the above, but optionally takes in a {@link Closure} that will get notified
-   * whenever the data is updated from the remote node.
-   *
-   * @param dataUpdateListener a {@link Closure} to receive data update notifications.
-   */
-  public static <T> ZooKeeperNode<T> create(ZooKeeperClient zkClient, String nodePath,
-      Function<byte[], T> deserializer, Closure<T> dataUpdateListener) throws InterruptedException,
-      KeeperException, ZooKeeperConnectionException {
-    return create(zkClient, nodePath, new FunctionWrapper<T>(deserializer), dataUpdateListener);
-  }
-
-  /**
-   * Returns an initialized ZooKeeperNode.  The given node must exist at the time of object
-   * creation or a {@link KeeperException} will be thrown.
-   *
-   * @param zkClient a zookeeper client
-   * @param nodePath path to a node whose data will be watched
-   * @param deserializer an implentation of {@link NodeDeserializer} that converts a byte[] from a
-   *     zk node to this supplier's type T. Also supplies a {@link Stat} object which is useful for
-   *     doing versioned updates.
-   *
-   * @throws InterruptedException if the underlying zookeeper server transaction is interrupted
-   * @throws KeeperException.NoNodeException if the given nodePath doesn't exist
-   * @throws KeeperException if the server signals an error
-   * @throws ZooKeeperConnectionException if there was a problem connecting to the zookeeper
-   *     cluster
-   */
-  public static <T> ZooKeeperNode<T> create(ZooKeeperClient zkClient, String nodePath,
-      NodeDeserializer<T> deserializer) throws InterruptedException, KeeperException,
-      ZooKeeperConnectionException {
-    return create(zkClient, nodePath, deserializer, Closures.<T>noop());
-  }
-
-  /**
-   * Like the above, but optionally takes in a {@link Closure} that will get notified
-   * whenever the data is updated from the remote node.
-   *
-   * @param dataUpdateListener a {@link Closure} to receive data update notifications.
-   */
-  public static <T> ZooKeeperNode<T> create(ZooKeeperClient zkClient, String nodePath,
-      NodeDeserializer<T> deserializer, Closure<T> dataUpdateListener)
-      throws InterruptedException, KeeperException, ZooKeeperConnectionException {
-    ZooKeeperNode<T> zkNode =
-        new ZooKeeperNode<T>(zkClient, nodePath, deserializer, dataUpdateListener);
-    zkNode.init();
-    return zkNode;
-  }
-
-  /**
-   * Initializes a ZooKeeperNode.  The given node must exist at the time of object creation or
-   * a {@link KeeperException} will be thrown.
-   *
-   * Please note that this object will not track any remote zookeeper data until {@link #init()}
-   * is successfully called.  After construction and before that call, this {@link Supplier} will
-   * return null.
-   *
-   * @param zkClient a zookeeper client
-   * @param nodePath path to a node whose data will be watched
-   * @param deserializer an implementation of {@link NodeDeserializer} that converts byte[] data
-   *     from a zk node to this supplier's type T
-   * @param dataUpdateListener a {@link Closure} to receive data update notifications.
-   */
-  @VisibleForTesting
-  ZooKeeperNode(ZooKeeperClient zkClient, String nodePath,
-      NodeDeserializer<T> deserializer, Closure<T> dataUpdateListener) {
-    this.zkClient = Preconditions.checkNotNull(zkClient);
-    this.nodePath = MorePreconditions.checkNotBlank(nodePath);
-    this.deserializer = Preconditions.checkNotNull(deserializer);
-    this.dataUpdateListener = Preconditions.checkNotNull(dataUpdateListener);
-
-    backoffHelper = new BackoffHelper();
-    safeToRewatchLock = new Object();
-    safeToRewatch = false;
-    nodeData = NO_DATA;
-
-    nodeWatcher = new Watcher() {
-      @Override public void process(WatchedEvent event) {
-        if (event.getState() == KeeperState.SyncConnected) {
-          try {
-            tryWatchDataNode();
-          } catch (InterruptedException e) {
-            LOG.log(Level.WARNING, "Interrupted while trying to watch a data node.", e);
-            Thread.currentThread().interrupt();
-          }
-        } else {
-          LOG.info("Ignoring watcher event " + event);
-        }
-      }
-    };
-
-    existenceWatcher = new Watcher() {
-      @Override public void process(WatchedEvent event) {
-        if (event.getType() == Watcher.Event.EventType.NodeCreated) {
-          try {
-            tryWatchDataNode();
-          } catch (InterruptedException e) {
-            LOG.log(Level.WARNING, "Interrupted while trying to watch a data node.", e);
-            Thread.currentThread().interrupt();
-          }
-        }
-      }
-    };
-  }
-
-  /**
-   * Initialize zookeeper tracking for this {@link Supplier}.  Once this call returns, this object
-   * will be tracking data in zookeeper.
-   *
-   * @throws InterruptedException if the underlying zookeeper server transaction is interrupted
-   * @throws KeeperException if the server signals an error
-   * @throws ZooKeeperConnectionException if there was a problem connecting to the zookeeper
-   *     cluster
-   */
-  @VisibleForTesting
-  void init() throws InterruptedException, KeeperException,
-      ZooKeeperConnectionException {
-    Watcher watcher = zkClient.registerExpirationHandler(new Command() {
-      @Override public void execute() {
-        try {
-          synchronized (safeToRewatchLock) {
-            if (safeToRewatch) {
-              tryWatchDataNode();
-            }
-          }
-        } catch (InterruptedException e) {
-          LOG.log(Level.WARNING, "Interrupted while trying to re-establish watch.", e);
-          Thread.currentThread().interrupt();
-        }
-      }
-    });
-
-    try {
-      /*
-       * Synchronize to prevent the race of watchDataNode completing and then the session expiring
-       * before we update safeToRewatch.
-       */
-      synchronized (safeToRewatchLock) {
-        watchDataNode();
-        safeToRewatch = true;
-      }
-    } catch (InterruptedException e) {
-      zkClient.unregister(watcher);
-      throw e;
-    } catch (KeeperException e) {
-      zkClient.unregister(watcher);
-      throw e;
-    } catch (ZooKeeperConnectionException e) {
-      zkClient.unregister(watcher);
-      throw e;
-    }
-  }
-
-  /**
-   * Returns the data corresponding to a byte array in a remote zookeeper node.  This data is
-   * cached locally and updated in the background on watch notifications.
-   *
-   * @return the data currently cached locally or null if {@link #init()} hasn't been called
-   *   or the backing node has no data or does not exist anymore.
-   */
-  @Override
-  public @Nullable T get() {
-    return nodeData;
-  }
-
-  @VisibleForTesting
-  void updateData(@Nullable T newData) {
-    nodeData = newData;
-    dataUpdateListener.execute(newData);
-  }
-
-  private void tryWatchDataNode() throws InterruptedException {
-    backoffHelper.doUntilSuccess(new ExceptionalSupplier<Boolean, InterruptedException>() {
-      @Override public Boolean get() throws InterruptedException {
-        try {
-          watchDataNode();
-          return true;
-        } catch (KeeperException e) {
-          return false;
-        } catch (ZooKeeperConnectionException e) {
-          return false;
-        }
-      }
-    });
-  }
-
-  private void watchDataNode() throws InterruptedException, KeeperException,
-      ZooKeeperConnectionException {
-    try {
-      Stat stat = new Stat();
-      byte[] rawData = zkClient.get().getData(nodePath, nodeWatcher, stat);
-      T newData = deserializer.deserialize(rawData, stat);
-      updateData(newData);
-    } catch (KeeperException.NoNodeException e) {
-      /*
-       * This node doesn't exist right now, reflect that locally and then create a watch to wait
-       * for its recreation.
-       */
-      updateData(NO_DATA);
-      watchForExistence();
-    }
-  }
-
-  private void watchForExistence() throws InterruptedException, KeeperException,
-      ZooKeeperConnectionException {
-    /*
-     * If the node was created between the getData call and this call, just try watching it.
-     * We'll have an extra exists watch on it that goes off on its next deletion, which will
-     * be a no-op.
-     * Otherwise, just let the exists watch wait for its creation.
-     */
-    if (zkClient.get().exists(nodePath, existenceWatcher) != null) {
-      tryWatchDataNode();
-    }
-  }
-
-  /**
-   * Interface for defining zookeeper node data deserialization.
-   *
-   * @param <T> the type of data associated with this node
-   */
-  public interface NodeDeserializer<T> {
-    /**
-     * @param data the byte array returned from ZooKeeper when a watch is triggered.
-     * @param stat a ZooKeeper {@link Stat} object. Populated by
-     *             {@link org.apache.zookeeper.ZooKeeper#getData(String, boolean, Stat)}.
-     */
-    T deserialize(byte[] data, Stat stat);
-  }
-
-  // wrapper for backwards compatibility with older create() methods with Function parameter
-  private static final class FunctionWrapper<T> implements NodeDeserializer<T> {
-    private final Function<byte[], T> func;
-    private FunctionWrapper(Function<byte[], T> func) {
-      Preconditions.checkNotNull(func);
-      this.func = func;
-    }
-
-    public T deserialize(byte[] rawData, Stat stat) {
-      return func.apply(rawData);
-    }
-  }
-
-}
-


[09/21] aurora git commit: Remove unused classes from commons fork.

Posted by wf...@apache.org.
http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/resources/org/apache/aurora/common/common/webassets/bootstrap/2.1.1/img/glyphicons-halflings-white.png
----------------------------------------------------------------------
diff --git a/commons/src/main/resources/org/apache/aurora/common/common/webassets/bootstrap/2.1.1/img/glyphicons-halflings-white.png b/commons/src/main/resources/org/apache/aurora/common/common/webassets/bootstrap/2.1.1/img/glyphicons-halflings-white.png
deleted file mode 100644
index 3bf6484..0000000
Binary files a/commons/src/main/resources/org/apache/aurora/common/common/webassets/bootstrap/2.1.1/img/glyphicons-halflings-white.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/resources/org/apache/aurora/common/common/webassets/bootstrap/2.1.1/img/glyphicons-halflings.png
----------------------------------------------------------------------
diff --git a/commons/src/main/resources/org/apache/aurora/common/common/webassets/bootstrap/2.1.1/img/glyphicons-halflings.png b/commons/src/main/resources/org/apache/aurora/common/common/webassets/bootstrap/2.1.1/img/glyphicons-halflings.png
deleted file mode 100644
index a996999..0000000
Binary files a/commons/src/main/resources/org/apache/aurora/common/common/webassets/bootstrap/2.1.1/img/glyphicons-halflings.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/resources/org/apache/aurora/common/common/webassets/bootstrap/2.1.1/js/bootstrap.min.js
----------------------------------------------------------------------
diff --git a/commons/src/main/resources/org/apache/aurora/common/common/webassets/bootstrap/2.1.1/js/bootstrap.min.js b/commons/src/main/resources/org/apache/aurora/common/common/webassets/bootstrap/2.1.1/js/bootstrap.min.js
deleted file mode 100644
index 5841dbf..0000000
--- a/commons/src/main/resources/org/apache/aurora/common/common/webassets/bootstrap/2.1.1/js/bootstrap.min.js
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*!
-* Bootstrap.js by @fat & @mdo
-* Copyright 2012 Twitter, Inc.
-* http://www.apache.org/licenses/LICENSE-2.0.txt
-*/
-!function(e){e(function(){"use strict";e.support.transition=function(){var e=function(){var e=document.createElement("bootstrap"),t={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},n;for(n in t)if(e.style[n]!==undefined)return t[n]}();return e&&{end:e}}()})}(window.jQuery),!function(e){"use strict";var t='[data-dismiss="alert"]',n=function(n){e(n).on("click",t,this.close)};n.prototype.close=function(t){function s(){i.trigger("closed").remove()}var n=e(this),r=n.attr("data-target"),i;r||(r=n.attr("href"),r=r&&r.replace(/.*(?=#[^\s]*$)/,"")),i=e(r),t&&t.preventDefault(),i.length||(i=n.hasClass("alert")?n:n.parent()),i.trigger(t=e.Event("close"));if(t.isDefaultPrevented())return;i.removeClass("in"),e.support.transition&&i.hasClass("fade")?i.on(e.support.transition.end,s):s()},e.fn.alert=function(t){return this.each(function(){var r=e(this),i=r.data("alert");i||r.data("alert",i=new n(this)),type
 of t=="string"&&i[t].call(r)})},e.fn.alert.Constructor=n,e(function(){e("body").on("click.alert.data-api",t,n.prototype.close)})}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.$element=e(t),this.options=e.extend({},e.fn.button.defaults,n)};t.prototype.setState=function(e){var t="disabled",n=this.$element,r=n.data(),i=n.is("input")?"val":"html";e+="Text",r.resetText||n.data("resetText",n[i]()),n[i](r[e]||this.options[e]),setTimeout(function(){e=="loadingText"?n.addClass(t).attr(t,t):n.removeClass(t).removeAttr(t)},0)},t.prototype.toggle=function(){var e=this.$element.closest('[data-toggle="buttons-radio"]');e&&e.find(".active").removeClass("active"),this.$element.toggleClass("active")},e.fn.button=function(n){return this.each(function(){var r=e(this),i=r.data("button"),s=typeof n=="object"&&n;i||r.data("button",i=new t(this,s)),n=="toggle"?i.toggle():n&&i.setState(n)})},e.fn.button.defaults={loadingText:"loading..."},e.fn.button.Constructor=t,e(function(){e("body"
 ).on("click.button.data-api","[data-toggle^=button]",function(t){var n=e(t.target);n.hasClass("btn")||(n=n.closest(".btn")),n.button("toggle")})})}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.$element=e(t),this.options=n,this.options.slide&&this.slide(this.options.slide),this.options.pause=="hover"&&this.$element.on("mouseenter",e.proxy(this.pause,this)).on("mouseleave",e.proxy(this.cycle,this))};t.prototype={cycle:function(t){return t||(this.paused=!1),this.options.interval&&!this.paused&&(this.interval=setInterval(e.proxy(this.next,this),this.options.interval)),this},to:function(t){var n=this.$element.find(".item.active"),r=n.parent().children(),i=r.index(n),s=this;if(t>r.length-1||t<0)return;return this.sliding?this.$element.one("slid",function(){s.to(t)}):i==t?this.pause().cycle():this.slide(t>i?"next":"prev",e(r[t]))},pause:function(t){return t||(this.paused=!0),this.$element.find(".next, .prev").length&&e.support.transition.end&&(this.$element.trigger(e.s
 upport.transition.end),this.cycle()),clearInterval(this.interval),this.interval=null,this},next:function(){if(this.sliding)return;return this.slide("next")},prev:function(){if(this.sliding)return;return this.slide("prev")},slide:function(t,n){var r=this.$element.find(".item.active"),i=n||r[t](),s=this.interval,o=t=="next"?"left":"right",u=t=="next"?"first":"last",a=this,f=e.Event("slide",{relatedTarget:i[0]});this.sliding=!0,s&&this.pause(),i=i.length?i:this.$element.find(".item")[u]();if(i.hasClass("active"))return;if(e.support.transition&&this.$element.hasClass("slide")){this.$element.trigger(f);if(f.isDefaultPrevented())return;i.addClass(t),i[0].offsetWidth,r.addClass(o),i.addClass(o),this.$element.one(e.support.transition.end,function(){i.removeClass([t,o].join(" ")).addClass("active"),r.removeClass(["active",o].join(" ")),a.sliding=!1,setTimeout(function(){a.$element.trigger("slid")},0)})}else{this.$element.trigger(f);if(f.isDefaultPrevented())return;r.removeClass("active"),i.a
 ddClass("active"),this.sliding=!1,this.$element.trigger("slid")}return s&&this.cycle(),this}},e.fn.carousel=function(n){return this.each(function(){var r=e(this),i=r.data("carousel"),s=e.extend({},e.fn.carousel.defaults,typeof n=="object"&&n),o=typeof n=="string"?n:s.slide;i||r.data("carousel",i=new t(this,s)),typeof n=="number"?i.to(n):o?i[o]():s.interval&&i.cycle()})},e.fn.carousel.defaults={interval:5e3,pause:"hover"},e.fn.carousel.Constructor=t,e(function(){e("body").on("click.carousel.data-api","[data-slide]",function(t){var n=e(this),r,i=e(n.attr("data-target")||(r=n.attr("href"))&&r.replace(/.*(?=#[^\s]+$)/,"")),s=!i.data("modal")&&e.extend({},i.data(),n.data());i.carousel(s),t.preventDefault()})})}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.$element=e(t),this.options=e.extend({},e.fn.collapse.defaults,n),this.options.parent&&(this.$parent=e(this.options.parent)),this.options.toggle&&this.toggle()};t.prototype={constructor:t,dimension:function(){var e=t
 his.$element.hasClass("width");return e?"width":"height"},show:function(){var t,n,r,i;if(this.transitioning)return;t=this.dimension(),n=e.camelCase(["scroll",t].join("-")),r=this.$parent&&this.$parent.find("> .accordion-group > .in");if(r&&r.length){i=r.data("collapse");if(i&&i.transitioning)return;r.collapse("hide"),i||r.data("collapse",null)}this.$element[t](0),this.transition("addClass",e.Event("show"),"shown"),e.support.transition&&this.$element[t](this.$element[0][n])},hide:function(){var t;if(this.transitioning)return;t=this.dimension(),this.reset(this.$element[t]()),this.transition("removeClass",e.Event("hide"),"hidden"),this.$element[t](0)},reset:function(e){var t=this.dimension();return this.$element.removeClass("collapse")[t](e||"auto")[0].offsetWidth,this.$element[e!==null?"addClass":"removeClass"]("collapse"),this},transition:function(t,n,r){var i=this,s=function(){n.type=="show"&&i.reset(),i.transitioning=0,i.$element.trigger(r)};this.$element.trigger(n);if(n.isDefaultP
 revented())return;this.transitioning=1,this.$element[t]("in"),e.support.transition&&this.$element.hasClass("collapse")?this.$element.one(e.support.transition.end,s):s()},toggle:function(){this[this.$element.hasClass("in")?"hide":"show"]()}},e.fn.collapse=function(n){return this.each(function(){var r=e(this),i=r.data("collapse"),s=typeof n=="object"&&n;i||r.data("collapse",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.collapse.defaults={toggle:!0},e.fn.collapse.Constructor=t,e(function(){e("body").on("click.collapse.data-api","[data-toggle=collapse]",function(t){var n=e(this),r,i=n.attr("data-target")||t.preventDefault()||(r=n.attr("href"))&&r.replace(/.*(?=#[^\s]+$)/,""),s=e(i).data("collapse")?"toggle":n.data();n[e(i).hasClass("in")?"addClass":"removeClass"]("collapsed"),e(i).collapse(s)})})}(window.jQuery),!function(e){"use strict";function r(){i(e(t)).removeClass("open")}function i(t){var n=t.attr("data-target"),r;return n||(n=t.attr("href"),n=n&&/#/.test(n)&&n.replace(/.*(
 ?=#[^\s]*$)/,"")),r=e(n),r.length||(r=t.parent()),r}var t="[data-toggle=dropdown]",n=function(t){var n=e(t).on("click.dropdown.data-api",this.toggle);e("html").on("click.dropdown.data-api",function(){n.parent().removeClass("open")})};n.prototype={constructor:n,toggle:function(t){var n=e(this),s,o;if(n.is(".disabled, :disabled"))return;return s=i(n),o=s.hasClass("open"),r(),o||(s.toggleClass("open"),n.focus()),!1},keydown:function(t){var n,r,s,o,u,a;if(!/(38|40|27)/.test(t.keyCode))return;n=e(this),t.preventDefault(),t.stopPropagation();if(n.is(".disabled, :disabled"))return;o=i(n),u=o.hasClass("open");if(!u||u&&t.keyCode==27)return n.click();r=e("[role=menu] li:not(.divider) a",o);if(!r.length)return;a=r.index(r.filter(":focus")),t.keyCode==38&&a>0&&a--,t.keyCode==40&&a<r.length-1&&a++,~a||(a=0),r.eq(a).focus()}},e.fn.dropdown=function(t){return this.each(function(){var r=e(this),i=r.data("dropdown");i||r.data("dropdown",i=new n(this)),typeof t=="string"&&i[t].call(r)})},e.fn.dropdo
 wn.Constructor=n,e(function(){e("html").on("click.dropdown.data-api touchstart.dropdown.data-api",r),e("body").on("click.dropdown touchstart.dropdown.data-api",".dropdown form",function(e){e.stopPropagation()}).on("click.dropdown.data-api touchstart.dropdown.data-api",t,n.prototype.toggle).on("keydown.dropdown.data-api touchstart.dropdown.data-api",t+", [role=menu]",n.prototype.keydown)})}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.options=n,this.$element=e(t).delegate('[data-dismiss="modal"]',"click.dismiss.modal",e.proxy(this.hide,this)),this.options.remote&&this.$element.find(".modal-body").load(this.options.remote)};t.prototype={constructor:t,toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var t=this,n=e.Event("show");this.$element.trigger(n);if(this.isShown||n.isDefaultPrevented())return;e("body").addClass("modal-open"),this.isShown=!0,this.escape(),this.backdrop(function(){var n=e.support.transition&&t.$element.hasClass("fade
 ");t.$element.parent().length||t.$element.appendTo(document.body),t.$element.show(),n&&t.$element[0].offsetWidth,t.$element.addClass("in").attr("aria-hidden",!1).focus(),t.enforceFocus(),n?t.$element.one(e.support.transition.end,function(){t.$element.trigger("shown")}):t.$element.trigger("shown")})},hide:function(t){t&&t.preventDefault();var n=this;t=e.Event("hide"),this.$element.trigger(t);if(!this.isShown||t.isDefaultPrevented())return;this.isShown=!1,e("body").removeClass("modal-open"),this.escape(),e(document).off("focusin.modal"),this.$element.removeClass("in").attr("aria-hidden",!0),e.support.transition&&this.$element.hasClass("fade")?this.hideWithTransition():this.hideModal()},enforceFocus:function(){var t=this;e(document).on("focusin.modal",function(e){t.$element[0]!==e.target&&!t.$element.has(e.target).length&&t.$element.focus()})},escape:function(){var e=this;this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.modal",function(t){t.which==27&&e.hide()}):this
 .isShown||this.$element.off("keyup.dismiss.modal")},hideWithTransition:function(){var t=this,n=setTimeout(function(){t.$element.off(e.support.transition.end),t.hideModal()},500);this.$element.one(e.support.transition.end,function(){clearTimeout(n),t.hideModal()})},hideModal:function(e){this.$element.hide().trigger("hidden"),this.backdrop()},removeBackdrop:function(){this.$backdrop.remove(),this.$backdrop=null},backdrop:function(t){var n=this,r=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var i=e.support.transition&&r;this.$backdrop=e('<div class="modal-backdrop '+r+'" />').appendTo(document.body),this.options.backdrop!="static"&&this.$backdrop.click(e.proxy(this.hide,this)),i&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),i?this.$backdrop.one(e.support.transition.end,t):t()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),e.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(e.support.transition.e
 nd,e.proxy(this.removeBackdrop,this)):this.removeBackdrop()):t&&t()}},e.fn.modal=function(n){return this.each(function(){var r=e(this),i=r.data("modal"),s=e.extend({},e.fn.modal.defaults,r.data(),typeof n=="object"&&n);i||r.data("modal",i=new t(this,s)),typeof n=="string"?i[n]():s.show&&i.show()})},e.fn.modal.defaults={backdrop:!0,keyboard:!0,show:!0},e.fn.modal.Constructor=t,e(function(){e("body").on("click.modal.data-api",'[data-toggle="modal"]',function(t){var n=e(this),r=n.attr("href"),i=e(n.attr("data-target")||r&&r.replace(/.*(?=#[^\s]+$)/,"")),s=i.data("modal")?"toggle":e.extend({remote:!/#/.test(r)&&r},i.data(),n.data());t.preventDefault(),i.modal(s).one("hide",function(){n.focus()})})})}(window.jQuery),!function(e){"use strict";var t=function(e,t){this.init("tooltip",e,t)};t.prototype={constructor:t,init:function(t,n,r){var i,s;this.type=t,this.$element=e(n),this.options=this.getOptions(r),this.enabled=!0,this.options.trigger=="click"?this.$element.on("click."+this.type,thi
 s.options.selector,e.proxy(this.toggle,this)):this.options.trigger!="manual"&&(i=this.options.trigger=="hover"?"mouseenter":"focus",s=this.options.trigger=="hover"?"mouseleave":"blur",this.$element.on(i+"."+this.type,this.options.selector,e.proxy(this.enter,this)),this.$element.on(s+"."+this.type,this.options.selector,e.proxy(this.leave,this))),this.options.selector?this._options=e.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},getOptions:function(t){return t=e.extend({},e.fn[this.type].defaults,t,this.$element.data()),t.delay&&typeof t.delay=="number"&&(t.delay={show:t.delay,hide:t.delay}),t},enter:function(t){var n=e(t.currentTarget)[this.type](this._options).data(this.type);if(!n.options.delay||!n.options.delay.show)return n.show();clearTimeout(this.timeout),n.hoverState="in",this.timeout=setTimeout(function(){n.hoverState=="in"&&n.show()},n.options.delay.show)},leave:function(t){var n=e(t.currentTarget)[this.type](this._options).data(this.type);this.time
 out&&clearTimeout(this.timeout);if(!n.options.delay||!n.options.delay.hide)return n.hide();n.hoverState="out",this.timeout=setTimeout(function(){n.hoverState=="out"&&n.hide()},n.options.delay.hide)},show:function(){var e,t,n,r,i,s,o;if(this.hasContent()&&this.enabled){e=this.tip(),this.setContent(),this.options.animation&&e.addClass("fade"),s=typeof this.options.placement=="function"?this.options.placement.call(this,e[0],this.$element[0]):this.options.placement,t=/in/.test(s),e.remove().css({top:0,left:0,display:"block"}).appendTo(t?this.$element:document.body),n=this.getPosition(t),r=e[0].offsetWidth,i=e[0].offsetHeight;switch(t?s.split(" ")[1]:s){case"bottom":o={top:n.top+n.height,left:n.left+n.width/2-r/2};break;case"top":o={top:n.top-i,left:n.left+n.width/2-r/2};break;case"left":o={top:n.top+n.height/2-i/2,left:n.left-r};break;case"right":o={top:n.top+n.height/2-i/2,left:n.left+n.width}}e.css(o).addClass(s).addClass("in")}},setContent:function(){var e=this.tip(),t=this.getTitle(
 );e.find(".tooltip-inner")[this.options.html?"html":"text"](t),e.removeClass("fade in top bottom left right")},hide:function(){function r(){var t=setTimeout(function(){n.off(e.support.transition.end).remove()},500);n.one(e.support.transition.end,function(){clearTimeout(t),n.remove()})}var t=this,n=this.tip();return n.removeClass("in"),e.support.transition&&this.$tip.hasClass("fade")?r():n.remove(),this},fixTitle:function(){var e=this.$element;(e.attr("title")||typeof e.attr("data-original-title")!="string")&&e.attr("data-original-title",e.attr("title")||"").removeAttr("title")},hasContent:function(){return this.getTitle()},getPosition:function(t){return e.extend({},t?{top:0,left:0}:this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight})},getTitle:function(){var e,t=this.$element,n=this.options;return e=t.attr("data-original-title")||(typeof n.title=="function"?n.title.call(t[0]):n.title),e},tip:function(){return this.$tip=this.$tip||e(this.o
 ptions.template)},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled},toggle:function(){this[this.tip().hasClass("in")?"hide":"show"]()},destroy:function(){this.hide().$element.off("."+this.type).removeData(this.type)}},e.fn.tooltip=function(n){return this.each(function(){var r=e(this),i=r.data("tooltip"),s=typeof n=="object"&&n;i||r.data("tooltip",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.tooltip.Constructor=t,e.fn.tooltip.defaults={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover",title:"",delay:0,html:!0}}(window.jQuery),!function(e){"use strict";var t=function(e,t){this.init("popover",e,t)};t.prototype=e.extend({},e.fn.tooltip.Constructor.prototype,{constructor:t,setContent:function(){var 
 e=this.tip(),t=this.getTitle(),n=this.getContent();e.find(".popover-title")[this.options.html?"html":"text"](t),e.find(".popover-content > *")[this.options.html?"html":"text"](n),e.removeClass("fade top bottom left right in")},hasContent:function(){return this.getTitle()||this.getContent()},getContent:function(){var e,t=this.$element,n=this.options;return e=t.attr("data-content")||(typeof n.content=="function"?n.content.call(t[0]):n.content),e},tip:function(){return this.$tip||(this.$tip=e(this.options.template)),this.$tip},destroy:function(){this.hide().$element.off("."+this.type).removeData(this.type)}}),e.fn.popover=function(n){return this.each(function(){var r=e(this),i=r.data("popover"),s=typeof n=="object"&&n;i||r.data("popover",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.popover.Constructor=t,e.fn.popover.defaults=e.extend({},e.fn.tooltip.defaults,{placement:"right",trigger:"click",content:"",template:'<div class="popover"><div class="arrow"></div><div class="popover-
 inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>'})}(window.jQuery),!function(e){"use strict";function t(t,n){var r=e.proxy(this.process,this),i=e(t).is("body")?e(window):e(t),s;this.options=e.extend({},e.fn.scrollspy.defaults,n),this.$scrollElement=i.on("scroll.scroll-spy.data-api",r),this.selector=(this.options.target||(s=e(t).attr("href"))&&s.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.$body=e("body"),this.refresh(),this.process()}t.prototype={constructor:t,refresh:function(){var t=this,n;this.offsets=e([]),this.targets=e([]),n=this.$body.find(this.selector).map(function(){var t=e(this),n=t.data("target")||t.attr("href"),r=/^#\w/.test(n)&&e(n);return r&&r.length&&[[r.position().top,n]]||null}).sort(function(e,t){return e[0]-t[0]}).each(function(){t.offsets.push(this[0]),t.targets.push(this[1])})},process:function(){var e=this.$scrollElement.scrollTop()+this.options.offset,t=this.$scrollElement[0].scrollHeight||this.$body[0].sc
 rollHeight,n=t-this.$scrollElement.height(),r=this.offsets,i=this.targets,s=this.activeTarget,o;if(e>=n)return s!=(o=i.last()[0])&&this.activate(o);for(o=r.length;o--;)s!=i[o]&&e>=r[o]&&(!r[o+1]||e<=r[o+1])&&this.activate(i[o])},activate:function(t){var n,r;this.activeTarget=t,e(this.selector).parent(".active").removeClass("active"),r=this.selector+'[data-target="'+t+'"],'+this.selector+'[href="'+t+'"]',n=e(r).parent("li").addClass("active"),n.parent(".dropdown-menu").length&&(n=n.closest("li.dropdown").addClass("active")),n.trigger("activate")}},e.fn.scrollspy=function(n){return this.each(function(){var r=e(this),i=r.data("scrollspy"),s=typeof n=="object"&&n;i||r.data("scrollspy",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.scrollspy.Constructor=t,e.fn.scrollspy.defaults={offset:10},e(window).on("load",function(){e('[data-spy="scroll"]').each(function(){var t=e(this);t.scrollspy(t.data())})})}(window.jQuery),!function(e){"use strict";var t=function(t){this.element=e(t)};t.pr
 ototype={constructor:t,show:function(){var t=this.element,n=t.closest("ul:not(.dropdown-menu)"),r=t.attr("data-target"),i,s,o;r||(r=t.attr("href"),r=r&&r.replace(/.*(?=#[^\s]*$)/,""));if(t.parent("li").hasClass("active"))return;i=n.find(".active a").last()[0],o=e.Event("show",{relatedTarget:i}),t.trigger(o);if(o.isDefaultPrevented())return;s=e(r),this.activate(t.parent("li"),n),this.activate(s,s.parent(),function(){t.trigger({type:"shown",relatedTarget:i})})},activate:function(t,n,r){function o(){i.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),t.addClass("active"),s?(t[0].offsetWidth,t.addClass("in")):t.removeClass("fade"),t.parent(".dropdown-menu")&&t.closest("li.dropdown").addClass("active"),r&&r()}var i=n.find("> .active"),s=r&&e.support.transition&&i.hasClass("fade");s?i.one(e.support.transition.end,o):o(),i.removeClass("in")}},e.fn.tab=function(n){return this.each(function(){var r=e(this),i=r.data("tab");i||r.data("tab",i=new t(this)),typeof n==
 "string"&&i[n]()})},e.fn.tab.Constructor=t,e(function(){e("body").on("click.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(t){t.preventDefault(),e(this).tab("show")})})}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.$element=e(t),this.options=e.extend({},e.fn.typeahead.defaults,n),this.matcher=this.options.matcher||this.matcher,this.sorter=this.options.sorter||this.sorter,this.highlighter=this.options.highlighter||this.highlighter,this.updater=this.options.updater||this.updater,this.$menu=e(this.options.menu).appendTo("body"),this.source=this.options.source,this.shown=!1,this.listen()};t.prototype={constructor:t,select:function(){var e=this.$menu.find(".active").attr("data-value");return this.$element.val(this.updater(e)).change(),this.hide()},updater:function(e){return e},show:function(){var t=e.extend({},this.$element.offset(),{height:this.$element[0].offsetHeight});return this.$menu.css({top:t.top+t.height,left:t.left}),this.$menu.show(),th
 is.shown=!0,this},hide:function(){return this.$menu.hide(),this.shown=!1,this},lookup:function(t){var n;return this.query=this.$element.val(),!this.query||this.query.length<this.options.minLength?this.shown?this.hide():this:(n=e.isFunction(this.source)?this.source(this.query,e.proxy(this.process,this)):this.source,n?this.process(n):this)},process:function(t){var n=this;return t=e.grep(t,function(e){return n.matcher(e)}),t=this.sorter(t),t.length?this.render(t.slice(0,this.options.items)).show():this.shown?this.hide():this},matcher:function(e){return~e.toLowerCase().indexOf(this.query.toLowerCase())},sorter:function(e){var t=[],n=[],r=[],i;while(i=e.shift())i.toLowerCase().indexOf(this.query.toLowerCase())?~i.indexOf(this.query)?n.push(i):r.push(i):t.push(i);return t.concat(n,r)},highlighter:function(e){var t=this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&");return e.replace(new RegExp("("+t+")","ig"),function(e,t){return"<strong>"+t+"</strong>"})},render:function(t){var n=thi
 s;return t=e(t).map(function(t,r){return t=e(n.options.item).attr("data-value",r),t.find("a").html(n.highlighter(r)),t[0]}),t.first().addClass("active"),this.$menu.html(t),this},next:function(t){var n=this.$menu.find(".active").removeClass("active"),r=n.next();r.length||(r=e(this.$menu.find("li")[0])),r.addClass("active")},prev:function(e){var t=this.$menu.find(".active").removeClass("active"),n=t.prev();n.length||(n=this.$menu.find("li").last()),n.addClass("active")},listen:function(){this.$element.on("blur",e.proxy(this.blur,this)).on("keypress",e.proxy(this.keypress,this)).on("keyup",e.proxy(this.keyup,this)),(e.browser.chrome||e.browser.webkit||e.browser.msie)&&this.$element.on("keydown",e.proxy(this.keydown,this)),this.$menu.on("click",e.proxy(this.click,this)).on("mouseenter","li",e.proxy(this.mouseenter,this))},move:function(e){if(!this.shown)return;switch(e.keyCode){case 9:case 13:case 27:e.preventDefault();break;case 38:e.preventDefault(),this.prev();break;case 40:e.prevent
 Default(),this.next()}e.stopPropagation()},keydown:function(t){this.suppressKeyPressRepeat=!~e.inArray(t.keyCode,[40,38,9,13,27]),this.move(t)},keypress:function(e){if(this.suppressKeyPressRepeat)return;this.move(e)},keyup:function(e){switch(e.keyCode){case 40:case 38:break;case 9:case 13:if(!this.shown)return;this.select();break;case 27:if(!this.shown)return;this.hide();break;default:this.lookup()}e.stopPropagation(),e.preventDefault()},blur:function(e){var t=this;setTimeout(function(){t.hide()},150)},click:function(e){e.stopPropagation(),e.preventDefault(),this.select()},mouseenter:function(t){this.$menu.find(".active").removeClass("active"),e(t.currentTarget).addClass("active")}},e.fn.typeahead=function(n){return this.each(function(){var r=e(this),i=r.data("typeahead"),s=typeof n=="object"&&n;i||r.data("typeahead",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.typeahead.defaults={source:[],items:8,menu:'<ul class="typeahead dropdown-menu"></ul>',item:'<li><a href="#"></a></l
 i>',minLength:1},e.fn.typeahead.Constructor=t,e(function(){e("body").on("focus.typeahead.data-api",'[data-provide="typeahead"]',function(t){var n=e(this);if(n.data("typeahead"))return;t.preventDefault(),n.typeahead(n.data())})})}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.options=e.extend({},e.fn.affix.defaults,n),this.$window=e(window).on("scroll.affix.data-api",e.proxy(this.checkPosition,this)),this.$element=e(t),this.checkPosition()};t.prototype.checkPosition=function(){if(!this.$element.is(":visible"))return;var t=e(document).height(),n=this.$window.scrollTop(),r=this.$element.offset(),i=this.options.offset,s=i.bottom,o=i.top,u="affix affix-top affix-bottom",a;typeof i!="object"&&(s=o=i),typeof o=="function"&&(o=i.top()),typeof s=="function"&&(s=i.bottom()),a=this.unpin!=null&&n+this.unpin<=r.top?!1:s!=null&&r.top+this.$element.height()>=t-s?"bottom":o!=null&&n<=o?"top":!1;if(this.affixed===a)return;this.affixed=a,this.unpin=a=="bottom"?r.top-n:null,this.$
 element.removeClass(u).addClass("affix"+(a?"-"+a:""))},e.fn.affix=function(n){return this.each(function(){var r=e(this),i=r.data("affix"),s=typeof n=="object"&&n;i||r.data("affix",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.affix.Constructor=t,e.fn.affix.defaults={offset:0},e(window).on("load",function(){e('[data-spy="affix"]').each(function(){var t=e(this),n=t.data();n.offset=n.offset||{},n.offsetBottom&&(n.offset.bottom=n.offsetBottom),n.offsetTop&&(n.offset.top=n.offsetTop),t.affix(n)})})}(window.jQuery);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/resources/org/apache/aurora/common/common/webassets/bootstrap/2.3.2/css/bootstrap-responsive.min.css
----------------------------------------------------------------------
diff --git a/commons/src/main/resources/org/apache/aurora/common/common/webassets/bootstrap/2.3.2/css/bootstrap-responsive.min.css b/commons/src/main/resources/org/apache/aurora/common/common/webassets/bootstrap/2.3.2/css/bootstrap-responsive.min.css
deleted file mode 100644
index 962ec7b..0000000
--- a/commons/src/main/resources/org/apache/aurora/common/common/webassets/bootstrap/2.3.2/css/bootstrap-responsive.min.css
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- */.clearfix{*zoom:1}.clearfix:before,.clearfix:after{display:table;line-height:0;content:""}.clearfix:after{clear:both}.hide-text{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.input-block-level{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}@-ms-viewport{width:device-width}.hidden{display:none;visibility:hidden}.visible-phone{display:none!important}.visible-tablet{display:none!important}.hidden-desktop{display:none!important}.visible-desktop{display:inherit!important}@media(min-width:768px) and (max-width:979px){.hidden-desktop{display:inherit!important}.visible-desktop{display:none!important}.visible-tablet{display:inherit!important}.hidden-tablet{display:none!important}}@media(max-width:767px){.hidden-desktop{display:inherit!important}.visible-desktop{display:none!important}.visible-phone{display:inherit!important}.hidden-phone{display:none!important}}.visible-print{dis
 play:none!important}@media print{.visible-print{display:inherit!important}.hidden-print{display:none!important}}@media(min-width:1200px){.row{margin-left:-30px;*zoom:1}.row:before,.row:after{display:table;line-height:0;content:""}.row:after{clear:both}[class*="span"]{float:left;min-height:1px;margin-left:30px}.container,.navbar-static-top .container,.navbar-fixed-top .container,.navbar-fixed-bottom .container{width:1170px}.span12{width:1170px}.span11{width:1070px}.span10{width:970px}.span9{width:870px}.span8{width:770px}.span7{width:670px}.span6{width:570px}.span5{width:470px}.span4{width:370px}.span3{width:270px}.span2{width:170px}.span1{width:70px}.offset12{margin-left:1230px}.offset11{margin-left:1130px}.offset10{margin-left:1030px}.offset9{margin-left:930px}.offset8{margin-left:830px}.offset7{margin-left:730px}.offset6{margin-left:630px}.offset5{margin-left:530px}.offset4{margin-left:430px}.offset3{margin-left:330px}.offset2{margin-left:230px}.offset1{margin-left:130px}.row-flui
 d{width:100%;*zoom:1}.row-fluid:before,.row-fluid:after{display:table;line-height:0;content:""}.row-fluid:after{clear:both}.row-fluid [class*="span"]{display:block;float:left;width:100%;min-height:30px;margin-left:2.564102564102564%;*margin-left:2.5109110747408616%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.row-fluid [class*="span"]:first-child{margin-left:0}.row-fluid .controls-row [class*="span"]+[class*="span"]{margin-left:2.564102564102564%}.row-fluid .span12{width:100%;*width:99.94680851063829%}.row-fluid .span11{width:91.45299145299145%;*width:91.39979996362975%}.row-fluid .span10{width:82.90598290598291%;*width:82.8527914166212%}.row-fluid .span9{width:74.35897435897436%;*width:74.30578286961266%}.row-fluid .span8{width:65.81196581196582%;*width:65.75877432260411%}.row-fluid .span7{width:57.26495726495726%;*width:57.21176577559556%}.row-fluid .span6{width:48.717948717948715%;*width:48.664757228587014%}.row-fluid .span5{width:40.17094017094
 017%;*width:40.11774868157847%}.row-fluid .span4{width:31.623931623931625%;*width:31.570740134569924%}.row-fluid .span3{width:23.076923076923077%;*width:23.023731587561375%}.row-fluid .span2{width:14.52991452991453%;*width:14.476723040552828%}.row-fluid .span1{width:5.982905982905983%;*width:5.929714493544281%}.row-fluid .offset12{margin-left:105.12820512820512%;*margin-left:105.02182214948171%}.row-fluid .offset12:first-child{margin-left:102.56410256410257%;*margin-left:102.45771958537915%}.row-fluid .offset11{margin-left:96.58119658119658%;*margin-left:96.47481360247316%}.row-fluid .offset11:first-child{margin-left:94.01709401709402%;*margin-left:93.91071103837061%}.row-fluid .offset10{margin-left:88.03418803418803%;*margin-left:87.92780505546462%}.row-fluid .offset10:first-child{margin-left:85.47008547008548%;*margin-left:85.36370249136206%}.row-fluid .offset9{margin-left:79.48717948717949%;*margin-left:79.38079650845607%}.row-fluid .offset9:first-child{margin-left:76.92307692307
 693%;*margin-left:76.81669394435352%}.row-fluid .offset8{margin-left:70.94017094017094%;*margin-left:70.83378796144753%}.row-fluid .offset8:first-child{margin-left:68.37606837606839%;*margin-left:68.26968539734497%}.row-fluid .offset7{margin-left:62.393162393162385%;*margin-left:62.28677941443899%}.row-fluid .offset7:first-child{margin-left:59.82905982905982%;*margin-left:59.72267685033642%}.row-fluid .offset6{margin-left:53.84615384615384%;*margin-left:53.739770867430444%}.row-fluid .offset6:first-child{margin-left:51.28205128205128%;*margin-left:51.175668303327875%}.row-fluid .offset5{margin-left:45.299145299145295%;*margin-left:45.1927623204219%}.row-fluid .offset5:first-child{margin-left:42.73504273504273%;*margin-left:42.62865975631933%}.row-fluid .offset4{margin-left:36.75213675213675%;*margin-left:36.645753773413354%}.row-fluid .offset4:first-child{margin-left:34.18803418803419%;*margin-left:34.081651209310785%}.row-fluid .offset3{margin-left:28.205128205128204%;*margin-left:
 28.0987452264048%}.row-fluid .offset3:first-child{margin-left:25.641025641025642%;*margin-left:25.53464266230224%}.row-fluid .offset2{margin-left:19.65811965811966%;*margin-left:19.551736679396257%}.row-fluid .offset2:first-child{margin-left:17.094017094017094%;*margin-left:16.98763411529369%}.row-fluid .offset1{margin-left:11.11111111111111%;*margin-left:11.004728132387708%}.row-fluid .offset1:first-child{margin-left:8.547008547008547%;*margin-left:8.440625568285142%}input,textarea,.uneditable-input{margin-left:0}.controls-row [class*="span"]+[class*="span"]{margin-left:30px}input.span12,textarea.span12,.uneditable-input.span12{width:1156px}input.span11,textarea.span11,.uneditable-input.span11{width:1056px}input.span10,textarea.span10,.uneditable-input.span10{width:956px}input.span9,textarea.span9,.uneditable-input.span9{width:856px}input.span8,textarea.span8,.uneditable-input.span8{width:756px}input.span7,textarea.span7,.uneditable-input.span7{width:656px}input.span6,textarea.span
 6,.uneditable-input.span6{width:556px}input.span5,textarea.span5,.uneditable-input.span5{width:456px}input.span4,textarea.span4,.uneditable-input.span4{width:356px}input.span3,textarea.span3,.uneditable-input.span3{width:256px}input.span2,textarea.span2,.uneditable-input.span2{width:156px}input.span1,textarea.span1,.uneditable-input.span1{width:56px}.thumbnails{margin-left:-30px}.thumbnails>li{margin-left:30px}.row-fluid .thumbnails{margin-left:0}}@media(min-width:768px) and (max-width:979px){.row{margin-left:-20px;*zoom:1}.row:before,.row:after{display:table;line-height:0;content:""}.row:after{clear:both}[class*="span"]{float:left;min-height:1px;margin-left:20px}.container,.navbar-static-top .container,.navbar-fixed-top .container,.navbar-fixed-bottom .container{width:724px}.span12{width:724px}.span11{width:662px}.span10{width:600px}.span9{width:538px}.span8{width:476px}.span7{width:414px}.span6{width:352px}.span5{width:290px}.span4{width:228px}.span3{width:166px}.span2{width:104px
 }.span1{width:42px}.offset12{margin-left:764px}.offset11{margin-left:702px}.offset10{margin-left:640px}.offset9{margin-left:578px}.offset8{margin-left:516px}.offset7{margin-left:454px}.offset6{margin-left:392px}.offset5{margin-left:330px}.offset4{margin-left:268px}.offset3{margin-left:206px}.offset2{margin-left:144px}.offset1{margin-left:82px}.row-fluid{width:100%;*zoom:1}.row-fluid:before,.row-fluid:after{display:table;line-height:0;content:""}.row-fluid:after{clear:both}.row-fluid [class*="span"]{display:block;float:left;width:100%;min-height:30px;margin-left:2.7624309392265194%;*margin-left:2.709239449864817%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.row-fluid [class*="span"]:first-child{margin-left:0}.row-fluid .controls-row [class*="span"]+[class*="span"]{margin-left:2.7624309392265194%}.row-fluid .span12{width:100%;*width:99.94680851063829%}.row-fluid .span11{width:91.43646408839778%;*width:91.38327259903608%}.row-fluid .span10{width:82.87
 292817679558%;*width:82.81973668743387%}.row-fluid .span9{width:74.30939226519337%;*width:74.25620077583166%}.row-fluid .span8{width:65.74585635359117%;*width:65.69266486422946%}.row-fluid .span7{width:57.18232044198895%;*width:57.12912895262725%}.row-fluid .span6{width:48.61878453038674%;*width:48.56559304102504%}.row-fluid .span5{width:40.05524861878453%;*width:40.00205712942283%}.row-fluid .span4{width:31.491712707182323%;*width:31.43852121782062%}.row-fluid .span3{width:22.92817679558011%;*width:22.87498530621841%}.row-fluid .span2{width:14.3646408839779%;*width:14.311449394616199%}.row-fluid .span1{width:5.801104972375691%;*width:5.747913483013988%}.row-fluid .offset12{margin-left:105.52486187845304%;*margin-left:105.41847889972962%}.row-fluid .offset12:first-child{margin-left:102.76243093922652%;*margin-left:102.6560479605031%}.row-fluid .offset11{margin-left:96.96132596685082%;*margin-left:96.8549429881274%}.row-fluid .offset11:first-child{margin-left:94.1988950276243%;*margi
 n-left:94.09251204890089%}.row-fluid .offset10{margin-left:88.39779005524862%;*margin-left:88.2914070765252%}.row-fluid .offset10:first-child{margin-left:85.6353591160221%;*margin-left:85.52897613729868%}.row-fluid .offset9{margin-left:79.8342541436464%;*margin-left:79.72787116492299%}.row-fluid .offset9:first-child{margin-left:77.07182320441989%;*margin-left:76.96544022569647%}.row-fluid .offset8{margin-left:71.2707182320442%;*margin-left:71.16433525332079%}.row-fluid .offset8:first-child{margin-left:68.50828729281768%;*margin-left:68.40190431409427%}.row-fluid .offset7{margin-left:62.70718232044199%;*margin-left:62.600799341718584%}.row-fluid .offset7:first-child{margin-left:59.94475138121547%;*margin-left:59.838368402492065%}.row-fluid .offset6{margin-left:54.14364640883978%;*margin-left:54.037263430116376%}.row-fluid .offset6:first-child{margin-left:51.38121546961326%;*margin-left:51.27483249088986%}.row-fluid .offset5{margin-left:45.58011049723757%;*margin-left:45.4737275185141
 7%}.row-fluid .offset5:first-child{margin-left:42.81767955801105%;*margin-left:42.71129657928765%}.row-fluid .offset4{margin-left:37.01657458563536%;*margin-left:36.91019160691196%}.row-fluid .offset4:first-child{margin-left:34.25414364640884%;*margin-left:34.14776066768544%}.row-fluid .offset3{margin-left:28.45303867403315%;*margin-left:28.346655695309746%}.row-fluid .offset3:first-child{margin-left:25.69060773480663%;*margin-left:25.584224756083227%}.row-fluid .offset2{margin-left:19.88950276243094%;*margin-left:19.783119783707537%}.row-fluid .offset2:first-child{margin-left:17.12707182320442%;*margin-left:17.02068884448102%}.row-fluid .offset1{margin-left:11.32596685082873%;*margin-left:11.219583872105325%}.row-fluid .offset1:first-child{margin-left:8.56353591160221%;*margin-left:8.457152932878806%}input,textarea,.uneditable-input{margin-left:0}.controls-row [class*="span"]+[class*="span"]{margin-left:20px}input.span12,textarea.span12,.uneditable-input.span12{width:710px}input.sp
 an11,textarea.span11,.uneditable-input.span11{width:648px}input.span10,textarea.span10,.uneditable-input.span10{width:586px}input.span9,textarea.span9,.uneditable-input.span9{width:524px}input.span8,textarea.span8,.uneditable-input.span8{width:462px}input.span7,textarea.span7,.uneditable-input.span7{width:400px}input.span6,textarea.span6,.uneditable-input.span6{width:338px}input.span5,textarea.span5,.uneditable-input.span5{width:276px}input.span4,textarea.span4,.uneditable-input.span4{width:214px}input.span3,textarea.span3,.uneditable-input.span3{width:152px}input.span2,textarea.span2,.uneditable-input.span2{width:90px}input.span1,textarea.span1,.uneditable-input.span1{width:28px}}@media(max-width:767px){body{padding-right:20px;padding-left:20px}.navbar-fixed-top,.navbar-fixed-bottom,.navbar-static-top{margin-right:-20px;margin-left:-20px}.container-fluid{padding:0}.dl-horizontal dt{float:none;width:auto;clear:none;text-align:left}.dl-horizontal dd{margin-left:0}.container{width:aut
 o}.row-fluid{width:100%}.row,.thumbnails{margin-left:0}.thumbnails>li{float:none;margin-left:0}[class*="span"],.uneditable-input[class*="span"],.row-fluid [class*="span"]{display:block;float:none;width:100%;margin-left:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.span12,.row-fluid .span12{width:100%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.row-fluid [class*="offset"]:first-child{margin-left:0}.input-large,.input-xlarge,.input-xxlarge,input[class*="span"],select[class*="span"],textarea[class*="span"],.uneditable-input{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.input-prepend input,.input-append input,.input-prepend input[class*="span"],.input-append input[class*="span"]{display:inline-block;width:auto}.controls-row [class*="span"]+[class*="span"]{margin-left:0}.modal{position:fixed;top:20px;right:20px;left:20px;width:auto;margin:0}.m
 odal.fade{top:-100px}.modal.fade.in{top:20px}}@media(max-width:480px){.nav-collapse{-webkit-transform:translate3d(0,0,0)}.page-header h1 small{display:block;line-height:20px}input[type="checkbox"],input[type="radio"]{border:1px solid #ccc}.form-horizontal .control-label{float:none;width:auto;padding-top:0;text-align:left}.form-horizontal .controls{margin-left:0}.form-horizontal .control-list{padding-top:0}.form-horizontal .form-actions{padding-right:10px;padding-left:10px}.media .pull-left,.media .pull-right{display:block;float:none;margin-bottom:10px}.media-object{margin-right:0;margin-left:0}.modal{top:10px;right:10px;left:10px}.modal-header .close{padding:10px;margin:-10px}.carousel-caption{position:static}}@media(max-width:979px){body{padding-top:0}.navbar-fixed-top,.navbar-fixed-bottom{position:static}.navbar-fixed-top{margin-bottom:20px}.navbar-fixed-bottom{margin-top:20px}.navbar-fixed-top .navbar-inner,.navbar-fixed-bottom .navbar-inner{padding:5px}.navbar .container{width:a
 uto;padding:0}.navbar .brand{padding-right:10px;padding-left:10px;margin:0 0 0 -5px}.nav-collapse{clear:both}.nav-collapse .nav{float:none;margin:0 0 10px}.nav-collapse .nav>li{float:none}.nav-collapse .nav>li>a{margin-bottom:2px}.nav-collapse .nav>.divider-vertical{display:none}.nav-collapse .nav .nav-header{color:#777;text-shadow:none}.nav-collapse .nav>li>a,.nav-collapse .dropdown-menu a{padding:9px 15px;font-weight:bold;color:#777;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.nav-collapse .btn{padding:4px 10px 4px;font-weight:normal;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.nav-collapse .dropdown-menu li+li a{margin-bottom:2px}.nav-collapse .nav>li>a:hover,.nav-collapse .nav>li>a:focus,.nav-collapse .dropdown-menu a:hover,.nav-collapse .dropdown-menu a:focus{background-color:#f2f2f2}.navbar-inverse .nav-collapse .nav>li>a,.navbar-inverse .nav-collapse .dropdown-menu a{color:#999}.navbar-inverse .nav-collapse .nav>li>a:hover,.navbar
 -inverse .nav-collapse .nav>li>a:focus,.navbar-inverse .nav-collapse .dropdown-menu a:hover,.navbar-inverse .nav-collapse .dropdown-menu a:focus{background-color:#111}.nav-collapse.in .btn-group{padding:0;margin-top:5px}.nav-collapse .dropdown-menu{position:static;top:auto;left:auto;display:none;float:none;max-width:none;padding:0;margin:0 15px;background-color:transparent;border:0;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.nav-collapse .open>.dropdown-menu{display:block}.nav-collapse .dropdown-menu:before,.nav-collapse .dropdown-menu:after{display:none}.nav-collapse .dropdown-menu .divider{display:none}.nav-collapse .nav>li>.dropdown-menu:before,.nav-collapse .nav>li>.dropdown-menu:after{display:none}.nav-collapse .navbar-form,.nav-collapse .navbar-search{float:none;padding:10px 15px;margin:10px 0;border-top:1px solid #f2f2f2;border-bottom:1px solid #f2f2f2;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,
 255,0.1),0 1px 0 rgba(255,255,255,0.1);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.1);box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.1)}.navbar-inverse .nav-collapse .navbar-form,.navbar-inverse .nav-collapse .navbar-search{border-top-color:#111;border-bottom-color:#111}.navbar .nav-collapse .nav.pull-right{float:none;margin-left:0}.nav-collapse,.nav-collapse.collapse{height:0;overflow:hidden}.navbar .btn-navbar{display:block}.navbar-static .navbar-inner{padding-right:10px;padding-left:10px}}@media(min-width:980px){.nav-collapse.collapse{height:auto!important;overflow:visible!important}}


[06/21] aurora git commit: Remove unused classes from commons fork.

Posted by wf...@apache.org.
http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/resources/org/apache/aurora/common/common/webassets/jquery/js/jquery-1.8.2.min.js
----------------------------------------------------------------------
diff --git a/commons/src/main/resources/org/apache/aurora/common/common/webassets/jquery/js/jquery-1.8.2.min.js b/commons/src/main/resources/org/apache/aurora/common/common/webassets/jquery/js/jquery-1.8.2.min.js
deleted file mode 100644
index 9b43f61..0000000
--- a/commons/src/main/resources/org/apache/aurora/common/common/webassets/jquery/js/jquery-1.8.2.min.js
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*! jQuery v1.8.2 jquery.com | jquery.org/license */
-(function(a,b){function G(a){var b=F[a]={};return p.each(a.split(s),function(a,c){b[c]=!0}),b}function J(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(I,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:+d+""===d?+d:H.test(d)?p.parseJSON(d):d}catch(f){}p.data(a,c,d)}else d=b}return d}function K(a){var b;for(b in a){if(b==="data"&&p.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function ba(){return!1}function bb(){return!0}function bh(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function bi(a,b){do a=a[b];while(a&&a.nodeType!==1);return a}function bj(a,b,c){b=b||0;if(p.isFunction(b))return p.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return p.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=p.grep(a,function(a){return a.nodeType===1});if(be.test(b))return p.filter(b,d,!c);b=p.filter(b,d)}return p.grep(a,function(a,d){return p.inArray(
 a,b)>=0===c})}function bk(a){var b=bl.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function bC(a,b){return a.getElementsByTagName(b)[0]||a.appendChild(a.ownerDocument.createElement(b))}function bD(a,b){if(b.nodeType!==1||!p.hasData(a))return;var c,d,e,f=p._data(a),g=p._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;d<e;d++)p.event.add(b,c,h[c][d])}g.data&&(g.data=p.extend({},g.data))}function bE(a,b){var c;if(b.nodeType!==1)return;b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase(),c==="object"?(b.parentNode&&(b.outerHTML=a.outerHTML),p.support.html5Clone&&a.innerHTML&&!p.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):c==="input"&&bv.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):c==="option"?b.selected=a.defaultSelected:c==="input"||c==="textarea"?b.defaultValue=a.defaultValue:c==="scri
 pt"&&b.text!==a.text&&(b.text=a.text),b.removeAttribute(p.expando)}function bF(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bG(a){bv.test(a.type)&&(a.defaultChecked=a.checked)}function bY(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=bW.length;while(e--){b=bW[e]+c;if(b in a)return b}return d}function bZ(a,b){return a=b||a,p.css(a,"display")==="none"||!p.contains(a.ownerDocument,a)}function b$(a,b){var c,d,e=[],f=0,g=a.length;for(;f<g;f++){c=a[f];if(!c.style)continue;e[f]=p._data(c,"olddisplay"),b?(!e[f]&&c.style.display==="none"&&(c.style.display=""),c.style.display===""&&bZ(c)&&(e[f]=p._data(c,"olddisplay",cc(c.nodeName)))):(d=bH(c,"display"),!e[f]&&d!=="none"&&p._data(c,"olddisplay",d))}for(f=0;f<g;f++){c=a[f];if(!c.style)continue;if(!b||c.style.display==="none"||c.style.display==="")c.style.display=b?e[f]||"":"none"}return a}function b_(a,b,c){
 var d=bP.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function ca(a,b,c,d){var e=c===(d?"border":"content")?4:b==="width"?1:0,f=0;for(;e<4;e+=2)c==="margin"&&(f+=p.css(a,c+bV[e],!0)),d?(c==="content"&&(f-=parseFloat(bH(a,"padding"+bV[e]))||0),c!=="margin"&&(f-=parseFloat(bH(a,"border"+bV[e]+"Width"))||0)):(f+=parseFloat(bH(a,"padding"+bV[e]))||0,c!=="padding"&&(f+=parseFloat(bH(a,"border"+bV[e]+"Width"))||0));return f}function cb(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=!0,f=p.support.boxSizing&&p.css(a,"boxSizing")==="border-box";if(d<=0||d==null){d=bH(a,b);if(d<0||d==null)d=a.style[b];if(bQ.test(d))return d;e=f&&(p.support.boxSizingReliable||d===a.style[b]),d=parseFloat(d)||0}return d+ca(a,b,c||(f?"border":"content"),e)+"px"}function cc(a){if(bS[a])return bS[a];var b=p("<"+a+">").appendTo(e.body),c=b.css("display");b.remove();if(c==="none"||c===""){bI=e.body.appendChild(bI||p.extend(e.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!bJ||!bI.
 createElement)bJ=(bI.contentWindow||bI.contentDocument).document,bJ.write("<!doctype html><html><body>"),bJ.close();b=bJ.body.appendChild(bJ.createElement(a)),c=bH(b,"display"),e.body.removeChild(bI)}return bS[a]=c,c}function ci(a,b,c,d){var e;if(p.isArray(b))p.each(b,function(b,e){c||ce.test(a)?d(a,e):ci(a+"["+(typeof e=="object"?b:"")+"]",e,c,d)});else if(!c&&p.type(b)==="object")for(e in b)ci(a+"["+e+"]",b[e],c,d);else d(a,b)}function cz(a){return function(b,c){typeof b!="string"&&(c=b,b="*");var d,e,f,g=b.toLowerCase().split(s),h=0,i=g.length;if(p.isFunction(c))for(;h<i;h++)d=g[h],f=/^\+/.test(d),f&&(d=d.substr(1)||"*"),e=a[d]=a[d]||[],e[f?"unshift":"push"](c)}}function cA(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h,i=a[f],j=0,k=i?i.length:0,l=a===cv;for(;j<k&&(l||!h);j++)h=i[j](c,d,e),typeof h=="string"&&(!l||g[h]?h=b:(c.dataTypes.unshift(h),h=cA(a,c,d,e,h,g)));return(l||!h)&&!g["*"]&&(h=cA(a,c,d,e,"*",g)),h}function cB(a,c){var d,e,f=p.ajaxSettings.flatOptions||{};f
 or(d in c)c[d]!==b&&((f[d]?a:e||(e={}))[d]=c[d]);e&&p.extend(!0,a,e)}function cC(a,c,d){var e,f,g,h,i=a.contents,j=a.dataTypes,k=a.responseFields;for(f in k)f in d&&(c[k[f]]=d[f]);while(j[0]==="*")j.shift(),e===b&&(e=a.mimeType||c.getResponseHeader("content-type"));if(e)for(f in i)if(i[f]&&i[f].test(e)){j.unshift(f);break}if(j[0]in d)g=j[0];else{for(f in d){if(!j[0]||a.converters[f+" "+j[0]]){g=f;break}h||(h=f)}g=g||h}if(g)return g!==j[0]&&j.unshift(g),d[g]}function cD(a,b){var c,d,e,f,g=a.dataTypes.slice(),h=g[0],i={},j=0;a.dataFilter&&(b=a.dataFilter(b,a.dataType));if(g[1])for(c in a.converters)i[c.toLowerCase()]=a.converters[c];for(;e=g[++j];)if(e!=="*"){if(h!=="*"&&h!==e){c=i[h+" "+e]||i["* "+e];if(!c)for(d in i){f=d.split(" ");if(f[1]===e){c=i[h+" "+f[0]]||i["* "+f[0]];if(c){c===!0?c=i[d]:i[d]!==!0&&(e=f[0],g.splice(j--,0,e));break}}}if(c!==!0)if(c&&a["throws"])b=c(b);else try{b=c(b)}catch(k){return{state:"parsererror",error:c?k:"No conversion from "+h+" to "+e}}}h=e}return{sta
 te:"success",data:b}}function cL(){try{return new a.XMLHttpRequest}catch(b){}}function cM(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function cU(){return setTimeout(function(){cN=b},0),cN=p.now()}function cV(a,b){p.each(b,function(b,c){var d=(cT[b]||[]).concat(cT["*"]),e=0,f=d.length;for(;e<f;e++)if(d[e].call(a,b,c))return})}function cW(a,b,c){var d,e=0,f=0,g=cS.length,h=p.Deferred().always(function(){delete i.elem}),i=function(){var b=cN||cU(),c=Math.max(0,j.startTime+j.duration-b),d=1-(c/j.duration||0),e=0,f=j.tweens.length;for(;e<f;e++)j.tweens[e].run(d);return h.notifyWith(a,[j,d,c]),d<1&&f?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:p.extend({},b),opts:p.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:cN||cU(),duration:c.duration,tweens:[],createTween:function(b,c,d){var e=p.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(e),e},stop:function(b){var c=0,d=b?j.tweens.length:0;for(;c<
 d;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;cX(k,j.opts.specialEasing);for(;e<g;e++){d=cS[e].call(j,a,k,j.opts);if(d)return d}return cV(j,k),p.isFunction(j.opts.start)&&j.opts.start.call(a,j),p.fx.timer(p.extend(i,{anim:j,queue:j.opts.queue,elem:a})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}function cX(a,b){var c,d,e,f,g;for(c in a){d=p.camelCase(c),e=b[d],f=a[c],p.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=p.cssHooks[d];if(g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}}function cY(a,b,c){var d,e,f,g,h,i,j,k,l=this,m=a.style,n={},o=[],q=a.nodeType&&bZ(a);c.queue||(j=p._queueHooks(a,"fx"),j.unqueued==null&&(j.unqueued=0,k=j.empty.fire,j.empty.fire=function(){j.unqueued||k()}),j.unqueued++,l.always(function(){l.always(function(){j.unqueued--,p.queue(a,"fx").length||j.empty.fire()})})),a.nodeType===1&&("heig
 ht"in b||"width"in b)&&(c.overflow=[m.overflow,m.overflowX,m.overflowY],p.css(a,"display")==="inline"&&p.css(a,"float")==="none"&&(!p.support.inlineBlockNeedsLayout||cc(a.nodeName)==="inline"?m.display="inline-block":m.zoom=1)),c.overflow&&(m.overflow="hidden",p.support.shrinkWrapBlocks||l.done(function(){m.overflow=c.overflow[0],m.overflowX=c.overflow[1],m.overflowY=c.overflow[2]}));for(d in b){f=b[d];if(cP.exec(f)){delete b[d];if(f===(q?"hide":"show"))continue;o.push(d)}}g=o.length;if(g){h=p._data(a,"fxshow")||p._data(a,"fxshow",{}),q?p(a).show():l.done(function(){p(a).hide()}),l.done(function(){var b;p.removeData(a,"fxshow",!0);for(b in n)p.style(a,b,n[b])});for(d=0;d<g;d++)e=o[d],i=l.createTween(e,q?h[e]:0),n[e]=h[e]||p.style(a,e),e in h||(h[e]=i.start,q&&(i.end=i.start,i.start=e==="width"||e==="height"?1:0))}}function cZ(a,b,c,d,e){return new cZ.prototype.init(a,b,c,d,e)}function c$(a,b){var c,d={height:a},e=0;b=b?1:0;for(;e<4;e+=2-b)c=bV[e],d["margin"+c]=d["padding"+c]=a;retur
 n b&&(d.opacity=d.width=a),d}function da(a){return p.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}var c,d,e=a.document,f=a.location,g=a.navigator,h=a.jQuery,i=a.$,j=Array.prototype.push,k=Array.prototype.slice,l=Array.prototype.indexOf,m=Object.prototype.toString,n=Object.prototype.hasOwnProperty,o=String.prototype.trim,p=function(a,b){return new p.fn.init(a,b,c)},q=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,r=/\S/,s=/\s+/,t=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,u=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^[\],:{}\s]*$/,x=/(?:^|:|,)(?:\s*\[)+/g,y=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,z=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,A=/^-ms-/,B=/-([\da-z])/gi,C=function(a,b){return(b+"").toUpperCase()},D=function(){e.addEventListener?(e.removeEventListener("DOMContentLoaded",D,!1),p.ready()):e.readyState==="complete"&&(e.detachEvent("onreadystatechange",D),p.ready())},E={};p.fn=p.prototype={constructor:p,init
 :function(a,c,d){var f,g,h,i;if(!a)return this;if(a.nodeType)return this.context=this[0]=a,this.length=1,this;if(typeof a=="string"){a.charAt(0)==="<"&&a.charAt(a.length-1)===">"&&a.length>=3?f=[null,a,null]:f=u.exec(a);if(f&&(f[1]||!c)){if(f[1])return c=c instanceof p?c[0]:c,i=c&&c.nodeType?c.ownerDocument||c:e,a=p.parseHTML(f[1],i,!0),v.test(f[1])&&p.isPlainObject(c)&&this.attr.call(a,c,!0),p.merge(this,a);g=e.getElementById(f[2]);if(g&&g.parentNode){if(g.id!==f[2])return d.find(a);this.length=1,this[0]=g}return this.context=e,this.selector=a,this}return!c||c.jquery?(c||d).find(a):this.constructor(c).find(a)}return p.isFunction(a)?d.ready(a):(a.selector!==b&&(this.selector=a.selector,this.context=a.context),p.makeArray(a,this))},selector:"",jquery:"1.8.2",length:0,size:function(){return this.length},toArray:function(){return k.call(this)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=p.merge(this.constructor(),a);ret
 urn d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")"),d},each:function(a,b){return p.each(this,a,b)},ready:function(a){return p.ready.promise().done(a),this},eq:function(a){return a=+a,a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(k.apply(this,arguments),"slice",k.call(arguments).join(","))},map:function(a){return this.pushStack(p.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:j,sort:[].sort,splice:[].splice},p.fn.init.prototype=p.fn,p.extend=p.fn.extend=function(){var a,c,d,e,f,g,h=arguments[0]||{},i=1,j=arguments.length,k=!1;typeof h=="boolean"&&(k=h,h=arguments[1]||{},i=2),typeof h!="object"&&!p.isFunction(h)&&(h={}),j===i&&(h=this,--i);for(;i<j;i++)if((a=arguments[i])!=null)for(c in a){d=h[c],e=a[c];if(h===e)con
 tinue;k&&e&&(p.isPlainObject(e)||(f=p.isArray(e)))?(f?(f=!1,g=d&&p.isArray(d)?d:[]):g=d&&p.isPlainObject(d)?d:{},h[c]=p.extend(k,g,e)):e!==b&&(h[c]=e)}return h},p.extend({noConflict:function(b){return a.$===p&&(a.$=i),b&&a.jQuery===p&&(a.jQuery=h),p},isReady:!1,readyWait:1,holdReady:function(a){a?p.readyWait++:p.ready(!0)},ready:function(a){if(a===!0?--p.readyWait:p.isReady)return;if(!e.body)return setTimeout(p.ready,1);p.isReady=!0;if(a!==!0&&--p.readyWait>0)return;d.resolveWith(e,[p]),p.fn.trigger&&p(e).trigger("ready").off("ready")},isFunction:function(a){return p.type(a)==="function"},isArray:Array.isArray||function(a){return p.type(a)==="array"},isWindow:function(a){return a!=null&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):E[m.call(a)]||"object"},isPlainObject:function(a){if(!a||p.type(a)!=="object"||a.nodeType||p.isWindow(a))return!1;try{if(a.constructor&&!n.call(a,"constructor")&&!n.call(a.constructo
 r.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||n.call(a,d)},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},error:function(a){throw new Error(a)},parseHTML:function(a,b,c){var d;return!a||typeof a!="string"?null:(typeof b=="boolean"&&(c=b,b=0),b=b||e,(d=v.exec(a))?[b.createElement(d[1])]:(d=p.buildFragment([a],b,c?null:[]),p.merge([],(d.cacheable?p.clone(d.fragment):d.fragment).childNodes)))},parseJSON:function(b){if(!b||typeof b!="string")return null;b=p.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(w.test(b.replace(y,"@").replace(z,"]").replace(x,"")))return(new Function("return "+b))();p.error("Invalid JSON: "+b)},parseXML:function(c){var d,e;if(!c||typeof c!="string")return null;try{a.DOMParser?(e=new DOMParser,d=e.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(f){d=b}return(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&p.error(
 "Invalid XML: "+c),d},noop:function(){},globalEval:function(b){b&&r.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(A,"ms-").replace(B,C)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,c,d){var e,f=0,g=a.length,h=g===b||p.isFunction(a);if(d){if(h){for(e in a)if(c.apply(a[e],d)===!1)break}else for(;f<g;)if(c.apply(a[f++],d)===!1)break}else if(h){for(e in a)if(c.call(a[e],e,a[e])===!1)break}else for(;f<g;)if(c.call(a[f],f,a[f++])===!1)break;return a},trim:o&&!o.call(" ")?function(a){return a==null?"":o.call(a)}:function(a){return a==null?"":(a+"").replace(t,"")},makeArray:function(a,b){var c,d=b||[];return a!=null&&(c=p.type(a),a.length==null||c==="string"||c==="function"||c==="regexp"||p.isWindow(a)?j.call(d,a):p.merge(d,a)),d},inArray:function(a,b,c){var d;if(b){if(l)return l.call(b,a,c);d=b.length,c=c?c<0?Math.max(0,d+c):c:0;for(;c<d;c++)if(c in b&&b[c]===a)return c}return-
 1},merge:function(a,c){var d=c.length,e=a.length,f=0;if(typeof d=="number")for(;f<d;f++)a[e++]=c[f];else while(c[f]!==b)a[e++]=c[f++];return a.length=e,a},grep:function(a,b,c){var d,e=[],f=0,g=a.length;c=!!c;for(;f<g;f++)d=!!b(a[f],f),c!==d&&e.push(a[f]);return e},map:function(a,c,d){var e,f,g=[],h=0,i=a.length,j=a instanceof p||i!==b&&typeof i=="number"&&(i>0&&a[0]&&a[i-1]||i===0||p.isArray(a));if(j)for(;h<i;h++)e=c(a[h],h,d),e!=null&&(g[g.length]=e);else for(f in a)e=c(a[f],f,d),e!=null&&(g[g.length]=e);return g.concat.apply([],g)},guid:1,proxy:function(a,c){var d,e,f;return typeof c=="string"&&(d=a[c],c=a,a=d),p.isFunction(a)?(e=k.call(arguments,2),f=function(){return a.apply(c,e.concat(k.call(arguments)))},f.guid=a.guid=a.guid||p.guid++,f):b},access:function(a,c,d,e,f,g,h){var i,j=d==null,k=0,l=a.length;if(d&&typeof d=="object"){for(k in d)p.access(a,c,k,d[k],1,g,e);f=1}else if(e!==b){i=h===b&&p.isFunction(e),j&&(i?(i=c,c=function(a,b,c){return i.call(p(a),c)}):(c.call(a,e),c=nu
 ll));if(c)for(;k<l;k++)c(a[k],d,i?e.call(a[k],k,c(a[k],d)):e,h);f=1}return f?a:j?c.call(a):l?c(a[0],d):g},now:function(){return(new Date).getTime()}}),p.ready.promise=function(b){if(!d){d=p.Deferred();if(e.readyState==="complete")setTimeout(p.ready,1);else if(e.addEventListener)e.addEventListener("DOMContentLoaded",D,!1),a.addEventListener("load",p.ready,!1);else{e.attachEvent("onreadystatechange",D),a.attachEvent("onload",p.ready);var c=!1;try{c=a.frameElement==null&&e.documentElement}catch(f){}c&&c.doScroll&&function g(){if(!p.isReady){try{c.doScroll("left")}catch(a){return setTimeout(g,50)}p.ready()}}()}}return d.promise(b)},p.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){E["[object "+b+"]"]=b.toLowerCase()}),c=p(e);var F={};p.Callbacks=function(a){a=typeof a=="string"?F[a]||G(a):p.extend({},a);var c,d,e,f,g,h,i=[],j=!a.once&&[],k=function(b){c=a.memory&&b,d=!0,h=f||0,f=0,g=i.length,e=!0;for(;i&&h<g;h++)if(i[h].apply(b[0],b[1])===!1&&a.st
 opOnFalse){c=!1;break}e=!1,i&&(j?j.length&&k(j.shift()):c?i=[]:l.disable())},l={add:function(){if(i){var b=i.length;(function d(b){p.each(b,function(b,c){var e=p.type(c);e==="function"&&(!a.unique||!l.has(c))?i.push(c):c&&c.length&&e!=="string"&&d(c)})})(arguments),e?g=i.length:c&&(f=b,k(c))}return this},remove:function(){return i&&p.each(arguments,function(a,b){var c;while((c=p.inArray(b,i,c))>-1)i.splice(c,1),e&&(c<=g&&g--,c<=h&&h--)}),this},has:function(a){return p.inArray(a,i)>-1},empty:function(){return i=[],this},disable:function(){return i=j=c=b,this},disabled:function(){return!i},lock:function(){return j=b,c||l.disable(),this},locked:function(){return!j},fireWith:function(a,b){return b=b||[],b=[a,b.slice?b.slice():b],i&&(!d||j)&&(e?j.push(b):k(b)),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!d}};return l},p.extend({Deferred:function(a){var b=[["resolve","done",p.Callbacks("once memory"),"resolved"],["reject","fail",p.Callbacks("once 
 memory"),"rejected"],["notify","progress",p.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return p.Deferred(function(c){p.each(b,function(b,d){var f=d[0],g=a[b];e[d[1]](p.isFunction(g)?function(){var a=g.apply(this,arguments);a&&p.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f+"With"](this===e?c:this,[a])}:c[f])}),a=null}).promise()},promise:function(a){return a!=null?p.extend(a,d):d}},e={};return d.pipe=d.then,p.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[a^1][2].disable,b[2][2].lock),e[f[0]]=g.fire,e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=k.call(arguments),d=c.length,e=d!==1||a&&p.isFunction(a.promise)?d:0,f=e===1?a:p.Deferred(),g=function(a,b,c){return function(d){b[a]=this,c[a]=arguments.length>1?k.call(arguments):d,c===h?f.notifyWith(b,c):--e||f
 .resolveWith(b,c)}},h,i,j;if(d>1){h=new Array(d),i=new Array(d),j=new Array(d);for(;b<d;b++)c[b]&&p.isFunction(c[b].promise)?c[b].promise().done(g(b,j,c)).fail(f.reject).progress(g(b,i,h)):--e}return e||f.resolveWith(j,c),f.promise()}}),p.support=function(){var b,c,d,f,g,h,i,j,k,l,m,n=e.createElement("div");n.setAttribute("className","t"),n.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",c=n.getElementsByTagName("*"),d=n.getElementsByTagName("a")[0],d.style.cssText="top:1px;float:left;opacity:.5";if(!c||!c.length)return{};f=e.createElement("select"),g=f.appendChild(e.createElement("option")),h=n.getElementsByTagName("input")[0],b={leadingWhitespace:n.firstChild.nodeType===3,tbody:!n.getElementsByTagName("tbody").length,htmlSerialize:!!n.getElementsByTagName("link").length,style:/top/.test(d.getAttribute("style")),hrefNormalized:d.getAttribute("href")==="/a",opacity:/^0.5/.test(d.style.opacity),cssFloat:!!d.style.cssFloat,checkOn:h.value==="on",optSelec
 ted:g.selected,getSetAttribute:n.className!=="t",enctype:!!e.createElement("form").enctype,html5Clone:e.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",boxModel:e.compatMode==="CSS1Compat",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},h.checked=!0,b.noCloneChecked=h.cloneNode(!0).checked,f.disabled=!0,b.optDisabled=!g.disabled;try{delete n.test}catch(o){b.deleteExpando=!1}!n.addEventListener&&n.attachEvent&&n.fireEvent&&(n.attachEvent("onclick",m=function(){b.noCloneEvent=!1}),n.cloneNode(!0).fireEvent("onclick"),n.detachEvent("onclick",m)),h=e.createElement("input"),h.value="t",h.setAttribute("type","radio"),b.radioValue=h.value==="t",h.setAttribute("checked","checked"),h.setAttribute("name","t"),n.appendChild(h),i=e.createDocumentFragment(),i.appendChild(n.lastChild),b.checkClone=i.cloneNode(!0).cloneNode(!0).lastChild.ch
 ecked,b.appendChecked=h.checked,i.removeChild(h),i.appendChild(n);if(n.attachEvent)for(k in{submit:!0,change:!0,focusin:!0})j="on"+k,l=j in n,l||(n.setAttribute(j,"return;"),l=typeof n[j]=="function"),b[k+"Bubbles"]=l;return p(function(){var c,d,f,g,h="padding:0;margin:0;border:0;display:block;overflow:hidden;",i=e.getElementsByTagName("body")[0];if(!i)return;c=e.createElement("div"),c.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",i.insertBefore(c,i.firstChild),d=e.createElement("div"),c.appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",f=d.getElementsByTagName("td"),f[0].style.cssText="padding:0;margin:0;border:0;display:none",l=f[0].offsetHeight===0,f[0].style.display="",f[1].style.display="none",b.reliableHiddenOffsets=l&&f[0].offsetHeight===0,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-t
 op:1%;position:absolute;top:1%;",b.boxSizing=d.offsetWidth===4,b.doesNotIncludeMarginInBodyOffset=i.offsetTop!==1,a.getComputedStyle&&(b.pixelPosition=(a.getComputedStyle(d,null)||{}).top!=="1%",b.boxSizingReliable=(a.getComputedStyle(d,null)||{width:"4px"}).width==="4px",g=e.createElement("div"),g.style.cssText=d.style.cssText=h,g.style.marginRight=g.style.width="0",d.style.width="1px",d.appendChild(g),b.reliableMarginRight=!parseFloat((a.getComputedStyle(g,null)||{}).marginRight)),typeof d.style.zoom!="undefined"&&(d.innerHTML="",d.style.cssText=h+"width:1px;padding:1px;display:inline;zoom:1",b.inlineBlockNeedsLayout=d.offsetWidth===3,d.style.display="block",d.style.overflow="visible",d.innerHTML="<div></div>",d.firstChild.style.width="5px",b.shrinkWrapBlocks=d.offsetWidth!==3,c.style.zoom=1),i.removeChild(c),c=d=f=g=null}),i.removeChild(n),c=d=f=g=h=i=n=null,b}();var H=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,I=/([A-Z])/g;p.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(p.fn.jquer
 y+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){return a=a.nodeType?p.cache[a[p.expando]]:a[p.expando],!!a&&!K(a)},data:function(a,c,d,e){if(!p.acceptData(a))return;var f,g,h=p.expando,i=typeof c=="string",j=a.nodeType,k=j?p.cache:a,l=j?a[h]:a[h]&&h;if((!l||!k[l]||!e&&!k[l].data)&&i&&d===b)return;l||(j?a[h]=l=p.deletedIds.pop()||p.guid++:l=h),k[l]||(k[l]={},j||(k[l].toJSON=p.noop));if(typeof c=="object"||typeof c=="function")e?k[l]=p.extend(k[l],c):k[l].data=p.extend(k[l].data,c);return f=k[l],e||(f.data||(f.data={}),f=f.data),d!==b&&(f[p.camelCase(c)]=d),i?(g=f[c],g==null&&(g=f[p.camelCase(c)])):g=f,g},removeData:function(a,b,c){if(!p.acceptData(a))return;var d,e,f,g=a.nodeType,h=g?p.cache:a,i=g?a[p.expando]:p.expando;if(!h[i])return;if(b){d=c?h[i]:h[i].data;if(d){p.isArray(b)||(b in d?b=[b]:(b=p.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,f=b.length;e<f;e++)delete d[b[e]];if(!(c?K:p.isEmp
 tyObject)(d))return}}if(!c){delete h[i].data;if(!K(h[i]))return}g?p.cleanData([a],!0):p.support.deleteExpando||h!=h.window?delete h[i]:h[i]=null},_data:function(a,b,c){return p.data(a,b,c,!0)},acceptData:function(a){var b=a.nodeName&&p.noData[a.nodeName.toLowerCase()];return!b||b!==!0&&a.getAttribute("classid")===b}}),p.fn.extend({data:function(a,c){var d,e,f,g,h,i=this[0],j=0,k=null;if(a===b){if(this.length){k=p.data(i);if(i.nodeType===1&&!p._data(i,"parsedAttrs")){f=i.attributes;for(h=f.length;j<h;j++)g=f[j].name,g.indexOf("data-")||(g=p.camelCase(g.substring(5)),J(i,g,k[g]));p._data(i,"parsedAttrs",!0)}}return k}return typeof a=="object"?this.each(function(){p.data(this,a)}):(d=a.split(".",2),d[1]=d[1]?"."+d[1]:"",e=d[1]+"!",p.access(this,function(c){if(c===b)return k=this.triggerHandler("getData"+e,[d[0]]),k===b&&i&&(k=p.data(i,a),k=J(i,a,k)),k===b&&d[1]?this.data(d[0]):k;d[1]=c,this.each(function(){var b=p(this);b.triggerHandler("setData"+e,d),p.data(this,a,c),b.triggerHandler(
 "changeData"+e,d)})},null,c,arguments.length>1,null,!1))},removeData:function(a){return this.each(function(){p.removeData(this,a)})}}),p.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=p._data(a,b),c&&(!d||p.isArray(c)?d=p._data(a,b,p.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=p.queue(a,b),d=c.length,e=c.shift(),f=p._queueHooks(a,b),g=function(){p.dequeue(a,b)};e==="inprogress"&&(e=c.shift(),d--),e&&(b==="fx"&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return p._data(a,c)||p._data(a,c,{empty:p.Callbacks("once memory").add(function(){p.removeData(a,b+"queue",!0),p.removeData(a,c,!0)})})}}),p.fn.extend({queue:function(a,c){var d=2;return typeof a!="string"&&(c=a,a="fx",d--),arguments.length<d?p.queue(this[0],a):c===b?this:this.each(function(){var b=p.queue(this,a,c);p._queueHooks(this,a),a==="fx"&&b[0]!=="inprogress"&&p.dequeue(this,a)})},dequeue:function(a)
 {return this.each(function(){p.dequeue(this,a)})},delay:function(a,b){return a=p.fx?p.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){var d,e=1,f=p.Deferred(),g=this,h=this.length,i=function(){--e||f.resolveWith(g,[g])};typeof a!="string"&&(c=a,a=b),a=a||"fx";while(h--)d=p._data(g[h],a+"queueHooks"),d&&d.empty&&(e++,d.empty.add(i));return i(),f.promise(c)}});var L,M,N,O=/[\t\r\n]/g,P=/\r/g,Q=/^(?:button|input)$/i,R=/^(?:button|input|object|select|textarea)$/i,S=/^a(?:rea|)$/i,T=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,U=p.support.getSetAttribute;p.fn.extend({attr:function(a,b){return p.access(this,p.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){p.removeAttr(this,a)})},prop:function(a,b){return p.access(this,p.prop,a,b,argume
 nts.length>1)},removeProp:function(a){return a=p.propFix[a]||a,this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,f,g,h;if(p.isFunction(a))return this.each(function(b){p(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(s);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{f=" "+e.className+" ";for(g=0,h=b.length;g<h;g++)f.indexOf(" "+b[g]+" ")<0&&(f+=b[g]+" ");e.className=p.trim(f)}}}return this},removeClass:function(a){var c,d,e,f,g,h,i;if(p.isFunction(a))return this.each(function(b){p(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(s);for(h=0,i=this.length;h<i;h++){e=this[h];if(e.nodeType===1&&e.className){d=(" "+e.className+" ").replace(O," ");for(f=0,g=c.length;f<g;f++)while(d.indexOf(" "+c[f]+" ")>=0)d=d.replace(" "+c[f]+" "," ");e.className=a?p.trim(d):""}}}return this},toggleClass:function
 (a,b){var c=typeof a,d=typeof b=="boolean";return p.isFunction(a)?this.each(function(c){p(this).toggleClass(a.call(this,c,this.className,b),b)}):this.each(function(){if(c==="string"){var e,f=0,g=p(this),h=b,i=a.split(s);while(e=i[f++])h=d?h:!g.hasClass(e),g[h?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&p._data(this,"__className__",this.className),this.className=this.className||a===!1?"":p._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(O," ").indexOf(b)>=0)return!0;return!1},val:function(a){var c,d,e,f=this[0];if(!arguments.length){if(f)return c=p.valHooks[f.type]||p.valHooks[f.nodeName.toLowerCase()],c&&"get"in c&&(d=c.get(f,"value"))!==b?d:(d=f.value,typeof d=="string"?d.replace(P,""):d==null?"":d);return}return e=p.isFunction(a),this.each(function(d){var f,g=p(this);if(this.nodeType!==1)return;e?f=a.call(this,d,g.val()):f=a,f=
 =null?f="":typeof f=="number"?f+="":p.isArray(f)&&(f=p.map(f,function(a){return a==null?"":a+""})),c=p.valHooks[this.type]||p.valHooks[this.nodeName.toLowerCase()];if(!c||!("set"in c)||c.set(this,f,"value")===b)this.value=f})}}),p.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,f=a.selectedIndex,g=[],h=a.options,i=a.type==="select-one";if(f<0)return null;c=i?f:0,d=i?f+1:h.length;for(;c<d;c++){e=h[c];if(e.selected&&(p.support.optDisabled?!e.disabled:e.getAttribute("disabled")===null)&&(!e.parentNode.disabled||!p.nodeName(e.parentNode,"optgroup"))){b=p(e).val();if(i)return b;g.push(b)}}return i&&!g.length&&h.length?p(h[f]).val():g},set:function(a,b){var c=p.makeArray(b);return p(a).find("option").each(function(){this.selected=p.inArray(p(this).val(),c)>=0}),c.length||(a.selectedIndex=-1),c}}},attrFn:{},attr:function(a,c,d,e){var f,g,h,i=a.nodeType;if(!a||i===3||i===8||i===2)return;if(e&&p.isF
 unction(p.fn[c]))return p(a)[c](d);if(typeof a.getAttribute=="undefined")return p.prop(a,c,d);h=i!==1||!p.isXMLDoc(a),h&&(c=c.toLowerCase(),g=p.attrHooks[c]||(T.test(c)?M:L));if(d!==b){if(d===null){p.removeAttr(a,c);return}return g&&"set"in g&&h&&(f=g.set(a,d,c))!==b?f:(a.setAttribute(c,d+""),d)}return g&&"get"in g&&h&&(f=g.get(a,c))!==null?f:(f=a.getAttribute(c),f===null?b:f)},removeAttr:function(a,b){var c,d,e,f,g=0;if(b&&a.nodeType===1){d=b.split(s);for(;g<d.length;g++)e=d[g],e&&(c=p.propFix[e]||e,f=T.test(e),f||p.attr(a,e,""),a.removeAttribute(U?e:c),f&&c in a&&(a[c]=!1))}},attrHooks:{type:{set:function(a,b){if(Q.test(a.nodeName)&&a.parentNode)p.error("type property can't be changed");else if(!p.support.radioValue&&b==="radio"&&p.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}},value:{get:function(a,b){return L&&p.nodeName(a,"button")?L.get(a,b):b in a?a.value:null},set:function(a,b,c){if(L&&p.nodeName(a,"button"))return L.set(a,b,c);a.value
 =b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e,f,g,h=a.nodeType;if(!a||h===3||h===8||h===2)return;return g=h!==1||!p.isXMLDoc(a),g&&(c=p.propFix[c]||c,f=p.propHooks[c]),d!==b?f&&"set"in f&&(e=f.set(a,d,c))!==b?e:a[c]=d:f&&"get"in f&&(e=f.get(a,c))!==null?e:a[c]},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):R.test(a.nodeName)||S.test(a.nodeName)&&a.href?0:b}}}}),M={get:function(a,c){var d,e=p.prop(a,c);return e===!0||typeof e!="boolean"&&(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;return b===!1?p.removeAttr(a,c):(d=p.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase())),c}},U||(N={name:!0,id:!0,coords:!
 0},L=p.valHooks.button={get:function(a,c){var d;return d=a.getAttributeNode(c),d&&(N[c]?d.value!=="":d.specified)?d.value:b},set:function(a,b,c){var d=a.getAttributeNode(c);return d||(d=e.createAttribute(c),a.setAttributeNode(d)),d.value=b+""}},p.each(["width","height"],function(a,b){p.attrHooks[b]=p.extend(p.attrHooks[b],{set:function(a,c){if(c==="")return a.setAttribute(b,"auto"),c}})}),p.attrHooks.contenteditable={get:L.get,set:function(a,b,c){b===""&&(b="false"),L.set(a,b,c)}}),p.support.hrefNormalized||p.each(["href","src","width","height"],function(a,c){p.attrHooks[c]=p.extend(p.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),p.support.style||(p.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=b+""}}),p.support.optSelected||(p.propHooks.selected=p.extend(p.propHooks.selected,{get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),n
 ull}})),p.support.enctype||(p.propFix.enctype="encoding"),p.support.checkOn||p.each(["radio","checkbox"],function(){p.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),p.each(["radio","checkbox"],function(){p.valHooks[this]=p.extend(p.valHooks[this],{set:function(a,b){if(p.isArray(b))return a.checked=p.inArray(p(a).val(),b)>=0}})});var V=/^(?:textarea|input|select)$/i,W=/^([^\.]*|)(?:\.(.+)|)$/,X=/(?:^|\s)hover(\.\S+|)\b/,Y=/^key/,Z=/^(?:mouse|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=function(a){return p.event.special.hover?a:a.replace(X,"mouseenter$1 mouseleave$1")};p.event={add:function(a,c,d,e,f){var g,h,i,j,k,l,m,n,o,q,r;if(a.nodeType===3||a.nodeType===8||!c||!d||!(g=p._data(a)))return;d.handler&&(o=d,d=o.handler,f=o.selector),d.guid||(d.guid=p.guid++),i=g.events,i||(g.events=i={}),h=g.handle,h||(g.handle=h=function(a){return typeof p!="undefined"&&(!a||p.event.triggered!==a.type)?p.event.dispatch.apply(h.elem,arguments):b},h
 .elem=a),c=p.trim(_(c)).split(" ");for(j=0;j<c.length;j++){k=W.exec(c[j])||[],l=k[1],m=(k[2]||"").split(".").sort(),r=p.event.special[l]||{},l=(f?r.delegateType:r.bindType)||l,r=p.event.special[l]||{},n=p.extend({type:l,origType:k[1],data:e,handler:d,guid:d.guid,selector:f,needsContext:f&&p.expr.match.needsContext.test(f),namespace:m.join(".")},o),q=i[l];if(!q){q=i[l]=[],q.delegateCount=0;if(!r.setup||r.setup.call(a,e,m,h)===!1)a.addEventListener?a.addEventListener(l,h,!1):a.attachEvent&&a.attachEvent("on"+l,h)}r.add&&(r.add.call(a,n),n.handler.guid||(n.handler.guid=d.guid)),f?q.splice(q.delegateCount++,0,n):q.push(n),p.event.global[l]=!0}a=null},global:{},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,q,r=p.hasData(a)&&p._data(a);if(!r||!(m=r.events))return;b=p.trim(_(b||"")).split(" ");for(f=0;f<b.length;f++){g=W.exec(b[f])||[],h=i=g[1],j=g[2];if(!h){for(h in m)p.event.remove(a,h+b[f],c,d,!0);continue}n=p.event.special[h]||{},h=(d?n.delegateType:n.bindType)||h,o=m[h]||[],k=o.l
 ength,j=j?new RegExp("(^|\\.)"+j.split(".").sort().join("\\.(?:.*\\.|)")+"(\\.|$)"):null;for(l=0;l<o.length;l++)q=o[l],(e||i===q.origType)&&(!c||c.guid===q.guid)&&(!j||j.test(q.namespace))&&(!d||d===q.selector||d==="**"&&q.selector)&&(o.splice(l--,1),q.selector&&o.delegateCount--,n.remove&&n.remove.call(a,q));o.length===0&&k!==o.length&&((!n.teardown||n.teardown.call(a,j,r.handle)===!1)&&p.removeEvent(a,h,r.handle),delete m[h])}p.isEmptyObject(m)&&(delete r.handle,p.removeData(a,"events",!0))},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,f,g){if(!f||f.nodeType!==3&&f.nodeType!==8){var h,i,j,k,l,m,n,o,q,r,s=c.type||c,t=[];if($.test(s+p.event.triggered))return;s.indexOf("!")>=0&&(s=s.slice(0,-1),i=!0),s.indexOf(".")>=0&&(t=s.split("."),s=t.shift(),t.sort());if((!f||p.event.customEvent[s])&&!p.event.global[s])return;c=typeof c=="object"?c[p.expando]?c:new p.Event(s,c):new p.Event(s),c.type=s,c.isTrigger=!0,c.exclusive=i,c.namespace=t.join("."),c.namespace_re=c
 .namespace?new RegExp("(^|\\.)"+t.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,m=s.indexOf(":")<0?"on"+s:"";if(!f){h=p.cache;for(j in h)h[j].events&&h[j].events[s]&&p.event.trigger(c,d,h[j].handle.elem,!0);return}c.result=b,c.target||(c.target=f),d=d!=null?p.makeArray(d):[],d.unshift(c),n=p.event.special[s]||{};if(n.trigger&&n.trigger.apply(f,d)===!1)return;q=[[f,n.bindType||s]];if(!g&&!n.noBubble&&!p.isWindow(f)){r=n.delegateType||s,k=$.test(r+s)?f:f.parentNode;for(l=f;k;k=k.parentNode)q.push([k,r]),l=k;l===(f.ownerDocument||e)&&q.push([l.defaultView||l.parentWindow||a,r])}for(j=0;j<q.length&&!c.isPropagationStopped();j++)k=q[j][0],c.type=q[j][1],o=(p._data(k,"events")||{})[c.type]&&p._data(k,"handle"),o&&o.apply(k,d),o=m&&k[m],o&&p.acceptData(k)&&o.apply&&o.apply(k,d)===!1&&c.preventDefault();return c.type=s,!g&&!c.isDefaultPrevented()&&(!n._default||n._default.apply(f.ownerDocument,d)===!1)&&(s!=="click"||!p.nodeName(f,"a"))&&p.acceptData(f)&&m&&f[s]&&(s!=="focus"&&s!=="blur"||c.target.
 offsetWidth!==0)&&!p.isWindow(f)&&(l=f[m],l&&(f[m]=null),p.event.triggered=s,f[s](),p.event.triggered=b,l&&(f[m]=l)),c.result}return},dispatch:function(c){c=p.event.fix(c||a.event);var d,e,f,g,h,i,j,l,m,n,o=(p._data(this,"events")||{})[c.type]||[],q=o.delegateCount,r=k.call(arguments),s=!c.exclusive&&!c.namespace,t=p.event.special[c.type]||{},u=[];r[0]=c,c.delegateTarget=this;if(t.preDispatch&&t.preDispatch.call(this,c)===!1)return;if(q&&(!c.button||c.type!=="click"))for(f=c.target;f!=this;f=f.parentNode||this)if(f.disabled!==!0||c.type!=="click"){h={},j=[];for(d=0;d<q;d++)l=o[d],m=l.selector,h[m]===b&&(h[m]=l.needsContext?p(m,this).index(f)>=0:p.find(m,this,null,[f]).length),h[m]&&j.push(l);j.length&&u.push({elem:f,matches:j})}o.length>q&&u.push({elem:this,matches:o.slice(q)});for(d=0;d<u.length&&!c.isPropagationStopped();d++){i=u[d],c.currentTarget=i.elem;for(e=0;e<i.matches.length&&!c.isImmediatePropagationStopped();e++){l=i.matches[e];if(s||!c.namespace&&!l.namespace||c.namespac
 e_re&&c.namespace_re.test(l.namespace))c.data=l.data,c.handleObj=l,g=((p.event.special[l.origType]||{}).handle||l.handler).apply(i.elem,r),g!==b&&(c.result=g,g===!1&&(c.preventDefault(),c.stopPropagation()))}}return t.postDispatch&&t.postDispatch.call(this,c),c.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return a.which==null&&(a.which=b.charCode!=null?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,c){var d,f,g,h=c.button,i=c.fromElement;return a.pageX==null&&c.clientX!=null&&(d=a.target.ownerDocument||e,f=d.documentElement,g=d.body,a.pageX=c.clientX+(f&&f.scrollLeft||g&&g.scrollLeft||0)-(f&&f.clientLeft||g&&g.clientLeft||0),a.pageY=
 c.clientY+(f&&f.scrollTop||g&&g.scrollTop||0)-(f&&f.clientTop||g&&g.clientTop||0)),!a.relatedTarget&&i&&(a.relatedTarget=i===a.target?c.toElement:i),!a.which&&h!==b&&(a.which=h&1?1:h&2?3:h&4?2:0),a}},fix:function(a){if(a[p.expando])return a;var b,c,d=a,f=p.event.fixHooks[a.type]||{},g=f.props?this.props.concat(f.props):this.props;a=p.Event(d);for(b=g.length;b;)c=g[--b],a[c]=d[c];return a.target||(a.target=d.srcElement||e),a.target.nodeType===3&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,f.filter?f.filter(a,d):a},special:{load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(a,b,c){p.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}},simulate:function(a,b,c,d){var e=p.extend(new p.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?p.event.trigger(e,null,b):p.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},p.event.handle=p.event.d
 ispatch,p.removeEvent=e.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){var d="on"+b;a.detachEvent&&(typeof a[d]=="undefined"&&(a[d]=null),a.detachEvent(d,c))},p.Event=function(a,b){if(this instanceof p.Event)a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?bb:ba):this.type=a,b&&p.extend(this,b),this.timeStamp=a&&a.timeStamp||p.now(),this[p.expando]=!0;else return new p.Event(a,b)},p.Event.prototype={preventDefault:function(){this.isDefaultPrevented=bb;var a=this.originalEvent;if(!a)return;a.preventDefault?a.preventDefault():a.returnValue=!1},stopPropagation:function(){this.isPropagationStopped=bb;var a=this.originalEvent;if(!a)return;a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=bb,this.stopPropagation()},isDefaultPrevented:ba,isPropagati
 onStopped:ba,isImmediatePropagationStopped:ba},p.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){p.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj,g=f.selector;if(!e||e!==d&&!p.contains(d,e))a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b;return c}}}),p.support.submitBubbles||(p.event.special.submit={setup:function(){if(p.nodeName(this,"form"))return!1;p.event.add(this,"click._submit keypress._submit",function(a){var c=a.target,d=p.nodeName(c,"input")||p.nodeName(c,"button")?c.form:b;d&&!p._data(d,"_submit_attached")&&(p.event.add(d,"submit._submit",function(a){a._submit_bubble=!0}),p._data(d,"_submit_attached",!0))})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&p.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){if(p.nodeName(this,"form"))return!1;p.event.remove(this,"._submit")}}),p.support.changeBubbles||(p.event.speci
 al.change={setup:function(){if(V.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")p.event.add(this,"propertychange._change",function(a){a.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),p.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1),p.event.simulate("change",this,a,!0)});return!1}p.event.add(this,"beforeactivate._change",function(a){var b=a.target;V.test(b.nodeName)&&!p._data(b,"_change_attached")&&(p.event.add(b,"change._change",function(a){this.parentNode&&!a.isSimulated&&!a.isTrigger&&p.event.simulate("change",this.parentNode,a,!0)}),p._data(b,"_change_attached",!0))})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||a.isTrigger||b.type!=="radio"&&b.type!=="checkbox")return a.handleObj.handler.apply(this,arguments)},teardown:function(){return p.event.remove(this,"._change"),!V.test(this.nodeName)}}),p.support.focusinBubbles||p.each({focus:"focusin",blur:"focusout"},function(
 a,b){var c=0,d=function(a){p.event.simulate(b,a.target,p.event.fix(a),!0)};p.event.special[b]={setup:function(){c++===0&&e.addEventListener(a,d,!0)},teardown:function(){--c===0&&e.removeEventListener(a,d,!0)}}}),p.fn.extend({on:function(a,c,d,e,f){var g,h;if(typeof a=="object"){typeof c!="string"&&(d=d||c,c=b);for(h in a)this.on(h,c,d,a[h],f);return this}d==null&&e==null?(e=c,d=c=b):e==null&&(typeof c=="string"?(e=d,d=b):(e=d,d=c,c=b));if(e===!1)e=ba;else if(!e)return this;return f===1&&(g=e,e=function(a){return p().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=p.guid++)),this.each(function(){p.event.add(this,a,e,d,c)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,c,d){var e,f;if(a&&a.preventDefault&&a.handleObj)return e=a.handleObj,p(a.delegateTarget).off(e.namespace?e.origType+"."+e.namespace:e.origType,e.selector,e.handler),this;if(typeof a=="object"){for(f in a)this.off(f,c,a[f]);return this}if(c===!1||typeof c=="function")d=c,c=b;return d===!1&&(d=b
 a),this.each(function(){p.event.remove(this,a,d,c)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},live:function(a,b,c){return p(this.context).on(a,this.selector,b,c),this},die:function(a,b){return p(this.context).off(a,this.selector||"**",b),this},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return arguments.length===1?this.off(a,"**"):this.off(b,a||"**",c)},trigger:function(a,b){return this.each(function(){p.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return p.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||p.guid++,d=0,e=function(c){var e=(p._data(this,"lastToggle"+a.guid)||0)%d;return p._data(this,"lastToggle"+a.guid,e+1),c.preventDefault(),b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),p.each("blur focus focusin focusout load resize
  scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){p.fn[b]=function(a,c){return c==null&&(c=a,a=null),arguments.length>0?this.on(b,null,a,c):this.trigger(b)},Y.test(b)&&(p.event.fixHooks[b]=p.event.keyHooks),Z.test(b)&&(p.event.fixHooks[b]=p.event.mouseHooks)}),function(a,b){function bc(a,b,c,d){c=c||[],b=b||r;var e,f,i,j,k=b.nodeType;if(!a||typeof a!="string")return c;if(k!==1&&k!==9)return[];i=g(b);if(!i&&!d)if(e=P.exec(a))if(j=e[1]){if(k===9){f=b.getElementById(j);if(!f||!f.parentNode)return c;if(f.id===j)return c.push(f),c}else if(b.ownerDocument&&(f=b.ownerDocument.getElementById(j))&&h(b,f)&&f.id===j)return c.push(f),c}else{if(e[2])return w.apply(c,x.call(b.getElementsByTagName(a),0)),c;if((j=e[3])&&_&&b.getElementsByClassName)return w.apply(c,x.call(b.getElementsByClassName(j),0)),c}return bp(a.replace(L,"$1"),b,c,d,i)}function bd(a){return f
 unction(b){var c=b.nodeName.toLowerCase();return c==="input"&&b.type===a}}function be(a){return function(b){var c=b.nodeName.toLowerCase();return(c==="input"||c==="button")&&b.type===a}}function bf(a){return z(function(b){return b=+b,z(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function bg(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}function bh(a,b){var c,d,f,g,h,i,j,k=C[o][a];if(k)return b?0:k.slice(0);h=a,i=[],j=e.preFilter;while(h){if(!c||(d=M.exec(h)))d&&(h=h.slice(d[0].length)),i.push(f=[]);c=!1;if(d=N.exec(h))f.push(c=new q(d.shift())),h=h.slice(c.length),c.type=d[0].replace(L," ");for(g in e.filter)(d=W[g].exec(h))&&(!j[g]||(d=j[g](d,r,!0)))&&(f.push(c=new q(d.shift())),h=h.slice(c.length),c.type=g,c.matches=d);if(!c)break}return b?h.length:h?bc.error(a):C(a,i).slice(0)}function bi(a,b,d){var e=b.dir,f=d&&b.dir==="parentNode",g=u++;return b.first?function(b,c,d){while(b=b[
 e])if(f||b.nodeType===1)return a(b,c,d)}:function(b,d,h){if(!h){var i,j=t+" "+g+" ",k=j+c;while(b=b[e])if(f||b.nodeType===1){if((i=b[o])===k)return b.sizset;if(typeof i=="string"&&i.indexOf(j)===0){if(b.sizset)return b}else{b[o]=k;if(a(b,d,h))return b.sizset=!0,b;b.sizset=!1}}}else while(b=b[e])if(f||b.nodeType===1)if(a(b,d,h))return b}}function bj(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function bk(a,b,c,d,e){var f,g=[],h=0,i=a.length,j=b!=null;for(;h<i;h++)if(f=a[h])if(!c||c(f,d,e))g.push(f),j&&b.push(h);return g}function bl(a,b,c,d,e,f){return d&&!d[o]&&(d=bl(d)),e&&!e[o]&&(e=bl(e,f)),z(function(f,g,h,i){if(f&&e)return;var j,k,l,m=[],n=[],o=g.length,p=f||bo(b||"*",h.nodeType?[h]:h,[],f),q=a&&(f||!b)?bk(p,m,a,h,i):p,r=c?e||(f?a:o||d)?[]:g:q;c&&c(q,r,h,i);if(d){l=bk(r,n),d(l,[],h,i),j=l.length;while(j--)if(k=l[j])r[n[j]]=!(q[n[j]]=k)}if(f){j=a&&r.length;while(j--)if(k=r[j])f[m[j]]=!(g[m[j]]=k)}else r=bk(r===g?r.splice(o,
 r.length):r),e?e(null,g,r,i):w.apply(g,r)})}function bm(a){var b,c,d,f=a.length,g=e.relative[a[0].type],h=g||e.relative[" "],i=g?1:0,j=bi(function(a){return a===b},h,!0),k=bi(function(a){return y.call(b,a)>-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==l)||((b=c).nodeType?j(a,c,d):k(a,c,d))}];for(;i<f;i++)if(c=e.relative[a[i].type])m=[bi(bj(m),c)];else{c=e.filter[a[i].type].apply(null,a[i].matches);if(c[o]){d=++i;for(;d<f;d++)if(e.relative[a[d].type])break;return bl(i>1&&bj(m),i>1&&a.slice(0,i-1).join("").replace(L,"$1"),c,i<d&&bm(a.slice(i,d)),d<f&&bm(a=a.slice(d)),d<f&&a.join(""))}m.push(c)}return bj(m)}function bn(a,b){var d=b.length>0,f=a.length>0,g=function(h,i,j,k,m){var n,o,p,q=[],s=0,u="0",x=h&&[],y=m!=null,z=l,A=h||f&&e.find.TAG("*",m&&i.parentNode||i),B=t+=z==null?1:Math.E;y&&(l=i!==r&&i,c=g.el);for(;(n=A[u])!=null;u++){if(f&&n){for(o=0;p=a[o];o++)if(p(n,i,j)){k.push(n);break}y&&(t=B,c=++g.el)}d&&((n=!p&&n)&&s--,h&&x.push(n))}s+=u;if(d&&u!==s){for(o=0;p=b[o];o++)p(x,q,i,j)
 ;if(h){if(s>0)while(u--)!x[u]&&!q[u]&&(q[u]=v.call(k));q=bk(q)}w.apply(k,q),y&&!h&&q.length>0&&s+b.length>1&&bc.uniqueSort(k)}return y&&(t=B,l=z),x};return g.el=0,d?z(g):g}function bo(a,b,c,d){var e=0,f=b.length;for(;e<f;e++)bc(a,b[e],c,d);return c}function bp(a,b,c,d,f){var g,h,j,k,l,m=bh(a),n=m.length;if(!d&&m.length===1){h=m[0]=m[0].slice(0);if(h.length>2&&(j=h[0]).type==="ID"&&b.nodeType===9&&!f&&e.relative[h[1].type]){b=e.find.ID(j.matches[0].replace(V,""),b,f)[0];if(!b)return c;a=a.slice(h.shift().length)}for(g=W.POS.test(a)?-1:h.length-1;g>=0;g--){j=h[g];if(e.relative[k=j.type])break;if(l=e.find[k])if(d=l(j.matches[0].replace(V,""),R.test(h[0].type)&&b.parentNode||b,f)){h.splice(g,1),a=d.length&&h.join("");if(!a)return w.apply(c,x.call(d,0)),c;break}}}return i(a,m)(d,b,f,c,R.test(a)),c}function bq(){}var c,d,e,f,g,h,i,j,k,l,m=!0,n="undefined",o=("sizcache"+Math.random()).replace(".",""),q=String,r=a.document,s=r.documentElement,t=0,u=0,v=[].pop,w=[].push,x=[].slice,y=[].index
 Of||function(a){var b=0,c=this.length;for(;b<c;b++)if(this[b]===a)return b;return-1},z=function(a,b){return a[o]=b==null||b,a},A=function(){var a={},b=[];return z(function(c,d){return b.push(c)>e.cacheLength&&delete a[b.shift()],a[c]=d},a)},B=A(),C=A(),D=A(),E="[\\x20\\t\\r\\n\\f]",F="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",G=F.replace("w","w#"),H="([*^$|!~]?=)",I="\\["+E+"*("+F+")"+E+"*(?:"+H+E+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+G+")|)|)"+E+"*\\]",J=":("+F+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:"+I+")|[^:]|\\\\.)*|.*))\\)|)",K=":(even|odd|eq|gt|lt|nth|first|last)(?:\\("+E+"*((?:-\\d)?\\d*)"+E+"*\\)|)(?=[^-]|$)",L=new RegExp("^"+E+"+|((?:^|[^\\\\])(?:\\\\.)*)"+E+"+$","g"),M=new RegExp("^"+E+"*,"+E+"*"),N=new RegExp("^"+E+"*([\\x20\\t\\r\\n\\f>+~])"+E+"*"),O=new RegExp(J),P=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,Q=/^:not/,R=/[\x20\t\r\n\f]*[+~]/,S=/:not\($/,T=/h\d/i,U=/input|select|textarea|button/i,V=/\\(?!\\)/g,W={ID:new RegExp("^#("+F+")"),CLASS:new RegExp("^\\.
 ("+F+")"),NAME:new RegExp("^\\[name=['\"]?("+F+")['\"]?\\]"),TAG:new RegExp("^("+F.replace("w","w*")+")"),ATTR:new RegExp("^"+I),PSEUDO:new RegExp("^"+J),POS:new RegExp(K,"i"),CHILD:new RegExp("^:(only|nth|first|last)-child(?:\\("+E+"*(even|odd|(([+-]|)(\\d*)n|)"+E+"*(?:([+-]|)"+E+"*(\\d+)|))"+E+"*\\)|)","i"),needsContext:new RegExp("^"+E+"*[>+~]|"+K,"i")},X=function(a){var b=r.createElement("div");try{return a(b)}catch(c){return!1}finally{b=null}},Y=X(function(a){return a.appendChild(r.createComment("")),!a.getElementsByTagName("*").length}),Z=X(function(a){return a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!==n&&a.firstChild.getAttribute("href")==="#"}),$=X(function(a){a.innerHTML="<select></select>";var b=typeof a.lastChild.getAttribute("multiple");return b!=="boolean"&&b!=="string"}),_=X(function(a){return a.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",!a.getElementsByClassName||!a.getElementsByClassName("e").length?!1:(a.la
 stChild.className="e",a.getElementsByClassName("e").length===2)}),ba=X(function(a){a.id=o+0,a.innerHTML="<a name='"+o+"'></a><div name='"+o+"'></div>",s.insertBefore(a,s.firstChild);var b=r.getElementsByName&&r.getElementsByName(o).length===2+r.getElementsByName(o+0).length;return d=!r.getElementById(o),s.removeChild(a),b});try{x.call(s.childNodes,0)[0].nodeType}catch(bb){x=function(a){var b,c=[];for(;b=this[a];a++)c.push(b);return c}}bc.matches=function(a,b){return bc(a,null,null,b)},bc.matchesSelector=function(a,b){return bc(b,null,null,[a]).length>0},f=bc.getText=function(a){var b,c="",d=0,e=a.nodeType;if(e){if(e===1||e===9||e===11){if(typeof a.textContent=="string")return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=f(a)}else if(e===3||e===4)return a.nodeValue}else for(;b=a[d];d++)c+=f(b);return c},g=bc.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?b.nodeName!=="HTML":!1},h=bc.contains=s.contains?function(a,b){var c=a.nodeType===9?a.documentEl
 ement:a,d=b&&b.parentNode;return a===d||!!(d&&d.nodeType===1&&c.contains&&c.contains(d))}:s.compareDocumentPosition?function(a,b){return b&&!!(a.compareDocumentPosition(b)&16)}:function(a,b){while(b=b.parentNode)if(b===a)return!0;return!1},bc.attr=function(a,b){var c,d=g(a);return d||(b=b.toLowerCase()),(c=e.attrHandle[b])?c(a):d||$?a.getAttribute(b):(c=a.getAttributeNode(b),c?typeof a[b]=="boolean"?a[b]?b:null:c.specified?c.value:null:null)},e=bc.selectors={cacheLength:50,createPseudo:z,match:W,attrHandle:Z?{}:{href:function(a){return a.getAttribute("href",2)},type:function(a){return a.getAttribute("type")}},find:{ID:d?function(a,b,c){if(typeof b.getElementById!==n&&!c){var d=b.getElementById(a);return d&&d.parentNode?[d]:[]}}:function(a,c,d){if(typeof c.getElementById!==n&&!d){var e=c.getElementById(a);return e?e.id===a||typeof e.getAttributeNode!==n&&e.getAttributeNode("id").value===a?[e]:b:[]}},TAG:Y?function(a,b){if(typeof b.getElementsByTagName!==n)return b.getElementsByTagNam
 e(a)}:function(a,b){var c=b.getElementsByTagName(a);if(a==="*"){var d,e=[],f=0;for(;d=c[f];f++)d.nodeType===1&&e.push(d);return e}return c},NAME:ba&&function(a,b){if(typeof b.getElementsByName!==n)return b.getElementsByName(name)},CLASS:_&&function(a,b,c){if(typeof b.getElementsByClassName!==n&&!c)return b.getElementsByClassName(a)}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(V,""),a[3]=(a[4]||a[5]||"").replace(V,""),a[2]==="~="&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),a[1]==="nth"?(a[2]||bc.error(a[0]),a[3]=+(a[3]?a[4]+(a[5]||1):2*(a[2]==="even"||a[2]==="odd")),a[4]=+(a[6]+a[7]||a[2]==="odd")):a[2]&&bc.error(a[0]),a},PSEUDO:function(a){var b,c;if(W.CHILD.test(a[0]))return null;if(a[3])a[2]=a[3];else if(b=a[4])O.test(b)&&(c=bh(b,!0))&&(c=b.indexOf(")",b.length-c)-b.length)&&(b=b.slice(0,c),a[0]=a[0].sl
 ice(0,c)),a[2]=b;return a.slice(0,3)}},filter:{ID:d?function(a){return a=a.replace(V,""),function(b){return b.getAttribute("id")===a}}:function(a){return a=a.replace(V,""),function(b){var c=typeof b.getAttributeNode!==n&&b.getAttributeNode("id");return c&&c.value===a}},TAG:function(a){return a==="*"?function(){return!0}:(a=a.replace(V,"").toLowerCase(),function(b){return b.nodeName&&b.nodeName.toLowerCase()===a})},CLASS:function(a){var b=B[o][a];return b||(b=B(a,new RegExp("(^|"+E+")"+a+"("+E+"|$)"))),function(a){return b.test(a.className||typeof a.getAttribute!==n&&a.getAttribute("class")||"")}},ATTR:function(a,b,c){return function(d,e){var f=bc.attr(d,a);return f==null?b==="!=":b?(f+="",b==="="?f===c:b==="!="?f!==c:b==="^="?c&&f.indexOf(c)===0:b==="*="?c&&f.indexOf(c)>-1:b==="$="?c&&f.substr(f.length-c.length)===c:b==="~="?(" "+f+" ").indexOf(c)>-1:b==="|="?f===c||f.substr(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d){return a==="nth"?function(a){var b,e,f=a.parentNode;if
 (c===1&&d===0)return!0;if(f){e=0;for(b=f.firstChild;b;b=b.nextSibling)if(b.nodeType===1){e++;if(a===b)break}}return e-=d,e===c||e%c===0&&e/c>=0}:function(b){var c=b;switch(a){case"only":case"first":while(c=c.previousSibling)if(c.nodeType===1)return!1;if(a==="first")return!0;c=b;case"last":while(c=c.nextSibling)if(c.nodeType===1)return!1;return!0}}},PSEUDO:function(a,b){var c,d=e.pseudos[a]||e.setFilters[a.toLowerCase()]||bc.error("unsupported pseudo: "+a);return d[o]?d(b):d.length>1?(c=[a,a,"",b],e.setFilters.hasOwnProperty(a.toLowerCase())?z(function(a,c){var e,f=d(a,b),g=f.length;while(g--)e=y.call(a,f[g]),a[e]=!(c[e]=f[g])}):function(a){return d(a,0,c)}):d}},pseudos:{not:z(function(a){var b=[],c=[],d=i(a.replace(L,"$1"));return d[o]?z(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)if(f=g[h])a[h]=!(b[h]=f)}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:z(function(a){return function(b){return bc(a,b).length>0}}),contains:z(function(a){return function(b
 ){return(b.textContent||b.innerText||f(b)).indexOf(a)>-1}}),enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&!!a.checked||b==="option"&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},parent:function(a){return!e.pseudos.empty(a)},empty:function(a){var b;a=a.firstChild;while(a){if(a.nodeName>"@"||(b=a.nodeType)===3||b===4)return!1;a=a.nextSibling}return!0},header:function(a){return T.test(a.nodeName)},text:function(a){var b,c;return a.nodeName.toLowerCase()==="input"&&(b=a.type)==="text"&&((c=a.getAttribute("type"))==null||c.toLowerCase()===b)},radio:bd("radio"),checkbox:bd("checkbox"),file:bd("file"),password:bd("password"),image:bd("image"),submit:be("submit"),reset:be("reset"),button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&a.type==="button"||b==="button"},input:function(a){return U.test(a.nodeName)
 },focus:function(a){var b=a.ownerDocument;return a===b.activeElement&&(!b.hasFocus||b.hasFocus())&&(!!a.type||!!a.href)},active:function(a){return a===a.ownerDocument.activeElement},first:bf(function(a,b,c){return[0]}),last:bf(function(a,b,c){return[b-1]}),eq:bf(function(a,b,c){return[c<0?c+b:c]}),even:bf(function(a,b,c){for(var d=0;d<b;d+=2)a.push(d);return a}),odd:bf(function(a,b,c){for(var d=1;d<b;d+=2)a.push(d);return a}),lt:bf(function(a,b,c){for(var d=c<0?c+b:c;--d>=0;)a.push(d);return a}),gt:bf(function(a,b,c){for(var d=c<0?c+b:c;++d<b;)a.push(d);return a})}},j=s.compareDocumentPosition?function(a,b){return a===b?(k=!0,0):(!a.compareDocumentPosition||!b.compareDocumentPosition?a.compareDocumentPosition:a.compareDocumentPosition(b)&4)?-1:1}:function(a,b){if(a===b)return k=!0,0;if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],g=a.parentNode,h=b.parentNode,i=g;if(g===h)return bg(a,b);if(!g)return-1;if(!h)return 1;while(i)e.unshift(i),i=i.paren
 tNode;i=h;while(i)f.unshift(i),i=i.parentNode;c=e.length,d=f.length;for(var j=0;j<c&&j<d;j++)if(e[j]!==f[j])return bg(e[j],f[j]);return j===c?bg(a,f[j],-1):bg(e[j],b,1)},[0,0].sort(j),m=!k,bc.uniqueSort=function(a){var b,c=1;k=m,a.sort(j);if(k)for(;b=a[c];c++)b===a[c-1]&&a.splice(c--,1);return a},bc.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},i=bc.compile=function(a,b){var c,d=[],e=[],f=D[o][a];if(!f){b||(b=bh(a)),c=b.length;while(c--)f=bm(b[c]),f[o]?d.push(f):e.push(f);f=D(a,bn(e,d))}return f},r.querySelectorAll&&function(){var a,b=bp,c=/'|\\/g,d=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,e=[":focus"],f=[":active",":focus"],h=s.matchesSelector||s.mozMatchesSelector||s.webkitMatchesSelector||s.oMatchesSelector||s.msMatchesSelector;X(function(a){a.innerHTML="<select><option selected=''></option></select>",a.querySelectorAll("[selected]").length||e.push("\\["+E+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),a.querySelectorAll("
 :checked").length||e.push(":checked")}),X(function(a){a.innerHTML="<p test=''></p>",a.querySelectorAll("[test^='']").length&&e.push("[*^$]="+E+"*(?:\"\"|'')"),a.innerHTML="<input type='hidden'/>",a.querySelectorAll(":enabled").length||e.push(":enabled",":disabled")}),e=new RegExp(e.join("|")),bp=function(a,d,f,g,h){if(!g&&!h&&(!e||!e.test(a))){var i,j,k=!0,l=o,m=d,n=d.nodeType===9&&a;if(d.nodeType===1&&d.nodeName.toLowerCase()!=="object"){i=bh(a),(k=d.getAttribute("id"))?l=k.replace(c,"\\$&"):d.setAttribute("id",l),l="[id='"+l+"'] ",j=i.length;while(j--)i[j]=l+i[j].join("");m=R.test(a)&&d.parentNode||d,n=i.join(",")}if(n)try{return w.apply(f,x.call(m.querySelectorAll(n),0)),f}catch(p){}finally{k||d.removeAttribute("id")}}return b(a,d,f,g,h)},h&&(X(function(b){a=h.call(b,"div");try{h.call(b,"[test!='']:sizzle"),f.push("!=",J)}catch(c){}}),f=new RegExp(f.join("|")),bc.matchesSelector=function(b,c){c=c.replace(d,"='$1']");if(!g(b)&&!f.test(c)&&(!e||!e.test(c)))try{var i=h.call(b,c);if(
 i||a||b.document&&b.document.nodeType!==11)return i}catch(j){}return bc(c,null,null,[b]).length>0})}(),e.pseudos.nth=e.pseudos.eq,e.filters=bq.prototype=e.pseudos,e.setFilters=new bq,bc.attr=p.attr,p.find=bc,p.expr=bc.selectors,p.expr[":"]=p.expr.pseudos,p.unique=bc.uniqueSort,p.text=bc.getText,p.isXMLDoc=bc.isXML,p.contains=bc.contains}(a);var bc=/Until$/,bd=/^(?:parents|prev(?:Until|All))/,be=/^.[^:#\[\.,]*$/,bf=p.expr.match.needsContext,bg={children:!0,contents:!0,next:!0,prev:!0};p.fn.extend({find:function(a){var b,c,d,e,f,g,h=this;if(typeof a!="string")return p(a).filter(function(){for(b=0,c=h.length;b<c;b++)if(p.contains(h[b],this))return!0});g=this.pushStack("","find",a);for(b=0,c=this.length;b<c;b++){d=g.length,p.find(a,this[b],g);if(b>0)for(e=d;e<g.length;e++)for(f=0;f<d;f++)if(g[f]===g[e]){g.splice(e--,1);break}}return g},has:function(a){var b,c=p(a,this),d=c.length;return this.filter(function(){for(b=0;b<d;b++)if(p.contains(this,c[b]))return!0})},not:function(a){return th
 is.pushStack(bj(this,a,!1),"not",a)},filter:function(a){return this.pushStack(bj(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?bf.test(a)?p(a,this.context).index(this[0])>=0:p.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c,d=0,e=this.length,f=[],g=bf.test(a)||typeof a!="string"?p(a,b||this.context):0;for(;d<e;d++){c=this[d];while(c&&c.ownerDocument&&c!==b&&c.nodeType!==11){if(g?g.index(c)>-1:p.find.matchesSelector(c,a)){f.push(c);break}c=c.parentNode}}return f=f.length>1?p.unique(f):f,this.pushStack(f,"closest",a)},index:function(a){return a?typeof a=="string"?p.inArray(this[0],p(a)):p.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(a,b){var c=typeof a=="string"?p(a,b):p.makeArray(a&&a.nodeType?[a]:a),d=p.merge(this.get(),c);return this.pushStack(bh(c[0])||bh(d[0])?d:p.unique(d))},addBack:function(a){return this.add(a==null?this.prevObject:this.prevObject.filter(a))}}),p.fn.andSel
 f=p.fn.addBack,p.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return p.dir(a,"parentNode")},parentsUntil:function(a,b,c){return p.dir(a,"parentNode",c)},next:function(a){return bi(a,"nextSibling")},prev:function(a){return bi(a,"previousSibling")},nextAll:function(a){return p.dir(a,"nextSibling")},prevAll:function(a){return p.dir(a,"previousSibling")},nextUntil:function(a,b,c){return p.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return p.dir(a,"previousSibling",c)},siblings:function(a){return p.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return p.sibling(a.firstChild)},contents:function(a){return p.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:p.merge([],a.childNodes)}},function(a,b){p.fn[a]=function(c,d){var e=p.map(this,b,c);return bc.test(a)||(d=c),d&&typeof d=="string"&&(e=p.filter(d,e)),e=this.length>1&&!bg[a]?p.unique(e):e,this.length>1&&bd.test(a)&&(e=e.reverse()),this.pushStack(e,
 a,k.call(arguments).join(","))}}),p.extend({filter:function(a,b,c){return c&&(a=":not("+a+")"),b.length===1?p.find.matchesSelector(b[0],a)?[b[0]]:[]:p.find.matches(a,b)},dir:function(a,c,d){var e=[],f=a[c];while(f&&f.nodeType!==9&&(d===b||f.nodeType!==1||!p(f).is(d)))f.nodeType===1&&e.push(f),f=f[c];return e},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var bl="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",bm=/ jQuery\d+="(?:null|\d+)"/g,bn=/^\s+/,bo=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bp=/<([\w:]+)/,bq=/<tbody/i,br=/<|&#?\w+;/,bs=/<(?:script|style|link)/i,bt=/<(?:script|object|embed|option|style)/i,bu=new RegExp("<(?:"+bl+")[\\s/>]","i"),bv=/^(?:checkbox|radio)$/,bw=/checked\s*(?:[^=]|=\s*.checked.)/i,bx=/\/(java|ecma)script/i,by=/^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g,bz={option:
 [1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},bA=bk(e),bB=bA.appendChild(e.createElement("div"));bz.optgroup=bz.option,bz.tbody=bz.tfoot=bz.colgroup=bz.caption=bz.thead,bz.th=bz.td,p.support.htmlSerialize||(bz._default=[1,"X<div>","</div>"]),p.fn.extend({text:function(a){return p.access(this,function(a){return a===b?p.text(this):this.empty().append((this[0]&&this[0].ownerDocument||e).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(p.isFunction(a))return this.each(function(b){p(this).wrapAll(a.call(this,b))});if(this[0]){var b=p(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.fir
 stChild;return a}).append(this)}return this},wrapInner:function(a){return p.isFunction(a)?this.each(function(b){p(this).wrapInner(a.call(this,b))}):this.each(function(){var b=p(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=p.isFunction(a);return this.each(function(c){p(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){p.nodeName(this,"body")||p(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){(this.nodeType===1||this.nodeType===11)&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){(this.nodeType===1||this.nodeType===11)&&this.insertBefore(a,this.firstChild)})},before:function(){if(!bh(this[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=p.clean(arguments);return this.pushStack(p.merge(a,this),"before",this.selector)}},after:function(){if(!bh(th
 is[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=p.clean(arguments);return this.pushStack(p.merge(this,a),"after",this.selector)}},remove:function(a,b){var c,d=0;for(;(c=this[d])!=null;d++)if(!a||p.filter(a,[c]).length)!b&&c.nodeType===1&&(p.cleanData(c.getElementsByTagName("*")),p.cleanData([c])),c.parentNode&&c.parentNode.removeChild(c);return this},empty:function(){var a,b=0;for(;(a=this[b])!=null;b++){a.nodeType===1&&p.cleanData(a.getElementsByTagName("*"));while(a.firstChild)a.removeChild(a.firstChild)}return this},clone:function(a,b){return a=a==null?!1:a,b=b==null?a:b,this.map(function(){return p.clone(this,a,b)})},html:function(a){return p.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return c.nodeType===1?c.innerHTML.replace(bm,""):b;if(typeof a=="string"&&!bs.test(a)&&(p.support.htmlSerialize||!bu.test(a))&&(p.support.leadingWhitespace||!bn.test(a))&&!bz[(bp.exec(a)||["
 ",""])[1].toLowerCase()]){a=a.replace(bo,"<$1></$2>");try{for(;d<e;d++)c=this[d]||{},c.nodeType===1&&(p.cleanData(c.getElementsByTagName("*")),c.innerHTML=a);c=0}catch(f){}}c&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(a){return bh(this[0])?this.length?this.pushStack(p(p.isFunction(a)?a():a),"replaceWith",a):this:p.isFunction(a)?this.each(function(b){var c=p(this),d=c.html();c.replaceWith(a.call(this,b,d))}):(typeof a!="string"&&(a=p(a).detach()),this.each(function(){var b=this.nextSibling,c=this.parentNode;p(this).remove(),b?p(b).before(a):p(c).append(a)}))},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){a=[].concat.apply([],a);var e,f,g,h,i=0,j=a[0],k=[],l=this.length;if(!p.support.checkClone&&l>1&&typeof j=="string"&&bw.test(j))return this.each(function(){p(this).domManip(a,c,d)});if(p.isFunction(j))return this.each(function(e){var f=p(this);a[0]=j.call(this,e,c?f.html():b),f.domManip(a,c,d)});if(this[0]){e=p.buildFragment(a,this
 ,k),g=e.fragment,f=g.firstChild,g.childNodes.length===1&&(g=f);if(f){c=c&&p.nodeName(f,"tr");for(h=e.cacheable||l-1;i<l;i++)d.call(c&&p.nodeName(this[i],"table")?bC(this[i],"tbody"):this[i],i===h?g:p.clone(g,!0,!0))}g=f=null,k.length&&p.each(k,function(a,b){b.src?p.ajax?p.ajax({url:b.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):p.error("no ajax"):p.globalEval((b.text||b.textContent||b.innerHTML||"").replace(by,"")),b.parentNode&&b.parentNode.removeChild(b)})}return this}}),p.buildFragment=function(a,c,d){var f,g,h,i=a[0];return c=c||e,c=!c.nodeType&&c[0]||c,c=c.ownerDocument||c,a.length===1&&typeof i=="string"&&i.length<512&&c===e&&i.charAt(0)==="<"&&!bt.test(i)&&(p.support.checkClone||!bw.test(i))&&(p.support.html5Clone||!bu.test(i))&&(g=!0,f=p.fragments[i],h=f!==b),f||(f=c.createDocumentFragment(),p.clean(a,c,f,d),g&&(p.fragments[i]=h&&f)),{fragment:f,cacheable:g}},p.fragments={},p.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"
 after",replaceAll:"replaceWith"},function(a,b){p.fn[a]=function(c){var d,e=0,f=[],g=p(c),h=g.length,i=this.length===1&&this[0].parentNode;if((i==null||i&&i.nodeType===11&&i.childNodes.length===1)&&h===1)return g[b](this[0]),this;for(;e<h;e++)d=(e>0?this.clone(!0):this).get(),p(g[e])[b](d),f=f.concat(d);return this.pushStack(f,a,g.selector)}}),p.extend({clone:function(a,b,c){var d,e,f,g;p.support.html5Clone||p.isXMLDoc(a)||!bu.test("<"+a.nodeName+">")?g=a.cloneNode(!0):(bB.innerHTML=a.outerHTML,bB.removeChild(g=bB.firstChild));if((!p.support.noCloneEvent||!p.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!p.isXMLDoc(a)){bE(a,g),d=bF(a),e=bF(g);for(f=0;d[f];++f)e[f]&&bE(d[f],e[f])}if(b){bD(a,g);if(c){d=bF(a),e=bF(g);for(f=0;d[f];++f)bD(d[f],e[f])}}return d=e=null,g},clean:function(a,b,c,d){var f,g,h,i,j,k,l,m,n,o,q,r,s=b===e&&bA,t=[];if(!b||typeof b.createDocumentFragment=="undefined")b=e;for(f=0;(h=a[f])!=null;f++){typeof h=="number"&&(h+="");if(!h)continue;if(typeof h==
 "string")if(!br.test(h))h=b.createTextNode(h);else{s=s||bk(b),l=b.createElement("div"),s.appendChild(l),h=h.replace(bo,"<$1></$2>"),i=(bp.exec(h)||["",""])[1].toLowerCase(),j=bz[i]||bz._default,k=j[0],l.innerHTML=j[1]+h+j[2];while(k--)l=l.lastChild;if(!p.support.tbody){m=bq.test(h),n=i==="table"&&!m?l.firstChild&&l.firstChild.childNodes:j[1]==="<table>"&&!m?l.childNodes:[];for(g=n.length-1;g>=0;--g)p.nodeName(n[g],"tbody")&&!n[g].childNodes.length&&n[g].parentNode.removeChild(n[g])}!p.support.leadingWhitespace&&bn.test(h)&&l.insertBefore(b.createTextNode(bn.exec(h)[0]),l.firstChild),h=l.childNodes,l.parentNode.removeChild(l)}h.nodeType?t.push(h):p.merge(t,h)}l&&(h=l=s=null);if(!p.support.appendChecked)for(f=0;(h=t[f])!=null;f++)p.nodeName(h,"input")?bG(h):typeof h.getElementsByTagName!="undefined"&&p.grep(h.getElementsByTagName("input"),bG);if(c){q=function(a){if(!a.type||bx.test(a.type))return d?d.push(a.parentNode?a.parentNode.removeChild(a):a):c.appendChild(a)};for(f=0;(h=t[f])!=
 null;f++)if(!p.nodeName(h,"script")||!q(h))c.appendChild(h),typeof h.getElementsByTagName!="undefined"&&(r=p.grep(p.merge([],h.getElementsByTagName("script")),q),t.splice.apply(t,[f+1,0].concat(r)),f+=r.length)}return t},cleanData:function(a,b){var c,d,e,f,g=0,h=p.expando,i=p.cache,j=p.support.deleteExpando,k=p.event.special;for(;(e=a[g])!=null;g++)if(b||p.acceptData(e)){d=e[h],c=d&&i[d];if(c){if(c.events)for(f in c.events)k[f]?p.event.remove(e,f):p.removeEvent(e,f,c.handle);i[d]&&(delete i[d],j?delete e[h]:e.removeAttribute?e.removeAttribute(h):e[h]=null,p.deletedIds.push(d))}}}}),function(){var a,b;p.uaMatch=function(a){a=a.toLowerCase();var b=/(chrome)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||a.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},a=p.uaMatch(g.userAgent),b={},a.browser&&(b[a.browser]=!0,b.version=a.version),b.chrome?b
 .webkit=!0:b.webkit&&(b.safari=!0),p.browser=b,p.sub=function(){function a(b,c){return new a.fn.init(b,c)}p.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function c(c,d){return d&&d instanceof p&&!(d instanceof a)&&(d=a(d)),p.fn.init.call(this,c,d,b)},a.fn.init.prototype=a.fn;var b=a(e);return a}}();var bH,bI,bJ,bK=/alpha\([^)]*\)/i,bL=/opacity=([^)]*)/,bM=/^(top|right|bottom|left)$/,bN=/^(none|table(?!-c[ea]).+)/,bO=/^margin/,bP=new RegExp("^("+q+")(.*)$","i"),bQ=new RegExp("^("+q+")(?!px)[a-z%]+$","i"),bR=new RegExp("^([-+])=("+q+")","i"),bS={},bT={position:"absolute",visibility:"hidden",display:"block"},bU={letterSpacing:0,fontWeight:400},bV=["Top","Right","Bottom","Left"],bW=["Webkit","O","Moz","ms"],bX=p.fn.toggle;p.fn.extend({css:function(a,c){return p.access(this,function(a,c,d){return d!==b?p.style(a,c,d):p.css(a,c)},a,c,arguments.length>1)},show:function(){return b$(this,!0)},hide:function(){return b$(this)},toggle:f
 unction(a,b){var c=typeof a=="boolean";return p.isFunction(a)&&p.isFunction(b)?bX.apply(this,arguments):this.each(function(){(c?a:bZ(this))?p(this).show():p(this).hide()})}}),p.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bH(a,"opacity");return c===""?"1":c}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":p.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!a||a.nodeType===3||a.nodeType===8||!a.style)return;var f,g,h,i=p.camelCase(c),j=a.style;c=p.cssProps[i]||(p.cssProps[i]=bY(j,i)),h=p.cssHooks[c]||p.cssHooks[i];if(d===b)return h&&"get"in h&&(f=h.get(a,!1,e))!==b?f:j[c];g=typeof d,g==="string"&&(f=bR.exec(d))&&(d=(f[1]+1)*f[2]+parseFloat(p.css(a,c)),g="number");if(d==null||g==="number"&&isNaN(d))return;g==="number"&&!p.cssNumber[i]&&(d+="px");if(!h||!("set"in h)||(d=h.set(a,d,e))!==b)try{j[c]=d}catch(k){}},css:function(a,c,d,e){var f,g,h,i=p.camelCase(c);return c=p.cssProps
 [i]||(p.cssProps[i]=bY(a.style,i)),h=p.cssHooks[c]||p.cssHooks[i],h&&"get"in h&&(f=h.get(a,!0,e)),f===b&&(f=bH(a,c)),f==="normal"&&c in bU&&(f=bU[c]),d||e!==b?(g=parseFloat(f),d||p.isNumeric(g)?g||0:f):f},swap:function(a,b,c){var d,e,f={};for(e in b)f[e]=a.style[e],a.style[e]=b[e];d=c.call(a);for(e in b)a.style[e]=f[e];return d}}),a.getComputedStyle?bH=function(b,c){var d,e,f,g,h=a.getComputedStyle(b,null),i=b.style;return h&&(d=h[c],d===""&&!p.contains(b.ownerDocument,b)&&(d=p.style(b,c)),bQ.test(d)&&bO.test(c)&&(e=i.width,f=i.minWidth,g=i.maxWidth,i.minWidth=i.maxWidth=i.width=d,d=h.width,i.width=e,i.minWidth=f,i.maxWidth=g)),d}:e.documentElement.currentStyle&&(bH=function(a,b){var c,d,e=a.currentStyle&&a.currentStyle[b],f=a.style;return e==null&&f&&f[b]&&(e=f[b]),bQ.test(e)&&!bM.test(b)&&(c=f.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":e,e=f.pixelLeft+"px",f.left=c,d&&(a.runtimeStyle.left=d)),e===""?"auto":e}
 ),p.each(["height","width"],function(a,b){p.cssHooks[b]={get:function(a,c,d){if(c)return a.offsetWidth===0&&bN.test(bH(a,"display"))?p.swap(a,bT,function(){return cb(a,b,d)}):cb(a,b,d)},set:function(a,c,d){return b_(a,c,d?ca(a,b,d,p.support.boxSizing&&p.css(a,"boxSizing")==="border-box"):0)}}}),p.support.opacity||(p.cssHooks.opacity={get:function(a,b){return bL.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=p.isNumeric(b)?"alpha(opacity="+b*100+")":"",f=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&p.trim(f.replace(bK,""))===""&&c.removeAttribute){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bK.test(f)?f.replace(bK,e):f+" "+e}}),p(function(){p.support.reliableMarginRight||(p.cssHooks.marginRight={get:function(a,b){return p.swap(a,{display:"inline-block"},function(){if(b)return bH(a,"marginRight")})}}),!p.support.pixelPosition&&p.fn.position&&p.each(["top","left"
 ],function(a,b){p.cssHooks[b]={get:function(a,c){if(c){var d=bH(a,b);return bQ.test(d)?p(a).position()[b]+"px":d}}}})}),p.expr&&p.expr.filters&&(p.expr.filters.hidden=function(a){return a.offsetWidth===0&&a.offsetHeight===0||!p.support.reliableHiddenOffsets&&(a.style&&a.style.display||bH(a,"display"))==="none"},p.expr.filters.visible=function(a){return!p.expr.filters.hidden(a)}),p.each({margin:"",padding:"",border:"Width"},function(a,b){p.cssHooks[a+b]={expand:function(c){var d,e=typeof c=="string"?c.split(" "):[c],f={};for(d=0;d<4;d++)f[a+bV[d]+b]=e[d]||e[d-2]||e[0];return f}},bO.test(a)||(p.cssHooks[a+b].set=b_)});var cd=/%20/g,ce=/\[\]$/,cf=/\r?\n/g,cg=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,ch=/^(?:select|textarea)/i;p.fn.extend({serialize:function(){return p.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?p.makeArray(this.elements):this}).filter(fun
 ction(){return this.name&&!this.disabled&&(this.checked||ch.test(this.nodeName)||cg.test(this.type))}).map(function(a,b){var c=p(this).val();return c==null?null:p.isArray(c)?p.map(c,function(a,c){return{name:b.name,value:a.replace(cf,"\r\n")}}):{name:b.name,value:c.replace(cf,"\r\n")}}).get()}}),p.param=function(a,c){var d,e=[],f=function(a,b){b=p.isFunction(b)?b():b==null?"":b,e[e.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=p.ajaxSettings&&p.ajaxSettings.traditional);if(p.isArray(a)||a.jquery&&!p.isPlainObject(a))p.each(a,function(){f(this.name,this.value)});else for(d in a)ci(d,a[d],c,f);return e.join("&").replace(cd,"+")};var cj,ck,cl=/#.*$/,cm=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,cn=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,co=/^(?:GET|HEAD)$/,cp=/^\/\//,cq=/\?/,cr=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,cs=/([?&])_=[^&]*/,ct=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,cu=p.fn.load,cv={},cw={},cx=["*/"]+["*"];try{ck=f.href
 }catch(cy){ck=e.createElement("a"),ck.href="",ck=ck.href}cj=ct.exec(ck.toLowerCase())||[],p.fn.load=function(a,c,d){if(typeof a!="string"&&cu)return cu.apply(this,arguments);if(!this.length)return this;var e,f,g,h=this,i=a.indexOf(" ");return i>=0&&(e=a.slice(i,a.length),a=a.slice(0,i)),p.isFunction(c)?(d=c,c=b):c&&typeof c=="object"&&(f="POST"),p.ajax({url:a,type:f,dataType:"html",data:c,complete:function(a,b){d&&h.each(d,g||[a.responseText,b,a])}}).done(function(a){g=arguments,h.html(e?p("<div>").append(a.replace(cr,"")).find(e):a)}),this},p.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){p.fn[b]=function(a){return this.on(b,a)}}),p.each(["get","post"],function(a,c){p[c]=function(a,d,e,f){return p.isFunction(d)&&(f=f||e,e=d,d=b),p.ajax({type:c,url:a,data:d,success:e,dataType:f})}}),p.extend({getScript:function(a,c){return p.get(a,b,c,"script")},getJSON:function(a,b,c){return p.get(a,b,c,"json")},ajaxSetup:function(a,b){return b?cB(a,p
 .ajaxSettings):(b=a,a=p.ajaxSettings),cB(a,b),a},ajaxSettings:{url:ck,isLocal:cn.test(cj[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":cx},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":p.parseJSON,"text xml":p.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:cz(cv),ajaxTransport:cz(cw),ajax:function(a,c){function y(a,c,f,i){var k,s,t,u,w,y=c;if(v===2)return;v=2,h&&clearTimeout(h),g=b,e=i||"",x.readyState=a>0?4:0,f&&(u=cC(l,x,f));if(a>=200&&a<300||a===304)l.ifModified&&(w=x.getResponseHeader("Last-Modified"),w&&(p.lastModified[d]=w),w=x.getResponseHeader("Etag"),w&&(p.etag[d]=w)),a===304?(y="notmodified",k=!0):(k=cD(l,u),y=k.state,s=k.data,t=k.error,k=!t);else{t=y;if(!y||a)y="error",
 a<0&&(a=0)}x.status=a,x.statusText=(c||y)+"",k?o.resolveWith(m,[s,y,x]):o.rejectWith(m,[x,y,t]),x.statusCode(r),r=b,j&&n.trigger("ajax"+(k?"Success":"Error"),[x,l,k?s:t]),q.fireWith(m,[x,y]),j&&(n.trigger("ajaxComplete",[x,l]),--p.active||p.event.trigger("ajaxStop"))}typeof a=="object"&&(c=a,a=b),c=c||{};var d,e,f,g,h,i,j,k,l=p.ajaxSetup({},c),m=l.context||l,n=m!==l&&(m.nodeType||m instanceof p)?p(m):p.event,o=p.Deferred(),q=p.Callbacks("once memory"),r=l.statusCode||{},t={},u={},v=0,w="canceled",x={readyState:0,setRequestHeader:function(a,b){if(!v){var c=a.toLowerCase();a=u[c]=u[c]||a,t[a]=b}return this},getAllResponseHeaders:function(){return v===2?e:null},getResponseHeader:function(a){var c;if(v===2){if(!f){f={};while(c=cm.exec(e))f[c[1].toLowerCase()]=c[2]}c=f[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){return v||(l.mimeType=a),this},abort:function(a){return a=a||w,g&&g.abort(a),y(0,a),this}};o.promise(x),x.success=x.done,x.error=x.fail,x.complete=q.add,x.
 statusCode=function(a){if(a){var b;if(v<2)for(b in a)r[b]=[r[b],a[b]];else b=a[x.status],x.always(b)}return this},l.url=((a||l.url)+"").replace(cl,"").replace(cp,cj[1]+"//"),l.dataTypes=p.trim(l.dataType||"*").toLowerCase().split(s),l.crossDomain==null&&(i=ct.exec(l.url.toLowerCase())||!1,l.crossDomain=i&&i.join(":")+(i[3]?"":i[1]==="http:"?80:443)!==cj.join(":")+(cj[3]?"":cj[1]==="http:"?80:443)),l.data&&l.processData&&typeof l.data!="string"&&(l.data=p.param(l.data,l.traditional)),cA(cv,l,c,x);if(v===2)return x;j=l.global,l.type=l.type.toUpperCase(),l.hasContent=!co.test(l.type),j&&p.active++===0&&p.event.trigger("ajaxStart");if(!l.hasContent){l.data&&(l.url+=(cq.test(l.url)?"&":"?")+l.data,delete l.data),d=l.url;if(l.cache===!1){var z=p.now(),A=l.url.replace(cs,"$1_="+z);l.url=A+(A===l.url?(cq.test(l.url)?"&":"?")+"_="+z:"")}}(l.data&&l.hasContent&&l.contentType!==!1||c.contentType)&&x.setRequestHeader("Content-Type",l.contentType),l.ifModified&&(d=d||l.url,p.lastModified[d]&&x.s
 etRequestHeader("If-Modified-Since",p.lastModified[d]),p.etag[d]&&x.setRequestHeader("If-None-Match",p.etag[d])),x.setRequestHeader("Accept",l.dataTypes[0]&&l.accepts[l.dataTypes[0]]?l.accepts[l.dataTypes[0]]+(l.dataTypes[0]!=="*"?", "+cx+"; q=0.01":""):l.accepts["*"]);for(k in l.headers)x.setRequestHeader(k,l.headers[k]);if(!l.beforeSend||l.beforeSend.call(m,x,l)!==!1&&v!==2){w="abort";for(k in{success:1,error:1,complete:1})x[k](l[k]);g=cA(cw,l,c,x);if(!g)y(-1,"No Transport");else{x.readyState=1,j&&n.trigger("ajaxSend",[x,l]),l.async&&l.timeout>0&&(h=setTimeout(function(){x.abort("timeout")},l.timeout));try{v=1,g.send(t,y)}catch(B){if(v<2)y(-1,B);else throw B}}return x}return x.abort()},active:0,lastModified:{},etag:{}});var cE=[],cF=/\?/,cG=/(=)\?(?=&|$)|\?\?/,cH=p.now();p.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=cE.pop()||p.expando+"_"+cH++;return this[a]=!0,a}}),p.ajaxPrefilter("json jsonp",function(c,d,e){var f,g,h,i=c.data,j=c.url,k=c.jsonp!==!1,l=k&&cG.test(
 j),m=k&&!l&&typeof i=="string"&&!(c.contentType||"").indexOf("application/x-www-form-urlencoded")&&cG.test(i);if(c.dataTypes[0]==="jsonp"||l||m)return f=c.jsonpCallback=p.isFunction(c.jsonpCallback)?c.jsonpCallback():c.jsonpCallback,g=a[f],l?c.url=j.replace(cG,"$1"+f):m?c.data=i.replace(cG,"$1"+f):k&&(c.url+=(cF.test(j)?"&":"?")+c.jsonp+"="+f),c.converters["script json"]=function(){return h||p.error(f+" was not called"),h[0]},c.dataTypes[0]="json",a[f]=function(){h=arguments},e.always(function(){a[f]=g,c[f]&&(c.jsonpCallback=d.jsonpCallback,cE.push(f)),h&&p.isFunction(g)&&g(h[0]),h=g=b}),"script"}),p.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){return p.globalEval(a),a}}}),p.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),p.ajaxTransport("script",function(a){if(a.crossDomain
 ){var c,d=e.head||e.getElementsByTagName("head")[0]||e.documentElement;return{send:function(f,g){c=e.createElement("script"),c.async="async",a.scriptCharset&&(c.charset=a.scriptCharset),c.src=a.url,c.onload=c.onreadystatechange=function(a,e){if(e||!c.readyState||/loaded|complete/.test(c.readyState))c.onload=c.onreadystatechange=null,d&&c.parentNode&&d.removeChild(c),c=b,e||g(200,"success")},d.insertBefore(c,d.firstChild)},abort:function(){c&&c.onload(0,1)}}}});var cI,cJ=a.ActiveXObject?function(){for(var a in cI)cI[a](0,1)}:!1,cK=0;p.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&cL()||cM()}:cL,function(a){p.extend(p.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(p.ajaxSettings.xhr()),p.support.ajax&&p.ajaxTransport(function(c){if(!c.crossDomain||p.support.cors){var d;return{send:function(e,f){var g,h,i=c.xhr();c.username?i.open(c.type,c.url,c.async,c.username,c.password):i.open(c.type,c.url,c.async);if(c.xhrFields)for(h in c.xhrFields)i[h]=c.xhrFields[h];c.m
 imeType&&i.overrideMimeType&&i.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(h in e)i.setRequestHeader(h,e[h])}catch(j){}i.send(c.hasContent&&c.data||null),d=function(a,e){var h,j,k,l,m;try{if(d&&(e||i.readyState===4)){d=b,g&&(i.onreadystatechange=p.noop,cJ&&delete cI[g]);if(e)i.readyState!==4&&i.abort();else{h=i.status,k=i.getAllResponseHeaders(),l={},m=i.responseXML,m&&m.documentElement&&(l.xml=m);try{l.text=i.responseText}catch(a){}try{j=i.statusText}catch(n){j=""}!h&&c.isLocal&&!c.crossDomain?h=l.text?200:404:h===1223&&(h=204)}}}catch(o){e||f(-1,o)}l&&f(h,j,l,k)},c.async?i.readyState===4?setTimeout(d,0):(g=++cK,cJ&&(cI||(cI={},p(a).unload(cJ)),cI[g]=d),i.onreadystatechange=d):d()},abort:function(){d&&d(0,1)}}}});var cN,cO,cP=/^(?:toggle|show|hide)$/,cQ=new RegExp("^(?:([-+])=|)("+q+")([a-z%]*)$","i"),cR=/queueHooks$/,cS=[cY],cT={"*":[function(a,b){var c,d,e=this.createTween(a,b),f=cQ.exec(b),g=e.cur(),h=+g||
 0,i=1,j=20;if(f){c=+f[2],d=f[3]||(p.cssNumber[a]?"":"px");if(d!=="px"&&h){h=p.css(e.elem,a,!0)||c||1;do i=i||".5",h=h/i,p.style(e.elem,a,h+d);while(i!==(i=e.cur()/g)&&i!==1&&--j)}e.unit=d,e.start=h,e.end=f[1]?h+(f[1]+1)*c:c}return e}]};p.Animation=p.extend(cW,{tweener:function(a,b){p.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");var c,d=0,e=a.length;for(;d<e;d++)c=a[d],cT[c]=cT[c]||[],cT[c].unshift(b)},prefilter:function(a,b){b?cS.unshift(a):cS.push(a)}}),p.Tween=cZ,cZ.prototype={constructor:cZ,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(p.cssNumber[c]?"":"px")},cur:function(){var a=cZ.propHooks[this.prop];return a&&a.get?a.get(this):cZ.propHooks._default.get(this)},run:function(a){var b,c=cZ.propHooks[this.prop];return this.options.duration?this.pos=b=p.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this
 .options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):cZ.propHooks._default.set(this),this}},cZ.prototype.init.prototype=cZ.prototype,cZ.propHooks={_default:{get:function(a){var b;return a.elem[a.prop]==null||!!a.elem.style&&a.elem.style[a.prop]!=null?(b=p.css(a.elem,a.prop,!1,""),!b||b==="auto"?0:b):a.elem[a.prop]},set:function(a){p.fx.step[a.prop]?p.fx.step[a.prop](a):a.elem.style&&(a.elem.style[p.cssProps[a.prop]]!=null||p.cssHooks[a.prop])?p.style(a.elem,a.pro

<TRUNCATED>

[11/21] aurora git commit: Remove unused classes from commons fork.

Posted by wf...@apache.org.
http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/resources/org/apache/aurora/common/application/http/graphview/dygraph-extra.js
----------------------------------------------------------------------
diff --git a/commons/src/main/resources/org/apache/aurora/common/application/http/graphview/dygraph-extra.js b/commons/src/main/resources/org/apache/aurora/common/application/http/graphview/dygraph-extra.js
deleted file mode 100644
index 3a353a5..0000000
--- a/commons/src/main/resources/org/apache/aurora/common/application/http/graphview/dygraph-extra.js
+++ /dev/null
@@ -1,367 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*jslint vars: true, nomen: true, plusplus: true, maxerr: 500, indent: 4 */
-
-/**
- * @license
- * Copyright 2011 Juan Manuel Caicedo Carvajal (juan@cavorite.com)
- * MIT-licensed (http://opensource.org/licenses/MIT)
- */
-
-/**
- * @fileoverview This file contains additional features for dygraphs, which
- * are not required but can be useful for certain use cases. Examples include
- * exporting a dygraph as a PNG image.
- */
-
-/**
- * Demo code for exporting a Dygraph object as an image.
- *
- * See: http://cavorite.com/labs/js/dygraphs-export/
- */
-
-Dygraph.Export = {};
-
-Dygraph.Export.DEFAULT_ATTRS = {
-
-    backgroundColor: "transparent",
-
-    //Texts displayed below the chart's x-axis and to the left of the y-axis
-    titleFont: "bold 18px serif",
-    titleFontColor: "black",
-
-    //Texts displayed below the chart's x-axis and to the left of the y-axis
-    axisLabelFont: "bold 14px serif",
-    axisLabelFontColor: "black",
-
-    // Texts for the axis ticks
-    labelFont: "normal 12px serif",
-    labelFontColor: "black",
-
-    // Text for the chart legend
-    legendFont: "bold 12px serif",
-    legendFontColor: "black",
-
-    // Default position for vertical labels
-    vLabelLeft: 20,
-
-    legendHeight: 20,    // Height of the legend area
-	legendMargin: 20,
-	lineHeight: 30,
-	maxlabelsWidth: 0,
-	labelTopMargin: 35,
-	magicNumbertop: 8
-
-};
-
-/**
- * Tests whether the browser supports the canvas API and its methods for
- * drawing text and exporting it as a data URL.
- */
-Dygraph.Export.isSupported = function () {
-    "use strict";
-    try {
-        var canvas = document.createElement("canvas");
-        var context = canvas.getContext("2d");
-        return (!!canvas.toDataURL && !!context.fillText);
-    } catch (e) {
-        // Silent exception.
-    }
-    return false;
-};
-
-/**
- * Exports a dygraph object as a PNG image.
- *
- *  dygraph: A Dygraph object
- *  img: An IMG DOM node
- *  userOptions: An object with the user specified options.
- *
- */
-Dygraph.Export.asPNG = function (dygraph, img, userOptions) {
-    "use strict";
-    var canvas = Dygraph.Export.asCanvas(dygraph, userOptions);
-    img.src = canvas.toDataURL();
-};
-
-/**
- * Exports a dygraph into a single canvas object.
- *
- * Returns a canvas object that can be exported as a PNG.
- *
- *  dygraph: A Dygraph object
- *  userOptions: An object with the user specified options.
- *
- */
-Dygraph.Export.asCanvas = function (dygraph, userOptions) {
-    "use strict";
-    var options = {},
-        canvas = Dygraph.createCanvas();
-
-    Dygraph.update(options, Dygraph.Export.DEFAULT_ATTRS);
-    Dygraph.update(options, userOptions);
-
-    canvas.width = dygraph.width_;
-    canvas.height = dygraph.height_ + options.legendHeight;
-
-    Dygraph.Export.drawPlot(canvas, dygraph, options);
-    Dygraph.Export.drawLegend(canvas, dygraph, options);
-
-    return canvas;
-};
-
-/**
- * Adds the plot and the axes to a canvas context.
- */
-Dygraph.Export.drawPlot = function (canvas, dygraph, options) {
-    "use strict";
-    var ctx = canvas.getContext("2d");
-
-    // Add user defined background
-    ctx.fillStyle = options.backgroundColor;
-    ctx.fillRect(0, 0, canvas.width, canvas.height);
-
-    // Copy the plot canvas into the context of the new image.
-    var plotCanvas = dygraph.hidden_;
-
-    var i = 0;
-
-    ctx.drawImage(plotCanvas, 0, 0);
-
-
-    // Add the x and y axes
-    var axesPluginDict = Dygraph.Export.getPlugin(dygraph, 'Axes Plugin');
-    if (axesPluginDict) {
-        var axesPlugin = axesPluginDict.plugin;
-
-        for (i = 0; i < axesPlugin.ylabels_.length; i++) {
-            Dygraph.Export.putLabel(ctx, axesPlugin.ylabels_[i], options,
-                options.labelFont, options.labelFontColor);
-        }
-
-        for (i = 0; i < axesPlugin.xlabels_.length; i++) {
-            Dygraph.Export.putLabel(ctx, axesPlugin.xlabels_[i], options,
-                options.labelFont, options.labelFontColor);
-        }
-    }
-
-    // Title and axis labels
-
-    var labelsPluginDict = Dygraph.Export.getPlugin(dygraph, 'ChartLabels Plugin');
-    if (labelsPluginDict) {
-        var labelsPlugin = labelsPluginDict.plugin;
-
-        Dygraph.Export.putLabel(ctx, labelsPlugin.title_div_, options,
-            options.titleFont, options.titleFontColor);
-
-        Dygraph.Export.putLabel(ctx, labelsPlugin.xlabel_div_, options,
-            options.axisLabelFont, options.axisLabelFontColor);
-
-        Dygraph.Export.putVerticalLabelY1(ctx, labelsPlugin.ylabel_div_, options,
-            options.axisLabelFont, options.axisLabelFontColor, "center");
-
-        Dygraph.Export.putVerticalLabelY2(ctx, labelsPlugin.y2label_div_, options,
-            options.axisLabelFont, options.axisLabelFontColor, "center");
-    }
-
-
-	for (i = 0; i < dygraph.layout_.annotations.length; i++) {
-        Dygraph.Export.putLabelAnn(ctx, dygraph.layout_.annotations[i], options,
-                options.labelFont, options.labelColor);
-    }
-
-};
-
-/**
- * Draws a label (axis label or graph title) at the same position
- * where the div containing the text is located.
- */
-Dygraph.Export.putLabel = function (ctx, divLabel, options, font, color) {
-    "use strict";
-
-    if (!divLabel || !divLabel.style) {
-        return;
-    }
-
-    var top = parseInt(divLabel.style.top, 10);
-    var left = parseInt(divLabel.style.left, 10);
-
-    if (!divLabel.style.top.length) {
-        var bottom = parseInt(divLabel.style.bottom, 10);
-        var height = parseInt(divLabel.style.height, 10);
-
-        top = ctx.canvas.height - options.legendHeight - bottom - height;
-    }
-
-    // FIXME: Remove this 'magic' number needed to get the line-height.
-    top = top + options.magicNumbertop;
-
-    var width = parseInt(divLabel.style.width, 10);
-
-    switch (divLabel.style.textAlign) {
-    case "center":
-        left = left + Math.ceil(width / 2);
-        break;
-    case "right":
-        left = left + width;
-        break;
-    }
-
-    Dygraph.Export.putText(ctx, left, top, divLabel, font, color);
-};
-
-/**
- * Draws a label Y1 rotated 90 degrees counterclockwise.
- */
-Dygraph.Export.putVerticalLabelY1 = function (ctx, divLabel, options, font, color, textAlign) {
-    "use strict";
-    if (!divLabel) {
-        return;
-    }
-
-    var top = parseInt(divLabel.style.top, 10);
-    var left = parseInt(divLabel.style.left, 10) + parseInt(divLabel.style.width, 10) / 2;
-    var text = divLabel.innerText || divLabel.textContent;
-
-
-    // FIXME: The value of the 'left' property is frequently 0, used the option.
-    if (!left)
-        left = options.vLabelLeft;
-
-    if (textAlign == "center") {
-        var textDim = ctx.measureText(text);
-        top = Math.ceil((ctx.canvas.height - textDim.width) / 2 + textDim.width);
-    }
-
-    ctx.save();
-    ctx.translate(0, ctx.canvas.height);
-    ctx.rotate(-Math.PI / 2);
-
-    ctx.fillStyle = color;
-    ctx.font = font;
-    ctx.textAlign = textAlign;
-    ctx.fillText(text, top, left);
-
-    ctx.restore();
-};
-
-/**
- * Draws a label Y2 rotated 90 degrees clockwise.
- */
-Dygraph.Export.putVerticalLabelY2 = function (ctx, divLabel, options, font, color, textAlign) {
-    "use strict";
-    if (!divLabel) {
-        return;
-    }
-
-    var top = parseInt(divLabel.style.top, 10);
-    var right = parseInt(divLabel.style.right, 10) + parseInt(divLabel.style.width, 10) * 2;
-    var text = divLabel.innerText || divLabel.textContent;
-
-    if (textAlign == "center") {
-        top = Math.ceil(ctx.canvas.height / 2);
-    }
-
-    ctx.save();
-    ctx.translate(parseInt(divLabel.style.width, 10), 0);
-    ctx.rotate(Math.PI / 2);
-
-    ctx.fillStyle = color;
-    ctx.font = font;
-    ctx.textAlign = textAlign;
-    ctx.fillText(text, top, right - ctx.canvas.width);
-
-    ctx.restore();
-};
-
-/**
- * Draws the text contained in 'divLabel' at the specified position.
- */
-Dygraph.Export.putText = function (ctx, left, top, divLabel, font, color) {
-    "use strict";
-    var textAlign = divLabel.style.textAlign || "left";
-    var text = divLabel.innerText || divLabel.textContent;
-
-    ctx.fillStyle = color;
-    ctx.font = font;
-    ctx.textAlign = textAlign;
-    ctx.textBaseline = "middle";
-    ctx.fillText(text, left, top);
-};
-
-/**
- * Draws the legend of a dygraph
- *
- */
-Dygraph.Export.drawLegend = function (canvas, dygraph, options) {
-    "use strict";
-    var ctx = canvas.getContext("2d");
-
-    // Margin from the plot
-    var labelTopMargin = 10;
-
-    // Margin between labels
-    var labelMargin = 5;
-
-    var colors = dygraph.getColors();
-    // Drop the first element, which is the label for the time dimension
-    var labels = dygraph.attr_("labels").slice(1);
-
-    // 1. Compute the width of the labels:
-    var labelsWidth = 0;
-
-    var i;
-    for (i = 0; i < labels.length; i++) {
-        labelsWidth = labelsWidth + ctx.measureText("- " + labels[i]).width + labelMargin;
-    }
-
-    var labelsX = Math.floor((canvas.width - labelsWidth) / 2);
-    var labelsY = canvas.height - options.legendHeight + labelTopMargin;
-
-
-    var labelVisibility=dygraph.attr_("visibility");
-
-    ctx.font = options.legendFont;
-    ctx.textAlign = "left";
-    ctx.textBaseline = "middle";
-
-    var usedColorCount=0;
-    for (i = 0; i < labels.length; i++) {
-        if (labelVisibility[i]) {
-            //TODO Replace the minus sign by a proper dash, although there is a
-            //     problem when the page encoding is different than the encoding
-            //     of this file (UTF-8).
-            var txt = "- " + labels[i];
-            ctx.fillStyle = colors[usedColorCount];
-            usedColorCount++
-            ctx.fillText(txt, labelsX, labelsY);
-            labelsX = labelsX + ctx.measureText(txt).width + labelMargin;
-        }
-    }
-};
-
-/**
- * Finds a plugin by the value returned by its toString method..
- *
- * Returns the the dictionary corresponding to the plugin for the argument.
- * If the plugin is not found, it returns null.
- */
-Dygraph.Export.getPlugin = function(dygraph, name) {
-    for (i = 0; i < dygraph.plugins_.length; i++) {
-        if (dygraph.plugins_[i].plugin.toString() == name) {
-            return dygraph.plugins_[i];
-        }
-    }
-    return null;
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/resources/org/apache/aurora/common/application/http/graphview/grapher.js
----------------------------------------------------------------------
diff --git a/commons/src/main/resources/org/apache/aurora/common/application/http/graphview/grapher.js b/commons/src/main/resources/org/apache/aurora/common/application/http/graphview/grapher.js
deleted file mode 100644
index 247e6d9..0000000
--- a/commons/src/main/resources/org/apache/aurora/common/application/http/graphview/grapher.js
+++ /dev/null
@@ -1,365 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-// Whether there is currently an outbound request.
-var awaitingResponse = false;
-
-var allMetrics = [];     // Names of all available metrics.
-var metrics = {};        // Time series names, mapped to their index in rawData.
-var rawData;             // 2-d array of metric data from the server.
-var evaluatedData = [];  // 2-d array of evaluated metric data.
-
-// Expressions being plotted.
-var expressions = {};
-
-// Timestamp of the most-recent row.
-var lastTimestamp = -1;
-
-// Whether to continuously update the graph with new data..
-var realTime = true;
-
-// Store at most 3600 points per plot.
-var maxPoints = 3600;
-
-// Actual dygraph object.
-var dygraph;
-
-// Formatter for the x axis.
-var xAxisFormatter = function(date, self) {
-  return Dygraph.hmsString_(date);
-}
-
-// Dygraph graph options.
-var options = {
-  axes: { x: { valueFormatter: xAxisFormatter,
-               axisLabelFormatter: xAxisFormatter
-             }
-        },
-  labelsSeparateLines: true,
-  hideOverlayOnMouseOut: false,
-  showRangeSelector: true,
-  labelsDiv: 'legend',
-  legend: 'always',
-};
-
-/**
- * Issues a query to fetch graph data from the server.
- */
-function fetchData() {
-  var metrics = {};
-  $.each(Object.keys(expressions), function(i, name) {
-    $.each(expressions[name].getVars(), function(j, metric) {
-      metrics[metric] = true;
-    });
-  });
-  if ($('#errors').is(':empty') && Object.keys(metrics).length > 0) {
-    sendQuery('?metrics=' + Object.keys(metrics).join(',') + '&since=' + lastTimestamp,
-              handleDataResponse);
-  }
-}
-
-/**
- * Clears error messages from the page.
- */
-function clearErrors() {
-  $('#errors').hide();
-  $('#errors').empty();
-}
-
-function addErrorText(text) {
-  $('#errors').append(text).show();
-}
-
-function addError(expr, error, pos) {
-  throw expr + '\n' + Array(pos + 1).join(' ') + '^ ' + error;
-}
-
-/**
- * Issues a query to fetch time series data from the server.
- * If the request is successful, the provided response handler will be called.
- */
-function sendQuery(query, responseHandler) {
-  if (awaitingResponse) return;
-  if (!realTime) return;
-  awaitingResponse = true;
-
-  var wrappedHandler = function(data) {
-    awaitingResponse = false;
-    responseHandler(data);
-  };
-
-  $.getJSON('/graphdata/' + query, wrappedHandler).error(
-    function(xhr) {
-      addErrorText('Query failed: ' + $.parseJSON(xhr.responseText).error);
-      awaitingResponse = false;
-    });
-}
-
-/**
- * Clears stored data and fetches all plot data.
- */
-function refreshGraph() {
-  append = false;
-  rawData = null;
-  evaluatedData = [];
-  metrics = {};
-  lastTimestamp = -1;
-  fetchData();
-}
-
-/**
- * Redraws the graph with the current data and options.
- */
-function redraw() {
-  options.file = evaluatedData;
-  options.labels = ['t'].concat(Object.keys(expressions));
-  dygraph.updateOptions(options);
-}
-
-/**
- * Handles a data query response from the server.
- */
-function handleDataResponse(resp) {
-  var newData = resp.data;
-
-  if (newData.length == 0) {
-    return;
-  }
-
-  var append = false;
-  if (!rawData) {
-    rawData = newData;
-    $.each(resp.names, function(i, name) {
-      metrics[name] = i;
-    });
-  } else {
-    // Append the new table to the old table.
-    // TODO(William Farner): Make sure metricNames indices match up.
-    rawData = rawData.concat(newData);
-    append = true;
-  }
-
-  // Feed data into expressions.
-  $.each(newData, function(j, point) {
-    evaluatedData.push([point[metrics["time"]]].concat(
-      $.map(Object.keys(expressions), function(name) {
-        return expressions[name].evaluate(point);
-      })));
-  });
-
-  // Figure out what the last timestamp is.
-  lastTimestamp = rawData[rawData.length - 1][metrics["time"]];
-
-  // Evict the oldest rows.
-  if (rawData.length > maxPoints) {
-    rawData.splice(0, rawData.length - maxPoints);
-  }
-  if (evaluatedData.length > maxPoints) {
-    evaluatedData.splice(0, evaluatedData.length - maxPoints);
-  }
-
-  if (append) {
-    redraw();
-  } else {
-    options.labels = ['t'].concat(Object.keys(expressions));
-    dygraph = new Dygraph($('#dygraph')[0], evaluatedData, options);
-  }
-}
-
-/**
- * Calls the apply function with the parsed value extracted from a text field.
- * If the value of the text field is not a valid number, the apply function will
- * not be called.
- */
-function tryApply(textField, numberParser, applyFunction) {
-  var number = numberParser(textField.value);
-  if (!isNaN(number)) {
-    applyFunction(number);
-  }
-
-  return false;
-}
-
-/**
- * Convenience function to call tryApply() if the provided key press event
- * was for the enter key.
- */
-function applyOnEnter(event, textField, numberParser, applyFunction) {
-  if (event.keyCode == 13) tryApply(textField, numberParser, applyFunction);
-}
-
-function applyQuery() {
-  var query = $('#query').val();
-  clearErrors();
-  $('#links').empty();
-  expressions = {};
-  $.each($('#query').val().replace(/[ \t]/g, '').split('\n'), function(i, query) {
-    if (query) {
-      try {
-        expressions[query] = parser.parse(query);
-      } catch (err) {
-        addErrorText(err);
-      }
-    }
-  });
-  refreshGraph();
-  $('#links')
-    .append($('<a>', {
-      text: 'link',
-      href: '?query=' + encodeURIComponent($('#query').val()),
-      target: 'none'}))
-    .append($('<br />'))
-    .append($('<a>', {
-      text: 'img',
-      href: '#',
-      id: 'download'}));
-  $('#download').click(function() {
-    window.location = Dygraph.Export.asCanvas(dygraph).toDataURL('image/png');
-  });
-}
-
-$(document).ready(function() {
-  $('#submit').click(applyQuery);
-  var fieldApplier = function(selector, verify, apply) {
-    $(selector).keypress(function(e) {
-      applyOnEnter(e, this, verify, apply);
-    });
-    $(selector).blur(function() {
-      tryApply(this, verify, apply);
-    });
-  }
-  fieldApplier('#yMin', parseFloat, function(ymin) {
-    dygraph.updateOptions({'valueRange': [ymin, dygraph.yAxisRange(0)[1]]});
-  });
-  fieldApplier('#yMax', parseFloat, function(ymax) {
-    dygraph.updateOptions({'valueRange': [dygraph.yAxisRange(0)[0], ymax]});
-  });
-  fieldApplier('#smoothing', parseInt, function(value) {
-    options.rollPeriod = value;
-    redraw();
-  });
-  $('#realTime').click(function() {
-    realTime = !realTime;
-    redraw();
-  });
-
-  sendQuery('', function(metrics) {
-    metrics.sort();
-    allMetrics = metrics;
-    $.each(metrics, function(i, metric) {
-      $('#availableMetrics')
-          .append($('<option></option>')
-          .attr('value', metric)
-          .text(metric));
-    });
-    $('#availableMetrics').change(function() {
-      var q = $('#query');
-      var pos = q[0].selectionStart;
-      var adjustedPos;
-      var val = q.val();
-      var metric = $('#availableMetrics').val();
-      if (pos == val.length) {
-        // The cursor is at the end.  For convenience, append the selection
-        // and insert a newline.  This simplifies selection of multiple plots.
-        q.val(val + metric + '\n');
-        adjustedPos = pos + metric.length + 1;
-      } else {
-        q.val(val.substring(0, pos) + metric + val.substring(pos));
-        adjustedPos = val.substring(0, pos).length + metric.length;
-      }
-      q[0].selectionStart = adjustedPos;
-      q[0].selectionEnd = adjustedPos;
-    });
-
-    var termBounds = function() {
-      var isIdChar = function(c) {
-        return /[\w\-]/g.exec(c);
-      };
-      var pos = $('#query')[0].selectionStart;
-      var fullQuery = $('#query').val();
-      if (pos > 0 && isIdChar(fullQuery.charAt(pos - 1))) {
-        if (fullQuery.length > pos && isIdChar(fullQuery.charAt(pos))) {
-          // Break out if this is editing within a word.
-          return;
-        }
-
-        // Walk backwards to the beginning of the word.
-        var wordStart = pos;
-        while (wordStart > 0 && isIdChar(fullQuery.charAt(wordStart - 1))) {
-          wordStart--;
-        }
-        return {
-          wordStart: wordStart,
-          pos: pos
-        };
-      }
-    };
-    $('#query').autocomplete({
-      delay: 0,
-      source: function(request, response) {
-        var results = [];
-        var term = termBounds();
-        if (term) {
-          var corpus = $.map(allMetrics, function(metric) {
-            return {
-              label: metric,
-              value: metric
-            };
-          });
-          corpus = corpus.concat($.map(Object.keys(parser.functions), function(f) {
-            return {
-              label: parser.functions[f].help, value: f
-            };
-          }));
-          var text = $('#query').val().substring(term.wordStart, term.pos);
-          response($.ui.autocomplete.filter(corpus, text));
-        } else {
-          response([]);
-        }
-      },
-      select: function(event, ui) {
-        var query = $('#query').val()
-        var bounds = termBounds();
-        if (bounds) {
-          this.value = query.substring(0, bounds.wordStart)
-              + ui.item.value
-              + query.substring(bounds.pos);
-          var adjustedPos = bounds.wordStart + ui.item.value.length;
-          // Note: This is not likely to work in IE.
-          $('#query')[0].selectionStart = adjustedPos;
-          $('#query')[0].selectionEnd = adjustedPos;
-        }
-        return false;
-      },
-      focus: function() { return false; }
-    });
-  });
-  // Submit on alt/option-enter.
-  $('#query').keypress(function(e) {
-    if (e.which == 13 && e.altKey) {
-      applyQuery();
-      return false;
-    }
-  });
-  var getUrlParam = function(name) {
-    var match = RegExp(name + '=' + '(.+?)(&|$)').exec(location.search);
-    return match ? decodeURIComponent(match[1]) : null;
-  };
-  var urlQuery = getUrlParam('query');
-  if (urlQuery != null) {
-    $('#query').val(urlQuery);
-    applyQuery();
-  }
-
-  setInterval(fetchData, 1000);
-});

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/resources/org/apache/aurora/common/application/http/graphview/graphview.html
----------------------------------------------------------------------
diff --git a/commons/src/main/resources/org/apache/aurora/common/application/http/graphview/graphview.html b/commons/src/main/resources/org/apache/aurora/common/application/http/graphview/graphview.html
deleted file mode 100755
index dd3fd5d..0000000
--- a/commons/src/main/resources/org/apache/aurora/common/application/http/graphview/graphview.html
+++ /dev/null
@@ -1,84 +0,0 @@
-<?xml version='1.0' encoding='utf-8'?>
-<!--
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-
--->
-<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN'
-    'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
-
-<html>
-  <head>
-    <title>Server Graphing</title>
-    <script src='//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js'></script>
-    <script src='//ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js'></script>
-    <link href='//ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/themes/base/jquery.ui.all.css'
-          rel='stylesheet'>
-    <link href='//netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/css/bootstrap-combined.min.css'
-          rel='stylesheet'>
-    <script src='//netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/js/bootstrap.min.js'></script>
-    <script src='graphview/dygraph-combined.js'></script>
-    <script src='graphview/dygraph-extra.js'></script>
-    <script src='graphview/grapher.js'></script>
-    <script src='graphview/parser.js'></script>
-  </head>
-  <body>
-    <h2>Metrics</h2>
-    <div style='width: 50%; margin:20px; float:left;'>
-      <select id='availableMetrics'></select>
-      <br />
-      <div>
-        <textarea id='query'
-                  rows='4'
-                  style='width:100%; box-sizing:border-box;'
-                  placeholder='Type arithmetic expressions using metrics (lines plot separately).'></textarea>
-        <button class='btn' id='submit' type='button' style='float:right;'>Plot</button>
-      </div>
-      <pre id='errors' style='display: none; clear: both'></pre>
-      <br />
-      <br />
-      <table>
-        <tr>
-          <td>
-            <label for='yMin'>Y min</label>
-            <input class='input-mini' type='text' size='4' id='yMin' />
-          </td>
-          <td>
-            <label for='yMax'>Y max</label>
-            <input class='input-mini' type='text' size='4' id='yMax' />
-          </td>
-        </tr>
-        <tr>
-          <td>
-            <label for='smoothing'>Smooth</label>
-            <div class='input-append'>
-              <input class='input-mini' type='text' size='4' id='smoothing' />
-              <span class='add-on'>pt</span>
-            </div>
-          </td>
-          <td align='right' valign='bottom'>
-            <div>
-              <label for='realTime'>Pause</label>
-              <input type='checkbox' id='realTime' />
-            </div>
-          </td>
-        </tr>
-      </table>
-    </div>
-    <div style='width:40%; float:left; margin:20px;'>
-      <div id='links'></div>
-      <div id='dygraph' style='width:100%;'></div>
-      <div id='legend'></div>
-    </div>
-  </body>
-</html>

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/resources/org/apache/aurora/common/application/http/graphview/parser.js
----------------------------------------------------------------------
diff --git a/commons/src/main/resources/org/apache/aurora/common/application/http/graphview/parser.js b/commons/src/main/resources/org/apache/aurora/common/application/http/graphview/parser.js
deleted file mode 100644
index 17acf84..0000000
--- a/commons/src/main/resources/org/apache/aurora/common/application/http/graphview/parser.js
+++ /dev/null
@@ -1,337 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-// TODO(William Farner): A unit test is sorely needed here.  Add a unit test for jsirois to use
-// as a starter for pants support for jsunit.
-
-// Declare namespace.
-parser = {};
-
-parser.Abs = function(args) {
-  if (args.length != 1) {
-    throw "abs() accepts exactly one argument.";
-  }
-  this.arg = args[0];
-};
-parser.Abs.help = "abs(num)";
-parser.Abs.prototype.evaluate = function(vars) {
-  return Math.abs(this.arg.evaluate(vars));
-};
-
-
-parser.Ceil = function(args) {
-  if (args.length != 1) {
-    throw "ceil() accepts exactly one argument.";
-  }
-  this.arg = args[0];
-};
-parser.Ceil.help = "ceil(num)";
-parser.Ceil.prototype.evaluate = function(vars) {
-  return Math.ceil(this.arg.evaluate(vars));
-};
-
-
-parser.Floor = function(args) {
-  if (args.length != 1) {
-    throw "floor() accepts exactly one argument.";
-  }
-  this.arg = args[0];
-};
-parser.Floor.help = "floor(num)";
-parser.Floor.prototype.evaluate = function(vars) {
-  return Math.floor(this.arg.evaluate(vars));
-};
-
-
-parser.Log = function(args) {
-  if (args.length != 1) {
-    throw "log() accepts exactly one argument.";
-  }
-  this.arg = args[0];
-};
-parser.Log.help = "log(num)";
-parser.Log.prototype.evaluate = function(vars) {
-  return Math.log(this.args.evaluate(vars));
-};
-
-
-parser.Rate = function(args) {
-  if (args.length == 1) {
-    this.winLen = 1;
-    this.arg = args[0];
-  } else if (args.length == 2) {
-    if (!(args[0] instanceof parser.Constant)) {
-      throw "the first argument to rate() must be a constant.";
-    }
-    this.winLen = args[0].c;
-    this.arg = args[1];
-  } else {
-    throw "rate() accepts one or two arguments.";
-  }
-
-  this.samples = [];
-  this.timeInput = new parser.Var(-1, "time");
-};
-parser.Rate.help = "rate([window size,] var)";
-parser.Rate.prototype.evaluate = function(vars) {
-  var newY = this.arg.evaluate(vars);
-  var newT = this.timeInput.evaluate(vars);
-  this.samples.push([newY, newT]);
-  var oldest = this.samples[0];
-  if (this.samples.length > this.winLen) {
-    this.samples.splice(0, this.samples.length - this.winLen);
-  }
-  var denom = newT - oldest[1];
-  // Assumes time unit is milliseconds.
-  return (denom == 0) ? 0 : ((1000 * (newY - oldest[0])) / denom);
-};
-
-
-parser.Round = function(args) {
-  if (args.length != 1) {
-    throw "round() accepts exactly one argument.";
-  }
-  this.arg = args[0];
-};
-parser.Round.help = "round(num)";
-parser.Round.prototype.evaluate = function(vars) {
-  return Math.round(this.arg.evaluate(vars));
-};
-
-
-parser.Sqrt = function(args) {
-  if (args.length != 1) {
-    throw "sqrt() accepts exactly one argument.";
-  }
-  this.arg = args[0];
-};
-parser.Sqrt.help = "sqrt(num)";
-parser.Sqrt.prototype.evaluate = function(vars) {
-  return Math.sqrt(this.arg.evaluate(vars));
-};
-
-
-parser.functions = {
-  'abs':    parser.Abs,
-  'ceil':   parser.Ceil,
-  'floor':  parser.Floor,
-  'log':    parser.Log,
-  'rate':   parser.Rate,
-  'round':  parser.Round,
-  'sqrt':   parser.Sqrt
-};
-
-
-parser.Operator = function(evaluator) {
-  this.evaluator = evaluator;
-};
-parser._operators = {
-    '+': new parser.Operator(function(a, b) { return a + b; }),
-    '-': new parser.Operator(function(a, b) { return a - b; }),
-    '*': new parser.Operator(function(a, b) { return a * b; }),
-    '/': new parser.Operator(function(a, b) { return a / b; })
-};
-
-
-parser.Token = function(start, text) {
-  this.start = start;
-  this.text = text;
-};
-
-
-parser.Part = function(start) {
-  this.start = start;
-};
-parser.Part.prototype.getVars = function() {
-  return [];
-};
-
-
-parser.MetaPart = function(start, args) {
-  this.Part = parser.Part;
-  this.Part(start);
-  this.args = args || [];
-};
-parser.MetaPart.prototype.getVars = function() {
-  var all = [];
-  $.each(this.args, function(i, arg) {
-    all = all.concat(arg.getVars());
-  });
-  return all;
-};
-
-
-parser.Function = function(start, evaluator, args) {
-  this.MetaPart = parser.MetaPart;
-  this.MetaPart(start, args);
-  this.evaluator = evaluator;
-};
-parser.Function.prototype = new parser.MetaPart();
-parser.Function.prototype.evaluate = function(vars) {
-  return this.evaluator.evaluate(vars);
-};
-
-
-parser.Operation = function(start, op) {
-  this.MetaPart = parser.MetaPart;
-  this.MetaPart(start, []);
-  this.op = op;
-};
-parser.Operation.prototype = new parser.MetaPart();
-parser.Operation.prototype.evaluate = function(vars) {
-  var result = this.args[0].evaluate(vars);
-  for (var i = 1; i < this.args.length; i++) {
-    result = this.op.evaluator(result, this.args[i].evaluate(vars));
-  }
-  return result;
-};
-
-
-parser.Constant = function(start, c) {
-  this.Part = parser.Part;
-  this.Part(start);
-  this.c = parseFloat(c);
-};
-parser.Constant.prototype = new parser.Part();
-parser.Constant.prototype.evaluate = function() {
-  return this.c;
-};
-
-
-parser.Var = function(start, name) {
-  this.Part = parser.Part;
-  this.Part(start);
-  this.name = name;
-};
-parser.Var.prototype.evaluate = function(vars) {
-  // TODO(William Farner): Clean this up - currently it's reaching out
-  // to state within grapher.js.
-  return vars[metrics[this.name]];
-};
-parser.Var.prototype.getVars = function() {
-  return [this.name];
-};
-
-
-parser.tokenize = function(str, offset, isDelimiter) {
-  if (offset === undefined) {
-    offset = 0;
-  }
-
-  var level = 0;
-  var start = 0;
-  var tokens = [];
-  for (var i = 0; i < str.length; i++) {
-    var c = str.charAt(i);
-    if (c == '(') {
-      level += 1;
-      continue;
-    } else if (c == ')') {
-      level -= 1;
-      continue;
-    }
-
-    if (level == 0) {
-      if (isDelimiter(c)) {
-        var token = str.substring(start, i);
-        if (token.length == 0) {
-          addError(str, 'Missing operand', i + offset);
-        }
-        tokens.push(new parser.Token(start + offset, token));
-        tokens.push(new parser.Token(start, c));
-        start = i + 1;
-      }
-    }
-  }
-
-  var token = str.substring(start);
-  if (token.length == 0) {
-    addError(str, 'Expected expression but found operator', start + offset);
-  }
-  tokens.push(new parser.Token(start + offset, str.substring(start)));
-
-  return tokens;
-};
-
-var _FUNCTION_CALL_RE = /^(\w+)\((.*)\)$/g;
-var _SUB_EXPRESSION_RE = /^\((.*)\)$/g;
-var _PAREN_RE = /([\(\)])/;
-
-parser.parse = function(query, offset) {
-  // Split the expression at operator boundaries in the top-level scope.
-  var tokens = parser.tokenize(query, offset, function(c) {
-    return parser._operators[c];
-  });
-  tokens = $.map(tokens, function(token) {
-    var op = parser._operators[token.text];
-    return op ? new parser.Operation(token.start, op) : token;
-  });
-
-  var result = [];
-  $.each(tokens, function(i, token) {
-    if (token instanceof parser.Operation) {
-      token.args.push(result.splice(result.length - 1, 1)[0]);
-      result.push(token);
-      return;
-    }
-
-    // Match a function call.
-    var parsed;
-    var match = _FUNCTION_CALL_RE.exec(token.text);
-    if (match) {
-      var f = match[1];
-      var arg = match[2];
-      if (!parser.functions[f]) {
-        addError(query, 'Unrecognized function ' + f, token.start);
-      }
-      var parsedArg = parser.parse(arg, token.start + 1);
-      // Split and parse function args.
-      var argTokens = parser.tokenize(arg, token.start + 1, function(c) { return c == ','; });
-      argTokens = $.grep(argTokens, function(argToken) { return argToken.text != ','; });
-      var parsedArgs = $.map(argTokens, function(argToken) {
-        return parser.parse(argToken.text, argToken.start);
-      });
-      parsed = new parser.Function(
-          token.start,
-          new parser.functions[f](parsedArgs), parsedArgs);
-    } else {
-      // Match a sub expression.
-      match = _SUB_EXPRESSION_RE.exec(token.text);
-      if (match) {
-        parsed = parser.parse(match[1], token.start + 1);
-      } else {
-        match = _PAREN_RE.exec(token.text);
-        if (match) {
-          addError(query, 'Unmatched paren', token.start + token.text.indexOf(match[1]));
-        }
-        if (isNaN(token.text)) {
-          parsed = new parser.Var(token.start, token.text);
-        } else {
-          parsed = new parser.Constant(token.start, token.text);
-        }
-      }
-    }
-
-    var lastResult = result.length == 0 ? null : result[result.length - 1];
-    if (lastResult instanceof parser.Operation) {
-      lastResult.args.push(parsed);
-    } else {
-      result.push(parsed);
-    }
-  });
-
-  if (result.length != 1) {
-    throw 'Unexpected state.';
-  }
-  return result[0];
-};

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/resources/org/apache/aurora/common/common/webassets/bootstrap/2.1.1/css/bootstrap-responsive.min.css
----------------------------------------------------------------------
diff --git a/commons/src/main/resources/org/apache/aurora/common/common/webassets/bootstrap/2.1.1/css/bootstrap-responsive.min.css b/commons/src/main/resources/org/apache/aurora/common/common/webassets/bootstrap/2.1.1/css/bootstrap-responsive.min.css
deleted file mode 100644
index c39fd97..0000000
--- a/commons/src/main/resources/org/apache/aurora/common/common/webassets/bootstrap/2.1.1/css/bootstrap-responsive.min.css
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- */.clearfix{*zoom:1}.clearfix:before,.clearfix:after{display:table;line-height:0;content:""}.clearfix:after{clear:both}.hide-text{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.input-block-level{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.hidden{display:none;visibility:hidden}.visible-phone{display:none!important}.visible-tablet{display:none!important}.hidden-desktop{display:none!important}.visible-desktop{display:inherit!important}@media(min-width:768px) and (max-width:979px){.hidden-desktop{display:inherit!important}.visible-desktop{display:none!important}.visible-tablet{display:inherit!important}.hidden-tablet{display:none!important}}@media(max-width:767px){.hidden-desktop{display:inherit!important}.visible-desktop{display:none!important}.visible-phone{display:inherit!important}.hidden-phone{display:none!important}}@media(min-width:1200px){.row{margin-left:-30px;*zo
 om:1}.row:before,.row:after{display:table;line-height:0;content:""}.row:after{clear:both}[class*="span"]{float:left;min-height:1px;margin-left:30px}.container,.navbar-static-top .container,.navbar-fixed-top .container,.navbar-fixed-bottom .container{width:1170px}.span12{width:1170px}.span11{width:1070px}.span10{width:970px}.span9{width:870px}.span8{width:770px}.span7{width:670px}.span6{width:570px}.span5{width:470px}.span4{width:370px}.span3{width:270px}.span2{width:170px}.span1{width:70px}.offset12{margin-left:1230px}.offset11{margin-left:1130px}.offset10{margin-left:1030px}.offset9{margin-left:930px}.offset8{margin-left:830px}.offset7{margin-left:730px}.offset6{margin-left:630px}.offset5{margin-left:530px}.offset4{margin-left:430px}.offset3{margin-left:330px}.offset2{margin-left:230px}.offset1{margin-left:130px}.row-fluid{width:100%;*zoom:1}.row-fluid:before,.row-fluid:after{display:table;line-height:0;content:""}.row-fluid:after{clear:both}.row-fluid [class*="span"]{display:block
 ;float:left;width:100%;min-height:30px;margin-left:2.564102564102564%;*margin-left:2.5109110747408616%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.row-fluid [class*="span"]:first-child{margin-left:0}.row-fluid .span12{width:100%;*width:99.94680851063829%}.row-fluid .span11{width:91.45299145299145%;*width:91.39979996362975%}.row-fluid .span10{width:82.90598290598291%;*width:82.8527914166212%}.row-fluid .span9{width:74.35897435897436%;*width:74.30578286961266%}.row-fluid .span8{width:65.81196581196582%;*width:65.75877432260411%}.row-fluid .span7{width:57.26495726495726%;*width:57.21176577559556%}.row-fluid .span6{width:48.717948717948715%;*width:48.664757228587014%}.row-fluid .span5{width:40.17094017094017%;*width:40.11774868157847%}.row-fluid .span4{width:31.623931623931625%;*width:31.570740134569924%}.row-fluid .span3{width:23.076923076923077%;*width:23.023731587561375%}.row-fluid .span2{width:14.52991452991453%;*width:14.476723040552828%}.row-flu
 id .span1{width:5.982905982905983%;*width:5.929714493544281%}.row-fluid .offset12{margin-left:105.12820512820512%;*margin-left:105.02182214948171%}.row-fluid .offset12:first-child{margin-left:102.56410256410257%;*margin-left:102.45771958537915%}.row-fluid .offset11{margin-left:96.58119658119658%;*margin-left:96.47481360247316%}.row-fluid .offset11:first-child{margin-left:94.01709401709402%;*margin-left:93.91071103837061%}.row-fluid .offset10{margin-left:88.03418803418803%;*margin-left:87.92780505546462%}.row-fluid .offset10:first-child{margin-left:85.47008547008548%;*margin-left:85.36370249136206%}.row-fluid .offset9{margin-left:79.48717948717949%;*margin-left:79.38079650845607%}.row-fluid .offset9:first-child{margin-left:76.92307692307693%;*margin-left:76.81669394435352%}.row-fluid .offset8{margin-left:70.94017094017094%;*margin-left:70.83378796144753%}.row-fluid .offset8:first-child{margin-left:68.37606837606839%;*margin-left:68.26968539734497%}.row-fluid .offset7{margin-left:62.3
 93162393162385%;*margin-left:62.28677941443899%}.row-fluid .offset7:first-child{margin-left:59.82905982905982%;*margin-left:59.72267685033642%}.row-fluid .offset6{margin-left:53.84615384615384%;*margin-left:53.739770867430444%}.row-fluid .offset6:first-child{margin-left:51.28205128205128%;*margin-left:51.175668303327875%}.row-fluid .offset5{margin-left:45.299145299145295%;*margin-left:45.1927623204219%}.row-fluid .offset5:first-child{margin-left:42.73504273504273%;*margin-left:42.62865975631933%}.row-fluid .offset4{margin-left:36.75213675213675%;*margin-left:36.645753773413354%}.row-fluid .offset4:first-child{margin-left:34.18803418803419%;*margin-left:34.081651209310785%}.row-fluid .offset3{margin-left:28.205128205128204%;*margin-left:28.0987452264048%}.row-fluid .offset3:first-child{margin-left:25.641025641025642%;*margin-left:25.53464266230224%}.row-fluid .offset2{margin-left:19.65811965811966%;*margin-left:19.551736679396257%}.row-fluid .offset2:first-child{margin-left:17.094017
 094017094%;*margin-left:16.98763411529369%}.row-fluid .offset1{margin-left:11.11111111111111%;*margin-left:11.004728132387708%}.row-fluid .offset1:first-child{margin-left:8.547008547008547%;*margin-left:8.440625568285142%}input,textarea,.uneditable-input{margin-left:0}.controls-row [class*="span"]+[class*="span"]{margin-left:30px}input.span12,textarea.span12,.uneditable-input.span12{width:1156px}input.span11,textarea.span11,.uneditable-input.span11{width:1056px}input.span10,textarea.span10,.uneditable-input.span10{width:956px}input.span9,textarea.span9,.uneditable-input.span9{width:856px}input.span8,textarea.span8,.uneditable-input.span8{width:756px}input.span7,textarea.span7,.uneditable-input.span7{width:656px}input.span6,textarea.span6,.uneditable-input.span6{width:556px}input.span5,textarea.span5,.uneditable-input.span5{width:456px}input.span4,textarea.span4,.uneditable-input.span4{width:356px}input.span3,textarea.span3,.uneditable-input.span3{width:256px}input.span2,textarea.spa
 n2,.uneditable-input.span2{width:156px}input.span1,textarea.span1,.uneditable-input.span1{width:56px}.thumbnails{margin-left:-30px}.thumbnails>li{margin-left:30px}.row-fluid .thumbnails{margin-left:0}}@media(min-width:768px) and (max-width:979px){.row{margin-left:-20px;*zoom:1}.row:before,.row:after{display:table;line-height:0;content:""}.row:after{clear:both}[class*="span"]{float:left;min-height:1px;margin-left:20px}.container,.navbar-static-top .container,.navbar-fixed-top .container,.navbar-fixed-bottom .container{width:724px}.span12{width:724px}.span11{width:662px}.span10{width:600px}.span9{width:538px}.span8{width:476px}.span7{width:414px}.span6{width:352px}.span5{width:290px}.span4{width:228px}.span3{width:166px}.span2{width:104px}.span1{width:42px}.offset12{margin-left:764px}.offset11{margin-left:702px}.offset10{margin-left:640px}.offset9{margin-left:578px}.offset8{margin-left:516px}.offset7{margin-left:454px}.offset6{margin-left:392px}.offset5{margin-left:330px}.offset4{marg
 in-left:268px}.offset3{margin-left:206px}.offset2{margin-left:144px}.offset1{margin-left:82px}.row-fluid{width:100%;*zoom:1}.row-fluid:before,.row-fluid:after{display:table;line-height:0;content:""}.row-fluid:after{clear:both}.row-fluid [class*="span"]{display:block;float:left;width:100%;min-height:30px;margin-left:2.7624309392265194%;*margin-left:2.709239449864817%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.row-fluid [class*="span"]:first-child{margin-left:0}.row-fluid .span12{width:100%;*width:99.94680851063829%}.row-fluid .span11{width:91.43646408839778%;*width:91.38327259903608%}.row-fluid .span10{width:82.87292817679558%;*width:82.81973668743387%}.row-fluid .span9{width:74.30939226519337%;*width:74.25620077583166%}.row-fluid .span8{width:65.74585635359117%;*width:65.69266486422946%}.row-fluid .span7{width:57.18232044198895%;*width:57.12912895262725%}.row-fluid .span6{width:48.61878453038674%;*width:48.56559304102504%}.row-fluid .span5{width:
 40.05524861878453%;*width:40.00205712942283%}.row-fluid .span4{width:31.491712707182323%;*width:31.43852121782062%}.row-fluid .span3{width:22.92817679558011%;*width:22.87498530621841%}.row-fluid .span2{width:14.3646408839779%;*width:14.311449394616199%}.row-fluid .span1{width:5.801104972375691%;*width:5.747913483013988%}.row-fluid .offset12{margin-left:105.52486187845304%;*margin-left:105.41847889972962%}.row-fluid .offset12:first-child{margin-left:102.76243093922652%;*margin-left:102.6560479605031%}.row-fluid .offset11{margin-left:96.96132596685082%;*margin-left:96.8549429881274%}.row-fluid .offset11:first-child{margin-left:94.1988950276243%;*margin-left:94.09251204890089%}.row-fluid .offset10{margin-left:88.39779005524862%;*margin-left:88.2914070765252%}.row-fluid .offset10:first-child{margin-left:85.6353591160221%;*margin-left:85.52897613729868%}.row-fluid .offset9{margin-left:79.8342541436464%;*margin-left:79.72787116492299%}.row-fluid .offset9:first-child{margin-left:77.0718232
 0441989%;*margin-left:76.96544022569647%}.row-fluid .offset8{margin-left:71.2707182320442%;*margin-left:71.16433525332079%}.row-fluid .offset8:first-child{margin-left:68.50828729281768%;*margin-left:68.40190431409427%}.row-fluid .offset7{margin-left:62.70718232044199%;*margin-left:62.600799341718584%}.row-fluid .offset7:first-child{margin-left:59.94475138121547%;*margin-left:59.838368402492065%}.row-fluid .offset6{margin-left:54.14364640883978%;*margin-left:54.037263430116376%}.row-fluid .offset6:first-child{margin-left:51.38121546961326%;*margin-left:51.27483249088986%}.row-fluid .offset5{margin-left:45.58011049723757%;*margin-left:45.47372751851417%}.row-fluid .offset5:first-child{margin-left:42.81767955801105%;*margin-left:42.71129657928765%}.row-fluid .offset4{margin-left:37.01657458563536%;*margin-left:36.91019160691196%}.row-fluid .offset4:first-child{margin-left:34.25414364640884%;*margin-left:34.14776066768544%}.row-fluid .offset3{margin-left:28.45303867403315%;*margin-left:
 28.346655695309746%}.row-fluid .offset3:first-child{margin-left:25.69060773480663%;*margin-left:25.584224756083227%}.row-fluid .offset2{margin-left:19.88950276243094%;*margin-left:19.783119783707537%}.row-fluid .offset2:first-child{margin-left:17.12707182320442%;*margin-left:17.02068884448102%}.row-fluid .offset1{margin-left:11.32596685082873%;*margin-left:11.219583872105325%}.row-fluid .offset1:first-child{margin-left:8.56353591160221%;*margin-left:8.457152932878806%}input,textarea,.uneditable-input{margin-left:0}.controls-row [class*="span"]+[class*="span"]{margin-left:20px}input.span12,textarea.span12,.uneditable-input.span12{width:710px}input.span11,textarea.span11,.uneditable-input.span11{width:648px}input.span10,textarea.span10,.uneditable-input.span10{width:586px}input.span9,textarea.span9,.uneditable-input.span9{width:524px}input.span8,textarea.span8,.uneditable-input.span8{width:462px}input.span7,textarea.span7,.uneditable-input.span7{width:400px}input.span6,textarea.span6,
 .uneditable-input.span6{width:338px}input.span5,textarea.span5,.uneditable-input.span5{width:276px}input.span4,textarea.span4,.uneditable-input.span4{width:214px}input.span3,textarea.span3,.uneditable-input.span3{width:152px}input.span2,textarea.span2,.uneditable-input.span2{width:90px}input.span1,textarea.span1,.uneditable-input.span1{width:28px}}@media(max-width:767px){body{padding-right:20px;padding-left:20px}.navbar-fixed-top,.navbar-fixed-bottom,.navbar-static-top{margin-right:-20px;margin-left:-20px}.container-fluid{padding:0}.dl-horizontal dt{float:none;width:auto;clear:none;text-align:left}.dl-horizontal dd{margin-left:0}.container{width:auto}.row-fluid{width:100%}.row,.thumbnails{margin-left:0}.thumbnails>li{float:none;margin-left:0}[class*="span"],.row-fluid [class*="span"]{display:block;float:none;width:100%;margin-left:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.span12,.row-fluid .span12{width:100%;-webkit-box-sizing:border-box;-moz-
 box-sizing:border-box;box-sizing:border-box}.input-large,.input-xlarge,.input-xxlarge,input[class*="span"],select[class*="span"],textarea[class*="span"],.uneditable-input{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.input-prepend input,.input-append input,.input-prepend input[class*="span"],.input-append input[class*="span"]{display:inline-block;width:auto}.controls-row [class*="span"]+[class*="span"]{margin-left:0}.modal{position:fixed;top:20px;right:20px;left:20px;width:auto;margin:0}.modal.fade.in{top:auto}}@media(max-width:480px){.nav-collapse{-webkit-transform:translate3d(0,0,0)}.page-header h1 small{display:block;line-height:20px}input[type="checkbox"],input[type="radio"]{border:1px solid #ccc}.form-horizontal .control-label{float:none;width:auto;padding-top:0;text-align:left}.form-horizontal .controls{margin-left:0}.form-horizontal .control-list{padding-top:0}.form-horizontal .form-actions{padding-rig
 ht:10px;padding-left:10px}.modal{top:10px;right:10px;left:10px}.modal-header .close{padding:10px;margin:-10px}.carousel-caption{position:static}}@media(max-width:979px){body{padding-top:0}.navbar-fixed-top,.navbar-fixed-bottom{position:static}.navbar-fixed-top{margin-bottom:20px}.navbar-fixed-bottom{margin-top:20px}.navbar-fixed-top .navbar-inner,.navbar-fixed-bottom .navbar-inner{padding:5px}.navbar .container{width:auto;padding:0}.navbar .brand{padding-right:10px;padding-left:10px;margin:0 0 0 -5px}.nav-collapse{clear:both}.nav-collapse .nav{float:none;margin:0 0 10px}.nav-collapse .nav>li{float:none}.nav-collapse .nav>li>a{margin-bottom:2px}.nav-collapse .nav>.divider-vertical{display:none}.nav-collapse .nav .nav-header{color:#777;text-shadow:none}.nav-collapse .nav>li>a,.nav-collapse .dropdown-menu a{padding:9px 15px;font-weight:bold;color:#777;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.nav-collapse .btn{padding:4px 10px 4px;font-weight:normal;-webkit-bo
 rder-radius:4px;-moz-border-radius:4px;border-radius:4px}.nav-collapse .dropdown-menu li+li a{margin-bottom:2px}.nav-collapse .nav>li>a:hover,.nav-collapse .dropdown-menu a:hover{background-color:#f2f2f2}.navbar-inverse .nav-collapse .nav>li>a:hover,.navbar-inverse .nav-collapse .dropdown-menu a:hover{background-color:#111}.nav-collapse.in .btn-group{padding:0;margin-top:5px}.nav-collapse .dropdown-menu{position:static;top:auto;left:auto;display:block;float:none;max-width:none;padding:0;margin:0 15px;background-color:transparent;border:0;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.nav-collapse .dropdown-menu:before,.nav-collapse .dropdown-menu:after{display:none}.nav-collapse .dropdown-menu .divider{display:none}.nav-collapse .nav>li>.dropdown-menu:before,.nav-collapse .nav>li>.dropdown-menu:after{display:none}.nav-collapse .navbar-form,.nav-collapse .navbar-search{float:none;padding:10px 15px;margin:10px
  0;border-top:1px solid #f2f2f2;border-bottom:1px solid #f2f2f2;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.1);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.1);box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.1)}.navbar-inverse .nav-collapse .navbar-form,.navbar-inverse .nav-collapse .navbar-search{border-top-color:#111;border-bottom-color:#111}.navbar .nav-collapse .nav.pull-right{float:none;margin-left:0}.nav-collapse,.nav-collapse.collapse{height:0;overflow:hidden}.navbar .btn-navbar{display:block}.navbar-static .navbar-inner{padding-right:10px;padding-left:10px}}@media(min-width:980px){.nav-collapse.collapse{height:auto!important;overflow:visible!important}}


[07/21] aurora git commit: Remove unused classes from commons fork.

Posted by wf...@apache.org.
http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/resources/org/apache/aurora/common/common/webassets/bootstrap/2.3.2/img/glyphicons-halflings-white.png
----------------------------------------------------------------------
diff --git a/commons/src/main/resources/org/apache/aurora/common/common/webassets/bootstrap/2.3.2/img/glyphicons-halflings-white.png b/commons/src/main/resources/org/apache/aurora/common/common/webassets/bootstrap/2.3.2/img/glyphicons-halflings-white.png
deleted file mode 100644
index 3bf6484..0000000
Binary files a/commons/src/main/resources/org/apache/aurora/common/common/webassets/bootstrap/2.3.2/img/glyphicons-halflings-white.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/resources/org/apache/aurora/common/common/webassets/bootstrap/2.3.2/img/glyphicons-halflings.png
----------------------------------------------------------------------
diff --git a/commons/src/main/resources/org/apache/aurora/common/common/webassets/bootstrap/2.3.2/img/glyphicons-halflings.png b/commons/src/main/resources/org/apache/aurora/common/common/webassets/bootstrap/2.3.2/img/glyphicons-halflings.png
deleted file mode 100644
index a996999..0000000
Binary files a/commons/src/main/resources/org/apache/aurora/common/common/webassets/bootstrap/2.3.2/img/glyphicons-halflings.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/resources/org/apache/aurora/common/common/webassets/bootstrap/2.3.2/js/bootstrap.min.js
----------------------------------------------------------------------
diff --git a/commons/src/main/resources/org/apache/aurora/common/common/webassets/bootstrap/2.3.2/js/bootstrap.min.js b/commons/src/main/resources/org/apache/aurora/common/common/webassets/bootstrap/2.3.2/js/bootstrap.min.js
deleted file mode 100644
index 736662d..0000000
--- a/commons/src/main/resources/org/apache/aurora/common/common/webassets/bootstrap/2.3.2/js/bootstrap.min.js
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*!
-* Bootstrap.js by @fat & @mdo
-* Copyright 2012 Twitter, Inc.
-* http://www.apache.org/licenses/LICENSE-2.0.txt
-*/
-!function(e){"use strict";e(function(){e.support.transition=function(){var e=function(){var e=document.createElement("bootstrap"),t={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},n;for(n in t)if(e.style[n]!==undefined)return t[n]}();return e&&{end:e}}()})}(window.jQuery),!function(e){"use strict";var t='[data-dismiss="alert"]',n=function(n){e(n).on("click",t,this.close)};n.prototype.close=function(t){function s(){i.trigger("closed").remove()}var n=e(this),r=n.attr("data-target"),i;r||(r=n.attr("href"),r=r&&r.replace(/.*(?=#[^\s]*$)/,"")),i=e(r),t&&t.preventDefault(),i.length||(i=n.hasClass("alert")?n:n.parent()),i.trigger(t=e.Event("close"));if(t.isDefaultPrevented())return;i.removeClass("in"),e.support.transition&&i.hasClass("fade")?i.on(e.support.transition.end,s):s()};var r=e.fn.alert;e.fn.alert=function(t){return this.each(function(){var r=e(this),i=r.data("alert");i||r.data("alert",i=
 new n(this)),typeof t=="string"&&i[t].call(r)})},e.fn.alert.Constructor=n,e.fn.alert.noConflict=function(){return e.fn.alert=r,this},e(document).on("click.alert.data-api",t,n.prototype.close)}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.$element=e(t),this.options=e.extend({},e.fn.button.defaults,n)};t.prototype.setState=function(e){var t="disabled",n=this.$element,r=n.data(),i=n.is("input")?"val":"html";e+="Text",r.resetText||n.data("resetText",n[i]()),n[i](r[e]||this.options[e]),setTimeout(function(){e=="loadingText"?n.addClass(t).attr(t,t):n.removeClass(t).removeAttr(t)},0)},t.prototype.toggle=function(){var e=this.$element.closest('[data-toggle="buttons-radio"]');e&&e.find(".active").removeClass("active"),this.$element.toggleClass("active")};var n=e.fn.button;e.fn.button=function(n){return this.each(function(){var r=e(this),i=r.data("button"),s=typeof n=="object"&&n;i||r.data("button",i=new t(this,s)),n=="toggle"?i.toggle():n&&i.setState(n)})},e.fn.button.de
 faults={loadingText:"loading..."},e.fn.button.Constructor=t,e.fn.button.noConflict=function(){return e.fn.button=n,this},e(document).on("click.button.data-api","[data-toggle^=button]",function(t){var n=e(t.target);n.hasClass("btn")||(n=n.closest(".btn")),n.button("toggle")})}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.$element=e(t),this.$indicators=this.$element.find(".carousel-indicators"),this.options=n,this.options.pause=="hover"&&this.$element.on("mouseenter",e.proxy(this.pause,this)).on("mouseleave",e.proxy(this.cycle,this))};t.prototype={cycle:function(t){return t||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(e.proxy(this.next,this),this.options.interval)),this},getActiveIndex:function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},to:function(t){var n=this.getActiveIndex(),r=this;if(t>thi
 s.$items.length-1||t<0)return;return this.sliding?this.$element.one("slid",function(){r.to(t)}):n==t?this.pause().cycle():this.slide(t>n?"next":"prev",e(this.$items[t]))},pause:function(t){return t||(this.paused=!0),this.$element.find(".next, .prev").length&&e.support.transition.end&&(this.$element.trigger(e.support.transition.end),this.cycle(!0)),clearInterval(this.interval),this.interval=null,this},next:function(){if(this.sliding)return;return this.slide("next")},prev:function(){if(this.sliding)return;return this.slide("prev")},slide:function(t,n){var r=this.$element.find(".item.active"),i=n||r[t](),s=this.interval,o=t=="next"?"left":"right",u=t=="next"?"first":"last",a=this,f;this.sliding=!0,s&&this.pause(),i=i.length?i:this.$element.find(".item")[u](),f=e.Event("slide",{relatedTarget:i[0],direction:o});if(i.hasClass("active"))return;this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid",function(){var t=e(a.$indicators.children(
 )[a.getActiveIndex()]);t&&t.addClass("active")}));if(e.support.transition&&this.$element.hasClass("slide")){this.$element.trigger(f);if(f.isDefaultPrevented())return;i.addClass(t),i[0].offsetWidth,r.addClass(o),i.addClass(o),this.$element.one(e.support.transition.end,function(){i.removeClass([t,o].join(" ")).addClass("active"),r.removeClass(["active",o].join(" ")),a.sliding=!1,setTimeout(function(){a.$element.trigger("slid")},0)})}else{this.$element.trigger(f);if(f.isDefaultPrevented())return;r.removeClass("active"),i.addClass("active"),this.sliding=!1,this.$element.trigger("slid")}return s&&this.cycle(),this}};var n=e.fn.carousel;e.fn.carousel=function(n){return this.each(function(){var r=e(this),i=r.data("carousel"),s=e.extend({},e.fn.carousel.defaults,typeof n=="object"&&n),o=typeof n=="string"?n:s.slide;i||r.data("carousel",i=new t(this,s)),typeof n=="number"?i.to(n):o?i[o]():s.interval&&i.pause().cycle()})},e.fn.carousel.defaults={interval:5e3,pause:"hover"},e.fn.carousel.Const
 ructor=t,e.fn.carousel.noConflict=function(){return e.fn.carousel=n,this},e(document).on("click.carousel.data-api","[data-slide], [data-slide-to]",function(t){var n=e(this),r,i=e(n.attr("data-target")||(r=n.attr("href"))&&r.replace(/.*(?=#[^\s]+$)/,"")),s=e.extend({},i.data(),n.data()),o;i.carousel(s),(o=n.attr("data-slide-to"))&&i.data("carousel").pause().to(o).cycle(),t.preventDefault()})}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.$element=e(t),this.options=e.extend({},e.fn.collapse.defaults,n),this.options.parent&&(this.$parent=e(this.options.parent)),this.options.toggle&&this.toggle()};t.prototype={constructor:t,dimension:function(){var e=this.$element.hasClass("width");return e?"width":"height"},show:function(){var t,n,r,i;if(this.transitioning||this.$element.hasClass("in"))return;t=this.dimension(),n=e.camelCase(["scroll",t].join("-")),r=this.$parent&&this.$parent.find("> .accordion-group > .in");if(r&&r.length){i=r.data("collapse");if(i&&i.transitionin
 g)return;r.collapse("hide"),i||r.data("collapse",null)}this.$element[t](0),this.transition("addClass",e.Event("show"),"shown"),e.support.transition&&this.$element[t](this.$element[0][n])},hide:function(){var t;if(this.transitioning||!this.$element.hasClass("in"))return;t=this.dimension(),this.reset(this.$element[t]()),this.transition("removeClass",e.Event("hide"),"hidden"),this.$element[t](0)},reset:function(e){var t=this.dimension();return this.$element.removeClass("collapse")[t](e||"auto")[0].offsetWidth,this.$element[e!==null?"addClass":"removeClass"]("collapse"),this},transition:function(t,n,r){var i=this,s=function(){n.type=="show"&&i.reset(),i.transitioning=0,i.$element.trigger(r)};this.$element.trigger(n);if(n.isDefaultPrevented())return;this.transitioning=1,this.$element[t]("in"),e.support.transition&&this.$element.hasClass("collapse")?this.$element.one(e.support.transition.end,s):s()},toggle:function(){this[this.$element.hasClass("in")?"hide":"show"]()}};var n=e.fn.collapse
 ;e.fn.collapse=function(n){return this.each(function(){var r=e(this),i=r.data("collapse"),s=e.extend({},e.fn.collapse.defaults,r.data(),typeof n=="object"&&n);i||r.data("collapse",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.collapse.defaults={toggle:!0},e.fn.collapse.Constructor=t,e.fn.collapse.noConflict=function(){return e.fn.collapse=n,this},e(document).on("click.collapse.data-api","[data-toggle=collapse]",function(t){var n=e(this),r,i=n.attr("data-target")||t.preventDefault()||(r=n.attr("href"))&&r.replace(/.*(?=#[^\s]+$)/,""),s=e(i).data("collapse")?"toggle":n.data();n[e(i).hasClass("in")?"addClass":"removeClass"]("collapsed"),e(i).collapse(s)})}(window.jQuery),!function(e){"use strict";function r(){e(".dropdown-backdrop").remove(),e(t).each(function(){i(e(this)).removeClass("open")})}function i(t){var n=t.attr("data-target"),r;n||(n=t.attr("href"),n=n&&/#/.test(n)&&n.replace(/.*(?=#[^\s]*$)/,"")),r=n&&e(n);if(!r||!r.length)r=t.parent();return r}var t="[data-toggle=drop
 down]",n=function(t){var n=e(t).on("click.dropdown.data-api",this.toggle);e("html").on("click.dropdown.data-api",function(){n.parent().removeClass("open")})};n.prototype={constructor:n,toggle:function(t){var n=e(this),s,o;if(n.is(".disabled, :disabled"))return;return s=i(n),o=s.hasClass("open"),r(),o||("ontouchstart"in document.documentElement&&e('<div class="dropdown-backdrop"/>').insertBefore(e(this)).on("click",r),s.toggleClass("open")),n.focus(),!1},keydown:function(n){var r,s,o,u,a,f;if(!/(38|40|27)/.test(n.keyCode))return;r=e(this),n.preventDefault(),n.stopPropagation();if(r.is(".disabled, :disabled"))return;u=i(r),a=u.hasClass("open");if(!a||a&&n.keyCode==27)return n.which==27&&u.find(t).focus(),r.click();s=e("[role=menu] li:not(.divider):visible a",u);if(!s.length)return;f=s.index(s.filter(":focus")),n.keyCode==38&&f>0&&f--,n.keyCode==40&&f<s.length-1&&f++,~f||(f=0),s.eq(f).focus()}};var s=e.fn.dropdown;e.fn.dropdown=function(t){return this.each(function(){var r=e(this),i=r.
 data("dropdown");i||r.data("dropdown",i=new n(this)),typeof t=="string"&&i[t].call(r)})},e.fn.dropdown.Constructor=n,e.fn.dropdown.noConflict=function(){return e.fn.dropdown=s,this},e(document).on("click.dropdown.data-api",r).on("click.dropdown.data-api",".dropdown form",function(e){e.stopPropagation()}).on("click.dropdown.data-api",t,n.prototype.toggle).on("keydown.dropdown.data-api",t+", [role=menu]",n.prototype.keydown)}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.options=n,this.$element=e(t).delegate('[data-dismiss="modal"]',"click.dismiss.modal",e.proxy(this.hide,this)),this.options.remote&&this.$element.find(".modal-body").load(this.options.remote)};t.prototype={constructor:t,toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var t=this,n=e.Event("show");this.$element.trigger(n);if(this.isShown||n.isDefaultPrevented())return;this.isShown=!0,this.escape(),this.backdrop(function(){var n=e.support.transition&&t.$element.hasClass("fa
 de");t.$element.parent().length||t.$element.appendTo(document.body),t.$element.show(),n&&t.$element[0].offsetWidth,t.$element.addClass("in").attr("aria-hidden",!1),t.enforceFocus(),n?t.$element.one(e.support.transition.end,function(){t.$element.focus().trigger("shown")}):t.$element.focus().trigger("shown")})},hide:function(t){t&&t.preventDefault();var n=this;t=e.Event("hide"),this.$element.trigger(t);if(!this.isShown||t.isDefaultPrevented())return;this.isShown=!1,this.escape(),e(document).off("focusin.modal"),this.$element.removeClass("in").attr("aria-hidden",!0),e.support.transition&&this.$element.hasClass("fade")?this.hideWithTransition():this.hideModal()},enforceFocus:function(){var t=this;e(document).on("focusin.modal",function(e){t.$element[0]!==e.target&&!t.$element.has(e.target).length&&t.$element.focus()})},escape:function(){var e=this;this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.modal",function(t){t.which==27&&e.hide()}):this.isShown||this.$element.of
 f("keyup.dismiss.modal")},hideWithTransition:function(){var t=this,n=setTimeout(function(){t.$element.off(e.support.transition.end),t.hideModal()},500);this.$element.one(e.support.transition.end,function(){clearTimeout(n),t.hideModal()})},hideModal:function(){var e=this;this.$element.hide(),this.backdrop(function(){e.removeBackdrop(),e.$element.trigger("hidden")})},removeBackdrop:function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},backdrop:function(t){var n=this,r=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var i=e.support.transition&&r;this.$backdrop=e('<div class="modal-backdrop '+r+'" />').appendTo(document.body),this.$backdrop.click(this.options.backdrop=="static"?e.proxy(this.$element[0].focus,this.$element[0]):e.proxy(this.hide,this)),i&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in");if(!t)return;i?this.$backdrop.one(e.support.transition.end,t):t()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClas
 s("in"),e.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(e.support.transition.end,t):t()):t&&t()}};var n=e.fn.modal;e.fn.modal=function(n){return this.each(function(){var r=e(this),i=r.data("modal"),s=e.extend({},e.fn.modal.defaults,r.data(),typeof n=="object"&&n);i||r.data("modal",i=new t(this,s)),typeof n=="string"?i[n]():s.show&&i.show()})},e.fn.modal.defaults={backdrop:!0,keyboard:!0,show:!0},e.fn.modal.Constructor=t,e.fn.modal.noConflict=function(){return e.fn.modal=n,this},e(document).on("click.modal.data-api",'[data-toggle="modal"]',function(t){var n=e(this),r=n.attr("href"),i=e(n.attr("data-target")||r&&r.replace(/.*(?=#[^\s]+$)/,"")),s=i.data("modal")?"toggle":e.extend({remote:!/#/.test(r)&&r},i.data(),n.data());t.preventDefault(),i.modal(s).one("hide",function(){n.focus()})})}(window.jQuery),!function(e){"use strict";var t=function(e,t){this.init("tooltip",e,t)};t.prototype={constructor:t,init:function(t,n,r){var i,s,o,u,a;this.type=t,this.$element=e
 (n),this.options=this.getOptions(r),this.enabled=!0,o=this.options.trigger.split(" ");for(a=o.length;a--;)u=o[a],u=="click"?this.$element.on("click."+this.type,this.options.selector,e.proxy(this.toggle,this)):u!="manual"&&(i=u=="hover"?"mouseenter":"focus",s=u=="hover"?"mouseleave":"blur",this.$element.on(i+"."+this.type,this.options.selector,e.proxy(this.enter,this)),this.$element.on(s+"."+this.type,this.options.selector,e.proxy(this.leave,this)));this.options.selector?this._options=e.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},getOptions:function(t){return t=e.extend({},e.fn[this.type].defaults,this.$element.data(),t),t.delay&&typeof t.delay=="number"&&(t.delay={show:t.delay,hide:t.delay}),t},enter:function(t){var n=e.fn[this.type].defaults,r={},i;this._options&&e.each(this._options,function(e,t){n[e]!=t&&(r[e]=t)},this),i=e(t.currentTarget)[this.type](r).data(this.type);if(!i.options.delay||!i.options.delay.show)return i.show();clearTimeout(this.timeou
 t),i.hoverState="in",this.timeout=setTimeout(function(){i.hoverState=="in"&&i.show()},i.options.delay.show)},leave:function(t){var n=e(t.currentTarget)[this.type](this._options).data(this.type);this.timeout&&clearTimeout(this.timeout);if(!n.options.delay||!n.options.delay.hide)return n.hide();n.hoverState="out",this.timeout=setTimeout(function(){n.hoverState=="out"&&n.hide()},n.options.delay.hide)},show:function(){var t,n,r,i,s,o,u=e.Event("show");if(this.hasContent()&&this.enabled){this.$element.trigger(u);if(u.isDefaultPrevented())return;t=this.tip(),this.setContent(),this.options.animation&&t.addClass("fade"),s=typeof this.options.placement=="function"?this.options.placement.call(this,t[0],this.$element[0]):this.options.placement,t.detach().css({top:0,left:0,display:"block"}),this.options.container?t.appendTo(this.options.container):t.insertAfter(this.$element),n=this.getPosition(),r=t[0].offsetWidth,i=t[0].offsetHeight;switch(s){case"bottom":o={top:n.top+n.height,left:n.left+n.w
 idth/2-r/2};break;case"top":o={top:n.top-i,left:n.left+n.width/2-r/2};break;case"left":o={top:n.top+n.height/2-i/2,left:n.left-r};break;case"right":o={top:n.top+n.height/2-i/2,left:n.left+n.width}}this.applyPlacement(o,s),this.$element.trigger("shown")}},applyPlacement:function(e,t){var n=this.tip(),r=n[0].offsetWidth,i=n[0].offsetHeight,s,o,u,a;n.offset(e).addClass(t).addClass("in"),s=n[0].offsetWidth,o=n[0].offsetHeight,t=="top"&&o!=i&&(e.top=e.top+i-o,a=!0),t=="bottom"||t=="top"?(u=0,e.left<0&&(u=e.left*-2,e.left=0,n.offset(e),s=n[0].offsetWidth,o=n[0].offsetHeight),this.replaceArrow(u-r+s,s,"left")):this.replaceArrow(o-i,o,"top"),a&&n.offset(e)},replaceArrow:function(e,t,n){this.arrow().css(n,e?50*(1-e/t)+"%":"")},setContent:function(){var e=this.tip(),t=this.getTitle();e.find(".tooltip-inner")[this.options.html?"html":"text"](t),e.removeClass("fade in top bottom left right")},hide:function(){function i(){var t=setTimeout(function(){n.off(e.support.transition.end).detach()},500)
 ;n.one(e.support.transition.end,function(){clearTimeout(t),n.detach()})}var t=this,n=this.tip(),r=e.Event("hide");this.$element.trigger(r);if(r.isDefaultPrevented())return;return n.removeClass("in"),e.support.transition&&this.$tip.hasClass("fade")?i():n.detach(),this.$element.trigger("hidden"),this},fixTitle:function(){var e=this.$element;(e.attr("title")||typeof e.attr("data-original-title")!="string")&&e.attr("data-original-title",e.attr("title")||"").attr("title","")},hasContent:function(){return this.getTitle()},getPosition:function(){var t=this.$element[0];return e.extend({},typeof t.getBoundingClientRect=="function"?t.getBoundingClientRect():{width:t.offsetWidth,height:t.offsetHeight},this.$element.offset())},getTitle:function(){var e,t=this.$element,n=this.options;return e=t.attr("data-original-title")||(typeof n.title=="function"?n.title.call(t[0]):n.title),e},tip:function(){return this.$tip=this.$tip||e(this.options.template)},arrow:function(){return this.$arrow=this.$arrow
 ||this.tip().find(".tooltip-arrow")},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled},toggle:function(t){var n=t?e(t.currentTarget)[this.type](this._options).data(this.type):this;n.tip().hasClass("in")?n.hide():n.show()},destroy:function(){this.hide().$element.off("."+this.type).removeData(this.type)}};var n=e.fn.tooltip;e.fn.tooltip=function(n){return this.each(function(){var r=e(this),i=r.data("tooltip"),s=typeof n=="object"&&n;i||r.data("tooltip",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.tooltip.Constructor=t,e.fn.tooltip.defaults={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1},e.fn.tooltip.noConflict=function(){return e.fn.tooltip=n,this}}
 (window.jQuery),!function(e){"use strict";var t=function(e,t){this.init("popover",e,t)};t.prototype=e.extend({},e.fn.tooltip.Constructor.prototype,{constructor:t,setContent:function(){var e=this.tip(),t=this.getTitle(),n=this.getContent();e.find(".popover-title")[this.options.html?"html":"text"](t),e.find(".popover-content")[this.options.html?"html":"text"](n),e.removeClass("fade top bottom left right in")},hasContent:function(){return this.getTitle()||this.getContent()},getContent:function(){var e,t=this.$element,n=this.options;return e=(typeof n.content=="function"?n.content.call(t[0]):n.content)||t.attr("data-content"),e},tip:function(){return this.$tip||(this.$tip=e(this.options.template)),this.$tip},destroy:function(){this.hide().$element.off("."+this.type).removeData(this.type)}});var n=e.fn.popover;e.fn.popover=function(n){return this.each(function(){var r=e(this),i=r.data("popover"),s=typeof n=="object"&&n;i||r.data("popover",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.
 fn.popover.Constructor=t,e.fn.popover.defaults=e.extend({},e.fn.tooltip.defaults,{placement:"right",trigger:"click",content:"",template:'<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),e.fn.popover.noConflict=function(){return e.fn.popover=n,this}}(window.jQuery),!function(e){"use strict";function t(t,n){var r=e.proxy(this.process,this),i=e(t).is("body")?e(window):e(t),s;this.options=e.extend({},e.fn.scrollspy.defaults,n),this.$scrollElement=i.on("scroll.scroll-spy.data-api",r),this.selector=(this.options.target||(s=e(t).attr("href"))&&s.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.$body=e("body"),this.refresh(),this.process()}t.prototype={constructor:t,refresh:function(){var t=this,n;this.offsets=e([]),this.targets=e([]),n=this.$body.find(this.selector).map(function(){var n=e(this),r=n.data("target")||n.attr("href"),i=/^#\w/.test(r)&&e(r);return i&&i.length&&[[i.position().top+(!e.isWindow(t.$scrollE
 lement.get(0))&&t.$scrollElement.scrollTop()),r]]||null}).sort(function(e,t){return e[0]-t[0]}).each(function(){t.offsets.push(this[0]),t.targets.push(this[1])})},process:function(){var e=this.$scrollElement.scrollTop()+this.options.offset,t=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,n=t-this.$scrollElement.height(),r=this.offsets,i=this.targets,s=this.activeTarget,o;if(e>=n)return s!=(o=i.last()[0])&&this.activate(o);for(o=r.length;o--;)s!=i[o]&&e>=r[o]&&(!r[o+1]||e<=r[o+1])&&this.activate(i[o])},activate:function(t){var n,r;this.activeTarget=t,e(this.selector).parent(".active").removeClass("active"),r=this.selector+'[data-target="'+t+'"],'+this.selector+'[href="'+t+'"]',n=e(r).parent("li").addClass("active"),n.parent(".dropdown-menu").length&&(n=n.closest("li.dropdown").addClass("active")),n.trigger("activate")}};var n=e.fn.scrollspy;e.fn.scrollspy=function(n){return this.each(function(){var r=e(this),i=r.data("scrollspy"),s=typeof n=="object"&&n;i||r.data("sc
 rollspy",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.scrollspy.Constructor=t,e.fn.scrollspy.defaults={offset:10},e.fn.scrollspy.noConflict=function(){return e.fn.scrollspy=n,this},e(window).on("load",function(){e('[data-spy="scroll"]').each(function(){var t=e(this);t.scrollspy(t.data())})})}(window.jQuery),!function(e){"use strict";var t=function(t){this.element=e(t)};t.prototype={constructor:t,show:function(){var t=this.element,n=t.closest("ul:not(.dropdown-menu)"),r=t.attr("data-target"),i,s,o;r||(r=t.attr("href"),r=r&&r.replace(/.*(?=#[^\s]*$)/,""));if(t.parent("li").hasClass("active"))return;i=n.find(".active:last a")[0],o=e.Event("show",{relatedTarget:i}),t.trigger(o);if(o.isDefaultPrevented())return;s=e(r),this.activate(t.parent("li"),n),this.activate(s,s.parent(),function(){t.trigger({type:"shown",relatedTarget:i})})},activate:function(t,n,r){function o(){i.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),t.addClass("active"),s?(t[0].offs
 etWidth,t.addClass("in")):t.removeClass("fade"),t.parent(".dropdown-menu")&&t.closest("li.dropdown").addClass("active"),r&&r()}var i=n.find("> .active"),s=r&&e.support.transition&&i.hasClass("fade");s?i.one(e.support.transition.end,o):o(),i.removeClass("in")}};var n=e.fn.tab;e.fn.tab=function(n){return this.each(function(){var r=e(this),i=r.data("tab");i||r.data("tab",i=new t(this)),typeof n=="string"&&i[n]()})},e.fn.tab.Constructor=t,e.fn.tab.noConflict=function(){return e.fn.tab=n,this},e(document).on("click.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(t){t.preventDefault(),e(this).tab("show")})}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.$element=e(t),this.options=e.extend({},e.fn.typeahead.defaults,n),this.matcher=this.options.matcher||this.matcher,this.sorter=this.options.sorter||this.sorter,this.highlighter=this.options.highlighter||this.highlighter,this.updater=this.options.updater||this.updater,this.source=this.options.source,this
 .$menu=e(this.options.menu),this.shown=!1,this.listen()};t.prototype={constructor:t,select:function(){var e=this.$menu.find(".active").attr("data-value");return this.$element.val(this.updater(e)).change(),this.hide()},updater:function(e){return e},show:function(){var t=e.extend({},this.$element.position(),{height:this.$element[0].offsetHeight});return this.$menu.insertAfter(this.$element).css({top:t.top+t.height,left:t.left}).show(),this.shown=!0,this},hide:function(){return this.$menu.hide(),this.shown=!1,this},lookup:function(t){var n;return this.query=this.$element.val(),!this.query||this.query.length<this.options.minLength?this.shown?this.hide():this:(n=e.isFunction(this.source)?this.source(this.query,e.proxy(this.process,this)):this.source,n?this.process(n):this)},process:function(t){var n=this;return t=e.grep(t,function(e){return n.matcher(e)}),t=this.sorter(t),t.length?this.render(t.slice(0,this.options.items)).show():this.shown?this.hide():this},matcher:function(e){return~e.
 toLowerCase().indexOf(this.query.toLowerCase())},sorter:function(e){var t=[],n=[],r=[],i;while(i=e.shift())i.toLowerCase().indexOf(this.query.toLowerCase())?~i.indexOf(this.query)?n.push(i):r.push(i):t.push(i);return t.concat(n,r)},highlighter:function(e){var t=this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&");return e.replace(new RegExp("("+t+")","ig"),function(e,t){return"<strong>"+t+"</strong>"})},render:function(t){var n=this;return t=e(t).map(function(t,r){return t=e(n.options.item).attr("data-value",r),t.find("a").html(n.highlighter(r)),t[0]}),t.first().addClass("active"),this.$menu.html(t),this},next:function(t){var n=this.$menu.find(".active").removeClass("active"),r=n.next();r.length||(r=e(this.$menu.find("li")[0])),r.addClass("active")},prev:function(e){var t=this.$menu.find(".active").removeClass("active"),n=t.prev();n.length||(n=this.$menu.find("li").last()),n.addClass("active")},listen:function(){this.$element.on("focus",e.proxy(this.focus,this)).on("blur",e.prox
 y(this.blur,this)).on("keypress",e.proxy(this.keypress,this)).on("keyup",e.proxy(this.keyup,this)),this.eventSupported("keydown")&&this.$element.on("keydown",e.proxy(this.keydown,this)),this.$menu.on("click",e.proxy(this.click,this)).on("mouseenter","li",e.proxy(this.mouseenter,this)).on("mouseleave","li",e.proxy(this.mouseleave,this))},eventSupported:function(e){var t=e in this.$element;return t||(this.$element.setAttribute(e,"return;"),t=typeof this.$element[e]=="function"),t},move:function(e){if(!this.shown)return;switch(e.keyCode){case 9:case 13:case 27:e.preventDefault();break;case 38:e.preventDefault(),this.prev();break;case 40:e.preventDefault(),this.next()}e.stopPropagation()},keydown:function(t){this.suppressKeyPressRepeat=~e.inArray(t.keyCode,[40,38,9,13,27]),this.move(t)},keypress:function(e){if(this.suppressKeyPressRepeat)return;this.move(e)},keyup:function(e){switch(e.keyCode){case 40:case 38:case 16:case 17:case 18:break;case 9:case 13:if(!this.shown)return;this.select
 ();break;case 27:if(!this.shown)return;this.hide();break;default:this.lookup()}e.stopPropagation(),e.preventDefault()},focus:function(e){this.focused=!0},blur:function(e){this.focused=!1,!this.mousedover&&this.shown&&this.hide()},click:function(e){e.stopPropagation(),e.preventDefault(),this.select(),this.$element.focus()},mouseenter:function(t){this.mousedover=!0,this.$menu.find(".active").removeClass("active"),e(t.currentTarget).addClass("active")},mouseleave:function(e){this.mousedover=!1,!this.focused&&this.shown&&this.hide()}};var n=e.fn.typeahead;e.fn.typeahead=function(n){return this.each(function(){var r=e(this),i=r.data("typeahead"),s=typeof n=="object"&&n;i||r.data("typeahead",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.typeahead.defaults={source:[],items:8,menu:'<ul class="typeahead dropdown-menu"></ul>',item:'<li><a href="#"></a></li>',minLength:1},e.fn.typeahead.Constructor=t,e.fn.typeahead.noConflict=function(){return e.fn.typeahead=n,this},e(document).on("focus
 .typeahead.data-api",'[data-provide="typeahead"]',function(t){var n=e(this);if(n.data("typeahead"))return;n.typeahead(n.data())})}(window.jQuery),!function(e){"use strict";var t=function(t,n){this.options=e.extend({},e.fn.affix.defaults,n),this.$window=e(window).on("scroll.affix.data-api",e.proxy(this.checkPosition,this)).on("click.affix.data-api",e.proxy(function(){setTimeout(e.proxy(this.checkPosition,this),1)},this)),this.$element=e(t),this.checkPosition()};t.prototype.checkPosition=function(){if(!this.$element.is(":visible"))return;var t=e(document).height(),n=this.$window.scrollTop(),r=this.$element.offset(),i=this.options.offset,s=i.bottom,o=i.top,u="affix affix-top affix-bottom",a;typeof i!="object"&&(s=o=i),typeof o=="function"&&(o=i.top()),typeof s=="function"&&(s=i.bottom()),a=this.unpin!=null&&n+this.unpin<=r.top?!1:s!=null&&r.top+this.$element.height()>=t-s?"bottom":o!=null&&n<=o?"top":!1;if(this.affixed===a)return;this.affixed=a,this.unpin=a=="bottom"?r.top-n:null,this.
 $element.removeClass(u).addClass("affix"+(a?"-"+a:""))};var n=e.fn.affix;e.fn.affix=function(n){return this.each(function(){var r=e(this),i=r.data("affix"),s=typeof n=="object"&&n;i||r.data("affix",i=new t(this,s)),typeof n=="string"&&i[n]()})},e.fn.affix.Constructor=t,e.fn.affix.defaults={offset:0},e.fn.affix.noConflict=function(){return e.fn.affix=n,this},e(window).on("load",function(){e('[data-spy="affix"]').each(function(){var t=e(this),n=t.data();n.offset=n.offset||{},n.offsetBottom&&(n.offset.bottom=n.offsetBottom),n.offsetTop&&(n.offset.top=n.offsetTop),t.affix(n)})})}(window.jQuery);
\ No newline at end of file


[04/21] aurora git commit: Remove unused classes from commons fork.

Posted by wf...@apache.org.
http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/net/http/filters/HttpStatsFilterIntegrationTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/net/http/filters/HttpStatsFilterIntegrationTest.java b/commons/src/test/java/org/apache/aurora/common/net/http/filters/HttpStatsFilterIntegrationTest.java
deleted file mode 100644
index 92ab63b..0000000
--- a/commons/src/test/java/org/apache/aurora/common/net/http/filters/HttpStatsFilterIntegrationTest.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net.http.filters;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.inject.AbstractModule;
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-import com.google.inject.Singleton;
-import com.google.inject.servlet.GuiceFilter;
-import com.google.inject.servlet.GuiceServletContextListener;
-import com.sun.jersey.api.client.Client;
-import com.sun.jersey.api.client.UniformInterfaceException;
-import com.sun.jersey.api.client.config.ClientConfig;
-import com.sun.jersey.api.client.config.DefaultClientConfig;
-import com.sun.jersey.guice.JerseyServletModule;
-import com.sun.jersey.guice.spi.container.servlet.GuiceContainer;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import org.apache.aurora.common.net.http.JettyHttpServerDispatch;
-import org.apache.aurora.common.stats.Stat;
-import org.apache.aurora.common.stats.Stats;
-import org.apache.aurora.common.util.Clock;
-import org.apache.aurora.common.util.testing.FakeClock;
-
-import static com.sun.jersey.api.core.ResourceConfig.PROPERTY_CONTAINER_RESPONSE_FILTERS;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-public class HttpStatsFilterIntegrationTest {
-  private Client client;
-  private FakeClock clock;
-  private JettyHttpServerDispatch server;
-
-  @Before
-  public void setUp() {
-    Stats.flush();
-
-    server = new JettyHttpServerDispatch();
-    server.listen(0);
-    server.registerFilter(GuiceFilter.class, "/*");
-
-    clock = new FakeClock();
-
-    final Injector injector = Guice.createInjector(
-        new AbstractModule() {
-          @Override
-          protected void configure() {
-            bind(TestServlet.class).in(Singleton.class);
-
-            bind(Clock.class).toInstance(clock);
-            bind(HttpStatsFilter.class).in(Singleton.class);
-          }
-        },
-        new JerseyServletModule() {
-          @Override
-          protected void configureServlets() {
-            filter("/*").through(HttpStatsFilter.class);
-            serve("/*").with(GuiceContainer.class, ImmutableMap.of(
-                PROPERTY_CONTAINER_RESPONSE_FILTERS, HttpStatsFilter.class.getName()));
-          }
-        }
-    );
-    server.getRootContext().addEventListener(new GuiceServletContextListener() {
-      @Override protected Injector getInjector() {
-        return injector;
-      }
-    });
-
-    ClientConfig config = new DefaultClientConfig();
-    client = Client.create(config);
-  }
-
-  @Path("/")
-  public static class TestServlet {
-    @GET
-    @Path("/hello")
-    @Produces(MediaType.TEXT_PLAIN)
-    @HttpStatsFilter.TrackRequestStats("hello")
-    public Response hello() {
-      return Response.ok("hello world").build();
-    }
-
-    @GET
-    @Path("/hola")
-    @Produces(MediaType.TEXT_PLAIN)
-    @HttpStatsFilter.TrackRequestStats("hola")
-    public Response hola() {
-      return Response.ok("hola mundo").build();
-    }
-
-    @GET
-    @Path("/goodbye")
-    @Produces(MediaType.TEXT_PLAIN)
-    public Response goodbye() {
-      return Response.ok("goodbye cruel world").build();
-    }
-  }
-
-  private String getResource(String path) {
-    return client
-        .resource(String.format("http://localhost:%s%s", server.getPort(), path))
-        .accept(MediaType.TEXT_PLAIN)
-        .get(String.class);
-  }
-
-  private void assertStatValue(String statName, long expectedValue) {
-    Stat<Long> stat = Stats.getVariable(statName);
-    assertEquals(expectedValue, stat.read().longValue());
-  }
-
-  @Test
-  public void testStatsTracking() throws Exception {
-    getResource("/hello");
-
-    assertStatValue("http_hello_200_responses_events", 1);
-  }
-
-  @Test
-  public void testRepeatedContextInjection() throws Exception {
-    getResource("/hello");
-    getResource("/hola");
-    getResource("/hello");
-
-    assertStatValue("http_hello_200_responses_events", 2);
-    assertStatValue("http_hola_200_responses_events", 1);
-  }
-
-  @Test
-  public void testNoStatsTracking() throws Exception {
-    getResource("/goodbye");
-
-    assertNull(Stats.getVariable("http_goodbye_200_responses_events"));
-  }
-
-  @Test
-  public void testNoMatchedMethod() throws Exception {
-    try {
-      getResource("/what");
-      fail("Should have thrown a 404.");
-    } catch (UniformInterfaceException e) {
-      assertStatValue("http_404_responses_events", 1);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/net/http/filters/HttpStatsFilterTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/net/http/filters/HttpStatsFilterTest.java b/commons/src/test/java/org/apache/aurora/common/net/http/filters/HttpStatsFilterTest.java
deleted file mode 100644
index b40964d..0000000
--- a/commons/src/test/java/org/apache/aurora/common/net/http/filters/HttpStatsFilterTest.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net.http.filters;
-
-import java.io.IOException;
-import java.lang.reflect.Field;
-import java.util.List;
-import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.ws.rs.core.Context;
-
-import com.google.common.collect.Lists;
-import com.sun.jersey.api.core.ExtendedUriInfo;
-import com.sun.jersey.api.model.AbstractResourceMethod;
-import com.sun.jersey.spi.container.ContainerRequest;
-import com.sun.jersey.spi.container.ContainerResponse;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import org.apache.aurora.common.collections.Pair;
-
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-import org.apache.aurora.common.stats.SlidingStats;
-import org.apache.aurora.common.testing.easymock.EasyMockTest;
-import org.apache.aurora.common.util.testing.FakeClock;
-
-import static org.easymock.EasyMock.anyObject;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.expectLastCall;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-public class HttpStatsFilterTest extends EasyMockTest {
-  private FakeClock clock;
-  private HttpServletRequest request;
-  private HttpServletResponse response;
-  private FilterChain filterChain;
-  private HttpStatsFilter filter;
-  private ContainerRequest containerRequest;
-  private ContainerResponse containerResponse;
-  private ExtendedUriInfo extendedUriInfo;
-  private HttpServletRequest servletRequest;
-
-  private static final Amount<Long, Time> REQUEST_TIME =  Amount.of(1000L, Time.NANOSECONDS);
-
-  private void injectContextVars() throws Exception {
-    extendedUriInfo = createMock(ExtendedUriInfo.class);
-    servletRequest = createMock(HttpServletRequest.class);
-
-    List<Object> injectables = Lists.newArrayList(extendedUriInfo, servletRequest);
-
-    for (Field f : filter.getClass().getDeclaredFields()) {
-      if (f.isAnnotationPresent(Context.class)) {
-        for (Object injectable : injectables) {
-          if (f.getType().isInstance(injectable)) {
-            f.setAccessible(true);
-            f.set(filter, injectable);
-          }
-        }
-      }
-    }
-  }
-
-  @Before
-  public void setUp() throws Exception {
-    clock = new FakeClock();
-    request = createMock(HttpServletRequest.class);
-    response = createMock(HttpServletResponse.class);
-    filterChain = createMock(FilterChain.class);
-    filter = new HttpStatsFilter(clock);
-
-    containerRequest = createMock(ContainerRequest.class);
-    containerResponse = createMock(ContainerResponse.class);
-
-    injectContextVars();
-  }
-
-  @Test
-  public void testStartTimeIsSetAsRequestAttribute() throws Exception {
-    request.setAttribute(HttpStatsFilter.REQUEST_START_TIME, REQUEST_TIME.getValue());
-    filterChain.doFilter(request, response);
-
-    control.replay();
-
-    clock.advance(REQUEST_TIME);
-    filter.doFilter(request, response, filterChain);
-  }
-
-  @Test
-  public void testExceptionStatsCounting() throws Exception {
-    request.setAttribute(HttpStatsFilter.REQUEST_START_TIME, REQUEST_TIME.getValue());
-    expectLastCall().times(2);
-    clock.advance(REQUEST_TIME);
-
-    filterChain.doFilter(anyObject(HttpServletRequest.class), anyObject(HttpServletResponse.class));
-    expectLastCall().andThrow(new IOException());
-
-    filterChain.doFilter(anyObject(HttpServletRequest.class), anyObject(HttpServletResponse.class));
-    expectLastCall().andThrow(new ServletException());
-
-    control.replay();
-
-    try {
-      filter.doFilter(request, response, filterChain);
-      fail("Filter should have re-thrown the exception.");
-    } catch (IOException e) {
-      // Exception is expected, but we still want to assert on the stat tracking, so we can't
-      //  just use @Test(expected...)
-      assertEquals(1, filter.exceptionCount.get());
-    }
-
-    try {
-      filter.doFilter(request, response, filterChain);
-      fail("Filter should have re-thrown the exception.");
-    } catch (ServletException e) {
-      // See above.
-      assertEquals(2, filter.exceptionCount.get());
-    }
-  }
-
-  private void expectAnnotationValue(String value, int times) {
-    AbstractResourceMethod matchedMethod = createMock(AbstractResourceMethod.class);
-    expect(extendedUriInfo.getMatchedMethod()).andReturn(matchedMethod).times(times);
-
-    HttpStatsFilter.TrackRequestStats annotation = createMock(HttpStatsFilter.TrackRequestStats.class);
-    expect(matchedMethod.getAnnotation(HttpStatsFilter.TrackRequestStats.class)).andReturn(annotation).times(times);
-
-    expect(annotation.value()).andReturn(value).times(times);
-  }
-
-  private void expectAnnotationValue(String value) {
-    expectAnnotationValue(value, 1);
-  }
-
-  @Test
-  public void testBasicStatsCounting() throws Exception {
-    expect(containerResponse.getStatus()).andReturn(HttpServletResponse.SC_OK);
-
-    expect(servletRequest.getAttribute(HttpStatsFilter.REQUEST_START_TIME))
-        .andReturn(clock.nowNanos());
-
-    String value = "some_value";
-    expectAnnotationValue(value);
-
-    control.replay();
-
-    clock.advance(REQUEST_TIME);
-    assertEquals(containerResponse, filter.filter(containerRequest, containerResponse));
-
-    SlidingStats stat = filter.requestCounters.get(Pair.of(value, HttpServletResponse.SC_OK));
-    assertEquals(1, stat.getEventCounter().get());
-    assertEquals(REQUEST_TIME.getValue().longValue(), stat.getTotalCounter().get());
-    assertEquals(1, filter.statusCounters.get(HttpServletResponse.SC_OK).getEventCounter().get());
-  }
-
-  @Test
-  public void testMultipleRequests() throws Exception {
-    int numCalls = 2;
-
-    expect(containerResponse.getStatus()).andReturn(HttpServletResponse.SC_OK).times(numCalls);
-
-    expect(servletRequest.getAttribute(HttpStatsFilter.REQUEST_START_TIME))
-        .andReturn(clock.nowNanos()).times(numCalls);
-
-    String value = "some_value";
-    expectAnnotationValue(value, numCalls);
-
-    control.replay();
-
-    clock.advance(REQUEST_TIME);
-    for (int i = 0; i < numCalls; i++) {
-      filter.filter(containerRequest, containerResponse);
-    }
-
-    SlidingStats stat = filter.requestCounters.get(Pair.of(value, HttpServletResponse.SC_OK));
-    assertEquals(numCalls, stat.getEventCounter().get());
-    assertEquals(REQUEST_TIME.getValue() * numCalls, stat.getTotalCounter().get());
-    assertEquals(numCalls,
-        filter.statusCounters.get(HttpServletResponse.SC_OK).getEventCounter().get());
-  }
-
-  @Test
-  public void testNoStartTime() throws Exception {
-    expect(servletRequest.getAttribute(HttpStatsFilter.REQUEST_START_TIME))
-        .andReturn(null);
-
-    expect(containerResponse.getStatus()).andReturn(HttpServletResponse.SC_OK);
-
-    control.replay();
-
-    assertEquals(containerResponse, filter.filter(containerRequest, containerResponse));
-
-    assertEquals(0, filter.statusCounters.asMap().keySet().size());
-  }
-
-  @Test
-  public void testNoMatchedMethod() throws Exception {
-    expect(containerResponse.getStatus()).andReturn(HttpServletResponse.SC_NOT_FOUND);
-
-    expect(servletRequest.getAttribute(HttpStatsFilter.REQUEST_START_TIME))
-        .andReturn(clock.nowNanos());
-
-    expect(extendedUriInfo.getMatchedMethod()).andReturn(null);
-
-    control.replay();
-
-    clock.advance(REQUEST_TIME);
-    assertEquals(containerResponse, filter.filter(containerRequest, containerResponse));
-    assertEquals(1,
-        filter.statusCounters.get(HttpServletResponse.SC_NOT_FOUND).getEventCounter().get());
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/net/loadbalancing/LeastConnectedStrategyTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/net/loadbalancing/LeastConnectedStrategyTest.java b/commons/src/test/java/org/apache/aurora/common/net/loadbalancing/LeastConnectedStrategyTest.java
deleted file mode 100644
index dca92be..0000000
--- a/commons/src/test/java/org/apache/aurora/common/net/loadbalancing/LeastConnectedStrategyTest.java
+++ /dev/null
@@ -1,286 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net.loadbalancing;
-
-import java.util.Collection;
-
-import com.google.common.collect.ImmutableSet;
-
-import org.easymock.Capture;
-import org.junit.Before;
-import org.junit.Test;
-
-import org.apache.aurora.common.base.Closure;
-import org.apache.aurora.common.net.loadbalancing.LoadBalancingStrategy.ConnectionResult;
-import org.apache.aurora.common.net.pool.ResourceExhaustedException;
-import org.apache.aurora.common.testing.easymock.EasyMockTest;
-
-import static org.easymock.EasyMock.capture;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-
-/**
- * @author William Farner
- */
-public class LeastConnectedStrategyTest extends EasyMockTest {
-
-  private static final String BACKEND_1 = "backend1";
-  private static final String BACKEND_2 = "backend2";
-  private static final String BACKEND_3 = "backend3";
-  private static final String BACKEND_4 = "backend4";
-
-  private Closure<Collection<String>> onBackendsChosen;
-
-  private LoadBalancingStrategy<String> leastCon;
-
-  @Before
-  public void setUp() {
-    onBackendsChosen = createMock(new Clazz<Closure<Collection<String>>>() {});
-
-    leastCon = new LeastConnectedStrategy<String>();
-  }
-
-  @Test(expected = ResourceExhaustedException.class)
-  public void testNoBackends() throws ResourceExhaustedException {
-    control.replay();
-
-    leastCon.nextBackend();
-  }
-
-  @Test(expected = ResourceExhaustedException.class)
-  public void testEmptyBackends() throws ResourceExhaustedException {
-    BackendOfferExpectation backendOfferExpectation = new BackendOfferExpectation();
-    control.replay();
-
-    backendOfferExpectation.offerBackends();
-
-    leastCon.nextBackend();
-  }
-
-  @Test
-  public void testPicksLeastConnected() throws ResourceExhaustedException {
-    BackendOfferExpectation backendOfferExpectation = new BackendOfferExpectation();
-    control.replay();
-
-    backendOfferExpectation.offerBackends(BACKEND_1, BACKEND_2, BACKEND_3);
-
-    connect(BACKEND_1, 1);
-    connect(BACKEND_2, 2);
-    connect(BACKEND_3, 3);
-    assertThat(leastCon.nextBackend(), is(BACKEND_1));
-
-    connect(BACKEND_1, 2);
-    assertThat(leastCon.nextBackend(), is(BACKEND_2));
-  }
-
-  @Test
-  public void testPicksUnconnected() throws ResourceExhaustedException {
-    BackendOfferExpectation backendOfferExpectation = new BackendOfferExpectation();
-    control.replay();
-
-    backendOfferExpectation.offerBackends(BACKEND_1, BACKEND_2, BACKEND_3);
-    connect(BACKEND_1, 1);
-    connect(BACKEND_2, 2);
-
-    assertThat(leastCon.nextBackend(), is(BACKEND_3));
-  }
-
-  @Test
-  @SuppressWarnings("unchecked") // Needed because type information lost in varargs.
-  public void testHandlesEqualCount() throws ResourceExhaustedException {
-    BackendOfferExpectation backendOfferExpectation = new BackendOfferExpectation();
-    control.replay();
-
-    backendOfferExpectation.offerBackends(BACKEND_1, BACKEND_2, BACKEND_3);
-    connect(BACKEND_1, 5);
-    connect(BACKEND_2, 5);
-    connect(BACKEND_3, 5);
-
-    assertTrue(ImmutableSet.of(BACKEND_1, BACKEND_2, BACKEND_3).contains(leastCon.nextBackend()));
-  }
-
-  @Test
-  public void testReranks() throws ResourceExhaustedException {
-    BackendOfferExpectation backendOfferExpectation = new BackendOfferExpectation();
-    control.replay();
-
-    backendOfferExpectation.offerBackends(BACKEND_1, BACKEND_2, BACKEND_3);
-    connect(BACKEND_1, 10);
-    connect(BACKEND_2, 5);
-    connect(BACKEND_3, 5);
-
-    disconnect(BACKEND_1, 6);
-
-    assertThat(leastCon.nextBackend(), is(BACKEND_1));
-  }
-
-  @Test
-  public void testUsesAllBackends_success() throws ResourceExhaustedException {
-    BackendOfferExpectation backendOfferExpectation = new BackendOfferExpectation();
-    control.replay();
-
-    ImmutableSet<String> allBackends = ImmutableSet.of(BACKEND_1, BACKEND_2, BACKEND_3);
-    backendOfferExpectation.offerBackends(allBackends);
-
-    ImmutableSet.Builder<String> usedBackends = ImmutableSet.builder();
-    for (int i = 0; i < allBackends.size(); i++) {
-      String backend = leastCon.nextBackend();
-      usedBackends.add(backend);
-      connect(backend, 1);
-      disconnect(backend, 1);
-    }
-
-    assertThat(usedBackends.build(), is(allBackends));
-  }
-
-  @Test
-  public void UsesAllBackends_mixed() throws ResourceExhaustedException {
-    BackendOfferExpectation backendOfferExpectation = new BackendOfferExpectation();
-    control.replay();
-
-    backendOfferExpectation.offerBackends(BACKEND_1, BACKEND_2, BACKEND_3, BACKEND_4);
-
-    connect(BACKEND_1, ConnectionResult.FAILED, 1);
-    assertThat(leastCon.nextBackend(), is(BACKEND_2));
-
-    connect(BACKEND_2, ConnectionResult.FAILED, 1);
-    assertThat(leastCon.nextBackend(), is(BACKEND_3));
-
-    connect(BACKEND_3, 1);
-    assertThat(leastCon.nextBackend(), is(BACKEND_4));
-
-    connect(BACKEND_4, 1);
-
-    // Now we should rotate around to the front and give the connection failure another try.
-    assertThat(leastCon.nextBackend(), is(BACKEND_1));
-  }
-
-  @Test
-  public void testUsesAllBackends_failure() throws ResourceExhaustedException {
-    BackendOfferExpectation backendOfferExpectation = new BackendOfferExpectation();
-    control.replay();
-
-    ImmutableSet<String> allBackends = ImmutableSet.of(BACKEND_1, BACKEND_2, BACKEND_3);
-    backendOfferExpectation.offerBackends(allBackends);
-
-    ImmutableSet.Builder<String> usedBackends = ImmutableSet.builder();
-    for (int i = 0; i < allBackends.size(); i++) {
-      String backend = leastCon.nextBackend();
-      usedBackends.add(backend);
-      connect(backend, ConnectionResult.FAILED, 1);
-    }
-
-    assertThat(usedBackends.build(), is(allBackends));
-  }
-
-  @Test
-  public void testUsedLeastExhausted() throws ResourceExhaustedException {
-    BackendOfferExpectation backendOfferExpectation = new BackendOfferExpectation();
-    control.replay();
-
-    backendOfferExpectation.offerBackends(BACKEND_1, BACKEND_2, BACKEND_3);
-    connect(BACKEND_1, 10);
-    disconnect(BACKEND_1, 10);
-    connect(BACKEND_3, 5);
-    disconnect(BACKEND_3, 5);
-
-    assertThat(leastCon.nextBackend(), is(BACKEND_2));
-  }
-
-  @Test
-  public void testNoNegativeCounts() throws ResourceExhaustedException {
-    BackendOfferExpectation backendOfferExpectation = new BackendOfferExpectation();
-    control.replay();
-
-    backendOfferExpectation.offerBackends(BACKEND_1, BACKEND_2, BACKEND_3);
-    connect(BACKEND_1, 1);
-    connect(BACKEND_3, 1);
-
-    // If there was a bug allowing connection count to go negative, BACKEND_1 would be chosen,
-    // but if it floors at zero, BACKEND_2 will be the lowest.
-    disconnect(BACKEND_1, 5);
-  }
-
-  @Test
-  public void testForgetsOldBackends() throws ResourceExhaustedException {
-    BackendOfferExpectation offer1 = new BackendOfferExpectation();
-    BackendOfferExpectation offer2 = new BackendOfferExpectation();
-    BackendOfferExpectation offer3 = new BackendOfferExpectation();
-    control.replay();
-
-    offer1.offerBackends(BACKEND_1, BACKEND_2);
-    connect(BACKEND_2, 10);
-
-    offer2.offerBackends(BACKEND_2, BACKEND_3);
-    connect(BACKEND_3, 1);
-    assertThat(leastCon.nextBackend(), is(BACKEND_3));
-
-    offer3.offerBackends(BACKEND_2);
-    assertThat(leastCon.nextBackend(), is(BACKEND_2));
-  }
-
-  @Test
-  public void testAccountingSurvivesBackendChange() throws ResourceExhaustedException {
-    BackendOfferExpectation offer1 = new BackendOfferExpectation();
-    BackendOfferExpectation offer2 = new BackendOfferExpectation();
-    control.replay();
-
-    offer1.offerBackends(BACKEND_1, BACKEND_2, BACKEND_3, BACKEND_4);
-    connect(BACKEND_1, 10);
-    connect(BACKEND_2, 8);
-    connect(BACKEND_3, 9);
-    assertThat(leastCon.nextBackend(), is(BACKEND_4));
-
-    offer2.offerBackends(BACKEND_1, BACKEND_2, BACKEND_3);
-    assertThat(leastCon.nextBackend(), is(BACKEND_2));
-  }
-
-  private void connect(String backend, int count) {
-    connect(backend, ConnectionResult.SUCCESS, count);
-  }
-
-  private void connect(String backend, ConnectionResult result, int count) {
-    for (int i = 0; i < count; i++) {
-      leastCon.addConnectResult(backend, result, 0L);
-    }
-  }
-
-  private void disconnect(String backend, int count) {
-    for (int i = 0; i < count; i++) {
-      leastCon.connectionReturned(backend);
-    }
-  }
-
-  private class BackendOfferExpectation {
-    private final Capture<Collection<String>> chosenBackends;
-
-    private BackendOfferExpectation() {
-      chosenBackends = createCapture();
-      onBackendsChosen.execute(capture(chosenBackends));
-    }
-
-    void offerBackends(String... backends) {
-      offerBackends(ImmutableSet.copyOf(backends));
-    }
-
-    void offerBackends(ImmutableSet<String> backends) {
-      leastCon.offerBackends(backends, onBackendsChosen);
-
-      assertTrue(chosenBackends.hasCaptured());
-      assertEquals(backends, ImmutableSet.copyOf(chosenBackends.getValue()));
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/net/loadbalancing/LoadBalancerImplTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/net/loadbalancing/LoadBalancerImplTest.java b/commons/src/test/java/org/apache/aurora/common/net/loadbalancing/LoadBalancerImplTest.java
deleted file mode 100644
index 973bf6b..0000000
--- a/commons/src/test/java/org/apache/aurora/common/net/loadbalancing/LoadBalancerImplTest.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net.loadbalancing;
-
-import com.google.common.collect.Sets;
-import org.apache.aurora.common.base.Closure;
-import org.apache.aurora.common.testing.easymock.EasyMockTest;
-import org.apache.aurora.common.net.pool.ResourceExhaustedException;
-import org.apache.aurora.common.net.loadbalancing.LoadBalancingStrategy.ConnectionResult;
-import org.apache.aurora.common.net.loadbalancing.RequestTracker.RequestResult;
-import org.easymock.Capture;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.util.Collection;
-import java.util.Set;
-
-import static org.easymock.EasyMock.capture;
-import static org.easymock.EasyMock.eq;
-import static org.easymock.EasyMock.expect;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-
-/**
- * @author William Farner
- */
-public class LoadBalancerImplTest extends EasyMockTest {
-
-  private static final String BACKEND_1 = "backend1";
-  private static final String BACKEND_2 = "backend2";
-
-  private LoadBalancingStrategy<String> strategy;
-  private Closure<Collection<String>> onBackendsChosen;
-
-  private LoadBalancer<String> loadBalancer;
-
-  @Before
-  public void setUp() {
-    strategy = createMock(new Clazz<LoadBalancingStrategy<String>>() {});
-    onBackendsChosen = createMock(new Clazz<Closure<Collection<String>>>() {});
-
-    loadBalancer = LoadBalancerImpl.create(this.strategy);
-  }
-
-  @Test
-  public void testForwardsBasicCalls() throws ResourceExhaustedException {
-    BackendOfferExpectation backendOfferExpectation =
-        new BackendOfferExpectation(BACKEND_1, BACKEND_2);
-    expect(strategy.nextBackend()).andReturn(BACKEND_1);
-    strategy.addConnectResult(BACKEND_1, ConnectionResult.SUCCESS, 0L);
-    strategy.connectionReturned(BACKEND_1);
-    strategy.addConnectResult(BACKEND_1, ConnectionResult.TIMEOUT, 0L);
-
-    control.replay();
-
-    backendOfferExpectation.simulateBackendsChosen();
-
-    assertThat(loadBalancer.nextBackend(), is(BACKEND_1));
-    loadBalancer.connected(BACKEND_1, 0L);
-    loadBalancer.released(BACKEND_1);
-    loadBalancer.connectFailed(BACKEND_1, ConnectionResult.TIMEOUT);
-  }
-
-  @Test
-  public void testHandlesUnknownBackend() {
-    BackendOfferExpectation first = new BackendOfferExpectation(BACKEND_1, BACKEND_2);
-    BackendOfferExpectation second = new BackendOfferExpectation(BACKEND_1);
-
-    strategy.addConnectResult(BACKEND_1, ConnectionResult.SUCCESS, 0L);
-    strategy.connectionReturned(BACKEND_1);
-
-    BackendOfferExpectation third = new BackendOfferExpectation(BACKEND_1, BACKEND_2);
-
-    strategy.addConnectResult(BACKEND_1, ConnectionResult.SUCCESS, 0L);
-    strategy.addConnectResult(BACKEND_2, ConnectionResult.SUCCESS, 0L);
-
-    BackendOfferExpectation fourth = new BackendOfferExpectation(BACKEND_1);
-
-    strategy.addRequestResult(BACKEND_1, RequestResult.SUCCESS, 0L);
-    strategy.connectionReturned(BACKEND_1);
-
-    control.replay();
-
-    first.simulateBackendsChosen();
-    second.simulateBackendsChosen();
-
-    loadBalancer.connected(BACKEND_1, 0L);
-    loadBalancer.released(BACKEND_1);
-
-    // Release an unrecognized connection, should not propagate to strategy.
-    loadBalancer.released("foo");
-
-    // Requests related to BACKEND_2 are not forwarded.
-    loadBalancer.connected(BACKEND_2, 0L);
-    loadBalancer.connectFailed(BACKEND_2, ConnectionResult.FAILED);
-    loadBalancer.requestResult(BACKEND_2, RequestResult.SUCCESS, 0L);
-    loadBalancer.released(BACKEND_2);
-
-    third.simulateBackendsChosen();
-    loadBalancer.connected(BACKEND_1, 0L);
-    loadBalancer.connected(BACKEND_2, 0L);
-    fourth.simulateBackendsChosen();
-    loadBalancer.requestResult(BACKEND_1, RequestResult.SUCCESS, 0L);
-    loadBalancer.requestResult(BACKEND_2, RequestResult.SUCCESS, 0L);
-    loadBalancer.released(BACKEND_1);
-    loadBalancer.released(BACKEND_2);
-  }
-
-  private class BackendOfferExpectation {
-    private final Set<String> backends;
-    private final Capture<Closure<Collection<String>>> onBackendsChosenCapture;
-
-    private BackendOfferExpectation(String ... backends) {
-      this.backends = Sets.newHashSet(backends);
-      onBackendsChosenCapture = createCapture();
-
-      strategy.offerBackends(eq(this.backends), capture(onBackendsChosenCapture));
-      onBackendsChosen.execute(this.backends);
-    }
-
-    void simulateBackendsChosen() {
-      loadBalancer.offerBackends(backends, onBackendsChosen);
-      assertTrue(onBackendsChosenCapture.hasCaptured());
-
-      // Simulate the strategy notifying LoadBalancer's callback of a backend choice
-      onBackendsChosenCapture.getValue().execute(backends);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/net/loadbalancing/MarkDeadStrategyTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/net/loadbalancing/MarkDeadStrategyTest.java b/commons/src/test/java/org/apache/aurora/common/net/loadbalancing/MarkDeadStrategyTest.java
deleted file mode 100644
index 4839e17..0000000
--- a/commons/src/test/java/org/apache/aurora/common/net/loadbalancing/MarkDeadStrategyTest.java
+++ /dev/null
@@ -1,332 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net.loadbalancing;
-
-import com.google.common.base.Function;
-import com.google.common.collect.Sets;
-import com.google.common.base.Predicate;
-import org.apache.aurora.common.base.Closure;
-import org.apache.aurora.common.net.pool.ResourceExhaustedException;
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-import org.apache.aurora.common.testing.easymock.EasyMockTest;
-import org.apache.aurora.common.net.loadbalancing.LoadBalancingStrategy.ConnectionResult;
-import org.apache.aurora.common.net.loadbalancing.RequestTracker.RequestResult;
-import org.apache.aurora.common.util.BackoffDecider;
-import org.apache.aurora.common.util.Random;
-import org.apache.aurora.common.util.TruncatedBinaryBackoff;
-import org.apache.aurora.common.util.testing.FakeClock;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.util.Collection;
-
-import static org.easymock.EasyMock.expect;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-/**
- * @author William Farner
- */
-public class MarkDeadStrategyTest extends EasyMockTest {
-
-  private static final Amount<Long, Time> INITIAL_BACKOFF = Amount.of(1L, Time.SECONDS);
-  private static final Amount<Long, Time> MAX_BACKOFF = Amount.of(10L, Time.SECONDS);
-
-  private static final String BACKEND_1 = "backend1";
-  private static final String BACKEND_2 = "backend2";
-
-  private LoadBalancingStrategy<String> wrappedStrategy;
-  private Closure<Collection<String>> onBackendsChosen;
-  private Predicate<String> mockHostChecker;
-
-  private LoadBalancingStrategy<String> markDead;
-  private Random random;
-  private FakeClock clock;
-
-  @Before
-  public void setUp() {
-    wrappedStrategy = createMock(new Clazz<LoadBalancingStrategy<String>>() {});
-    onBackendsChosen = createMock(new Clazz<Closure<Collection<String>>>() {});
-    mockHostChecker = createMock(new Clazz<Predicate<String>>() {});
-
-    random = createMock(Random.class);
-    clock = new FakeClock();
-
-    Function<String, BackoffDecider> backoffFactory =
-        new Function<String, BackoffDecider>() {
-          @Override public BackoffDecider apply(String s) {
-            return BackoffDecider.builder(s)
-                .withSeedSize(1)
-                .withClock(clock)
-                .withRandom(random)
-                .withTolerateFailureRate(0.5)
-                .withStrategy(new TruncatedBinaryBackoff(INITIAL_BACKOFF, MAX_BACKOFF))
-                // This recovery type is suggested for load balancer strategies to prevent
-                // connection pool churn that would occur from the random linear recovery type.
-                .withRecoveryType(BackoffDecider.RecoveryType.FULL_CAPACITY)
-                .withRequestWindow(MAX_BACKOFF)
-                .build();
-          }
-        };
-
-    markDead = new MarkDeadStrategy<String>(wrappedStrategy, backoffFactory, mockHostChecker);
-
-  }
-
-  @After
-  public void verify() {
-    control.verify();
-  }
-
-  @Test(expected = ResourceExhaustedException.class)
-  public void testNoBackends() throws ResourceExhaustedException {
-    expect(wrappedStrategy.nextBackend()).andThrow(new ResourceExhaustedException("No backends."));
-
-    control.replay();
-
-    markDead.nextBackend();
-  }
-
-  @Test
-  public void testForwardsBasicCalls() throws ResourceExhaustedException {
-    wrappedStrategy.offerBackends(Sets.newHashSet(BACKEND_1, BACKEND_2), onBackendsChosen);
-    expect(wrappedStrategy.nextBackend()).andReturn(BACKEND_1);
-
-    control.replay();
-
-    markDead.offerBackends(Sets.newHashSet(BACKEND_1, BACKEND_2), onBackendsChosen);
-    assertThat(markDead.nextBackend(), is(BACKEND_1));
-  }
-
-  @Test
-  public void testAllHealthy() {
-    wrappedStrategy.offerBackends(Sets.newHashSet(BACKEND_1, BACKEND_2), onBackendsChosen);
-    expectConnected(BACKEND_1, ConnectionResult.SUCCESS, 10);
-    expectRequest(BACKEND_1, RequestResult.SUCCESS, 10);
-    expectConnected(BACKEND_2, ConnectionResult.SUCCESS, 10);
-    expectRequest(BACKEND_2, RequestResult.SUCCESS, 10);
-
-    control.replay();
-
-    markDead.offerBackends(Sets.newHashSet(BACKEND_1, BACKEND_2), onBackendsChosen);
-    request(BACKEND_1, RequestResult.SUCCESS, connect(BACKEND_1, ConnectionResult.SUCCESS, 10));
-    request(BACKEND_2, RequestResult.SUCCESS, connect(BACKEND_2, ConnectionResult.SUCCESS, 10));
-  }
-
-  @Test
-  public void testOneFailingConnections() {
-    wrappedStrategy.offerBackends(Sets.newHashSet(BACKEND_1, BACKEND_2), onBackendsChosen);
-    expectConnected(BACKEND_1, ConnectionResult.SUCCESS, 10);
-    expectConnected(BACKEND_2, ConnectionResult.SUCCESS, 4);
-    expectConnected(BACKEND_2, ConnectionResult.FAILED, 4);
-    wrappedStrategy.offerBackends(Sets.newHashSet(BACKEND_1), onBackendsChosen);
-
-    control.replay();
-
-    markDead.offerBackends(Sets.newHashSet(BACKEND_1, BACKEND_2), onBackendsChosen);
-    connect(BACKEND_1, ConnectionResult.SUCCESS, 10);
-    connect(BACKEND_2, ConnectionResult.SUCCESS, 4);
-    connect(BACKEND_2, ConnectionResult.FAILED, 10);
-  }
-
-  @Test
-  public void testOneFailingRequests() {
-    wrappedStrategy.offerBackends(Sets.newHashSet(BACKEND_1, BACKEND_2), onBackendsChosen);
-    expectConnected(BACKEND_1, ConnectionResult.SUCCESS, 10);
-    expectRequest(BACKEND_1, RequestResult.SUCCESS, 10);
-    expectConnected(BACKEND_2, ConnectionResult.SUCCESS, 10);
-    expectRequest(BACKEND_2, RequestResult.SUCCESS, 10);
-    expectConnected(BACKEND_1, ConnectionResult.SUCCESS, 10);
-    expectRequest(BACKEND_1, RequestResult.FAILED, 30);
-    wrappedStrategy.offerBackends(Sets.newHashSet(BACKEND_2), onBackendsChosen);
-
-    control.replay();
-
-    markDead.offerBackends(Sets.newHashSet(BACKEND_1, BACKEND_2), onBackendsChosen);
-    request(BACKEND_1, RequestResult.SUCCESS, connect(BACKEND_1, ConnectionResult.SUCCESS, 10));
-    request(BACKEND_2, RequestResult.SUCCESS, connect(BACKEND_2, ConnectionResult.SUCCESS, 10));
-    connect(BACKEND_1, ConnectionResult.SUCCESS, 10);
-    request(BACKEND_1, RequestResult.FAILED, 50);
-  }
-
-  @Test
-  public void testOneTimingOut() {
-    wrappedStrategy.offerBackends(Sets.newHashSet(BACKEND_1, BACKEND_2), onBackendsChosen);
-    expectConnected(BACKEND_1, ConnectionResult.SUCCESS, 10);
-    expectRequest(BACKEND_1, RequestResult.SUCCESS, 10);
-    expectConnected(BACKEND_2, ConnectionResult.SUCCESS, 10);
-    expectRequest(BACKEND_2, RequestResult.SUCCESS, 10);
-    expectConnected(BACKEND_2, ConnectionResult.SUCCESS, 10);
-    expectRequest(BACKEND_2, RequestResult.TIMEOUT, 30);
-    wrappedStrategy.offerBackends(Sets.newHashSet(BACKEND_1), onBackendsChosen);
-
-    control.replay();
-
-    markDead.offerBackends(Sets.newHashSet(BACKEND_1, BACKEND_2), onBackendsChosen);
-    request(BACKEND_1, RequestResult.SUCCESS, connect(BACKEND_1, ConnectionResult.SUCCESS, 10));
-    request(BACKEND_2, RequestResult.SUCCESS, connect(BACKEND_2, ConnectionResult.SUCCESS, 10));
-    connect(BACKEND_2, ConnectionResult.SUCCESS, 10);
-    request(BACKEND_2, RequestResult.TIMEOUT, 50);
-  }
-
-  @Test
-  public void testFailingRecovers() {
-    wrappedStrategy.offerBackends(Sets.newHashSet(BACKEND_1, BACKEND_2), onBackendsChosen);
-    expectConnected(BACKEND_1, ConnectionResult.SUCCESS, 10);
-    expectConnected(BACKEND_2, ConnectionResult.SUCCESS, 4);
-    expectConnected(BACKEND_2, ConnectionResult.FAILED, 4);
-
-    wrappedStrategy.offerBackends(Sets.newHashSet(BACKEND_1), onBackendsChosen);
-
-    wrappedStrategy.offerBackends(Sets.newHashSet(BACKEND_1, BACKEND_2), onBackendsChosen);
-    expectConnected(BACKEND_1, ConnectionResult.SUCCESS, 10);
-    expectConnected(BACKEND_2, ConnectionResult.SUCCESS, 9);
-
-    expect(mockHostChecker.apply(BACKEND_2)).andReturn(true);
-
-    control.replay();
-
-    markDead.offerBackends(Sets.newHashSet(BACKEND_1, BACKEND_2), onBackendsChosen);
-    connect(BACKEND_1, ConnectionResult.SUCCESS, 10);
-    connect(BACKEND_2, ConnectionResult.SUCCESS, 4);
-    connect(BACKEND_2, ConnectionResult.FAILED, 5);
-
-    connect(BACKEND_1, ConnectionResult.SUCCESS, 5);
-    clock.advance(INITIAL_BACKOFF);  // Wait for backoff period to expire.
-    clock.waitFor(1);
-    clock.advance(INITIAL_BACKOFF);  // Wait for recovery period to expire.
-    connect(BACKEND_1, ConnectionResult.SUCCESS, 5);
-    connect(BACKEND_2, ConnectionResult.SUCCESS, 9);
-  }
-
-  @Test
-  public void testFailingServerWithLiveHostChecker() {
-    wrappedStrategy.offerBackends(Sets.newHashSet(BACKEND_1, BACKEND_2), onBackendsChosen);
-    expectConnected(BACKEND_1, ConnectionResult.SUCCESS, 10);
-    expectConnected(BACKEND_2, ConnectionResult.SUCCESS, 4);
-    expectConnected(BACKEND_2, ConnectionResult.FAILED, 4);
-
-    wrappedStrategy.offerBackends(Sets.newHashSet(BACKEND_1), onBackendsChosen);
-
-    expectConnected(BACKEND_1, ConnectionResult.SUCCESS, 10);
-
-    expect(mockHostChecker.apply(BACKEND_2)).andReturn(false);
-
-    wrappedStrategy.offerBackends(Sets.newHashSet(BACKEND_1, BACKEND_2), onBackendsChosen);
-
-    expectConnected(BACKEND_1, ConnectionResult.SUCCESS, 5);
-    expectConnected(BACKEND_2, ConnectionResult.SUCCESS, 10);
-
-    expect(mockHostChecker.apply(BACKEND_2)).andReturn(true);
-
-    control.replay();
-
-    markDead.offerBackends(Sets.newHashSet(BACKEND_1, BACKEND_2), onBackendsChosen);
-
-    connect(BACKEND_1, ConnectionResult.SUCCESS, 10);
-    connect(BACKEND_2, ConnectionResult.SUCCESS, 4);
-    connect(BACKEND_2, ConnectionResult.FAILED, 5);
-
-    connect(BACKEND_1, ConnectionResult.SUCCESS, 5);
-    clock.advance(INITIAL_BACKOFF);  // Wait for backoff period to expire.
-    clock.waitFor(1);
-    clock.advance(INITIAL_BACKOFF);  // Wait for recovery period to expire.
-    connect(BACKEND_1, ConnectionResult.SUCCESS, 5);
-    clock.advance(INITIAL_BACKOFF);  // Wait for backoff period to expire.
-    clock.waitFor(1);
-    clock.advance(INITIAL_BACKOFF);  // Wait for recovery period to expire.
-    connect(BACKEND_1, ConnectionResult.SUCCESS, 5);
-    connect(BACKEND_2, ConnectionResult.SUCCESS, 10);
-  }
-
-  @Test
-  public void testAllDead() {
-    wrappedStrategy.offerBackends(Sets.newHashSet(BACKEND_1, BACKEND_2), onBackendsChosen);
-    expectConnected(BACKEND_1, ConnectionResult.SUCCESS, 10);
-    expectConnected(BACKEND_2, ConnectionResult.SUCCESS, 10);
-    expectConnected(BACKEND_1, ConnectionResult.FAILED, 10);
-    wrappedStrategy.offerBackends(Sets.newHashSet(BACKEND_2), onBackendsChosen);
-    expectConnected(BACKEND_2, ConnectionResult.FAILED, 10);
-    wrappedStrategy.offerBackends(Sets.newHashSet(BACKEND_1, BACKEND_2), onBackendsChosen);
-    expectConnected(BACKEND_2, ConnectionResult.FAILED, 5);
-
-    control.replay();
-
-    markDead.offerBackends(Sets.newHashSet(BACKEND_1, BACKEND_2), onBackendsChosen);
-    connect(BACKEND_1, ConnectionResult.SUCCESS, 10);
-    connect(BACKEND_2, ConnectionResult.SUCCESS, 10);
-    connect(BACKEND_1, ConnectionResult.FAILED, 15);
-    connect(BACKEND_2, ConnectionResult.FAILED, 15);
-  }
-
-  @Test
-  public void testRecoversFromForcedLiveMode() {
-    wrappedStrategy.offerBackends(Sets.newHashSet(BACKEND_1, BACKEND_2), onBackendsChosen);
-
-    expectConnected(BACKEND_1, ConnectionResult.SUCCESS, 5);
-    expectConnected(BACKEND_1, ConnectionResult.FAILED, 5);  // Backend 1 starts backing off.
-    wrappedStrategy.offerBackends(Sets.newHashSet(BACKEND_2), onBackendsChosen);
-
-    expectConnected(BACKEND_2, ConnectionResult.SUCCESS, 5);
-    expectConnected(BACKEND_2, ConnectionResult.FAILED, 5);  // Backend 2 starts backing off.
-    wrappedStrategy.offerBackends(Sets.newHashSet(BACKEND_1, BACKEND_2), onBackendsChosen);
-    wrappedStrategy.offerBackends(Sets.newHashSet(BACKEND_1, BACKEND_2), onBackendsChosen);
-
-    expectConnected(BACKEND_2, ConnectionResult.SUCCESS, 5);
-    expectConnected(BACKEND_2, ConnectionResult.FAILED, 5);  // Backend 2 starts backing off.
-    wrappedStrategy.offerBackends(Sets.newHashSet(BACKEND_1), onBackendsChosen);
-
-    control.replay();
-
-    markDead.offerBackends(Sets.newHashSet(BACKEND_1, BACKEND_2), onBackendsChosen);
-
-    connect(BACKEND_1, ConnectionResult.SUCCESS, 5);
-    connect(BACKEND_1, ConnectionResult.FAILED, 6);  // BACKEND_1 gets marked as dead.
-
-    connect(BACKEND_2, ConnectionResult.SUCCESS, 5);
-    connect(BACKEND_2, ConnectionResult.FAILED, 6);  // All now marked dead, forced into live mode.
-
-    clock.advance(INITIAL_BACKOFF);  // Wait for backoff period to expire.
-    clock.waitFor(1);
-    connect(BACKEND_2, ConnectionResult.SUCCESS, 5);
-    connect(BACKEND_2, ConnectionResult.FAILED, 5);  // BACKEND_2 marked as dead.
-  }
-
-  private int connect(String backend, ConnectionResult result, int count) {
-    for (int i = 0; i < count; i++) {
-      markDead.addConnectResult(backend, result, 0L);
-    }
-    return count;
-  }
-
-  private void request(String backend, RequestResult result, int count) {
-    for (int i = 0; i < count; i++) {
-      markDead.addRequestResult(backend, result, 0L);
-    }
-  }
-
-  private void expectConnected(String backend, ConnectionResult result, int count) {
-    for (int i = 0; i < count; i++) {
-      wrappedStrategy.addConnectResult(backend, result, 0L);
-    }
-  }
-
-  private void expectRequest(String backend, RequestResult result, int count) {
-    for (int i = 0; i < count; i++) {
-      wrappedStrategy.addRequestResult(backend, result, 0L);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/net/loadbalancing/MarkDeadStrategyWithHostCheckTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/net/loadbalancing/MarkDeadStrategyWithHostCheckTest.java b/commons/src/test/java/org/apache/aurora/common/net/loadbalancing/MarkDeadStrategyWithHostCheckTest.java
deleted file mode 100644
index b3c14ea..0000000
--- a/commons/src/test/java/org/apache/aurora/common/net/loadbalancing/MarkDeadStrategyWithHostCheckTest.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net.loadbalancing;
-
-import java.util.Collection;
-
-import com.google.common.base.Function;
-import com.google.common.collect.Sets;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import org.apache.aurora.common.base.Closure;
-import org.apache.aurora.common.net.loadbalancing.LoadBalancingStrategy.ConnectionResult;
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-import org.apache.aurora.common.testing.easymock.EasyMockTest;
-import org.apache.aurora.common.util.BackoffDecider;
-import org.apache.aurora.common.util.Random;
-import org.apache.aurora.common.util.TruncatedBinaryBackoff;
-import org.apache.aurora.common.util.testing.FakeClock;
-
-/**
- * @author Krishna Gade
- */
-public class MarkDeadStrategyWithHostCheckTest extends EasyMockTest {
-
-  private static final Amount<Long, Time> INITIAL_BACKOFF = Amount.of(1L, Time.SECONDS);
-  private static final Amount<Long, Time> MAX_BACKOFF = Amount.of(10L, Time.SECONDS);
-
-  private static final String BACKEND_1 = "backend1";
-  private static final String BACKEND_2 = "backend2";
-
-  private LoadBalancingStrategy<String> wrappedStrategy;
-  private Closure<Collection<String>> onBackendsChosen;
-
-  private LoadBalancingStrategy<String> markDead;
-  private Random random;
-  private FakeClock clock;
-
-  @Before
-  public void setUp() {
-    wrappedStrategy = createMock(new Clazz<LoadBalancingStrategy<String>>() {});
-    onBackendsChosen = createMock(new Clazz<Closure<Collection<String>>>() {});
-
-    random = createMock(Random.class);
-    clock = new FakeClock();
-
-    Function<String, BackoffDecider> backoffFactory =
-        new Function<String, BackoffDecider>() {
-          @Override public BackoffDecider apply(String s) {
-            return BackoffDecider.builder(s)
-                .withSeedSize(1)
-                .withClock(clock)
-                .withRandom(random)
-                .withTolerateFailureRate(0.5)
-                .withStrategy(new TruncatedBinaryBackoff(INITIAL_BACKOFF, MAX_BACKOFF))
-                // This recovery type is suggested for load balancer strategies to prevent
-                // connection pool churn that would occur from the random linear recovery type.
-                .withRecoveryType(BackoffDecider.RecoveryType.FULL_CAPACITY)
-                .withRequestWindow(MAX_BACKOFF)
-                .build();
-          }
-        };
-
-    markDead = new MarkDeadStrategyWithHostCheck<String>(wrappedStrategy, backoffFactory);
-
-  }
-
-  @After
-  public void verify() {
-    control.verify();
-  }
-
-  @Test
-  public void testDeadHost() {
-    wrappedStrategy.offerBackends(Sets.newHashSet(BACKEND_1, BACKEND_2), onBackendsChosen);
-    expectConnected(BACKEND_1, ConnectionResult.SUCCESS, 10);
-    expectConnected(BACKEND_2, ConnectionResult.SUCCESS, 4);
-    expectConnected(BACKEND_2, ConnectionResult.FAILED, 4);
-    wrappedStrategy.offerBackends(Sets.newHashSet(BACKEND_1), onBackendsChosen);
-
-    expectConnected(BACKEND_2, ConnectionResult.SUCCESS, 1);
-    wrappedStrategy.offerBackends(Sets.newHashSet(BACKEND_1, BACKEND_2), onBackendsChosen);
-
-    control.replay();
-
-    markDead.offerBackends(Sets.newHashSet(BACKEND_1, BACKEND_2), onBackendsChosen);
-    connect(BACKEND_1, ConnectionResult.SUCCESS, 10);
-    connect(BACKEND_2, ConnectionResult.SUCCESS, 4);
-    connect(BACKEND_2, ConnectionResult.FAILED, 10);
-    clock.advance(INITIAL_BACKOFF);  // Wait for backoff period to expire.
-    clock.waitFor(1);
-    clock.advance(INITIAL_BACKOFF);  // Wait for recovery period to expire.
-    connect(BACKEND_2, ConnectionResult.SUCCESS, 1);
-  }
-
-  @Test
-  public void testDeadHostWithMaxBackOff() {
-    wrappedStrategy.offerBackends(Sets.newHashSet(BACKEND_1, BACKEND_2), onBackendsChosen);
-    expectConnected(BACKEND_1, ConnectionResult.SUCCESS, 10);
-    expectConnected(BACKEND_2, ConnectionResult.SUCCESS, 4);
-    expectConnected(BACKEND_2, ConnectionResult.FAILED, 4);
-    wrappedStrategy.offerBackends(Sets.newHashSet(BACKEND_1), onBackendsChosen);
-
-    expectConnected(BACKEND_2, ConnectionResult.SUCCESS, 1);
-    wrappedStrategy.offerBackends(Sets.newHashSet(BACKEND_1, BACKEND_2), onBackendsChosen);
-
-    control.replay();
-
-    markDead.offerBackends(Sets.newHashSet(BACKEND_1, BACKEND_2), onBackendsChosen);
-    connect(BACKEND_1, ConnectionResult.SUCCESS, 10);
-    connect(BACKEND_2, ConnectionResult.SUCCESS, 4);
-    connect(BACKEND_2, ConnectionResult.FAILED, 10);
-    clock.advance(INITIAL_BACKOFF);  // Wait for backoff period to expire.
-    clock.waitFor(1);
-    clock.advance(INITIAL_BACKOFF);  // Wait for recovery period to expire.
-    clock.advance(MAX_BACKOFF);  // Wait for recovery period to expire.
-    connect(BACKEND_2, ConnectionResult.SUCCESS, 1);
-  }
-
-  private int connect(String backend, ConnectionResult result, int count) {
-    for (int i = 0; i < count; i++) {
-      markDead.addConnectResult(backend, result, 0L);
-    }
-    return count;
-  }
-
-  private void expectConnected(String backend, ConnectionResult result, int count) {
-    for (int i = 0; i < count; i++) {
-      wrappedStrategy.addConnectResult(backend, result, 0L);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/net/loadbalancing/RandomStrategyTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/net/loadbalancing/RandomStrategyTest.java b/commons/src/test/java/org/apache/aurora/common/net/loadbalancing/RandomStrategyTest.java
deleted file mode 100644
index 213b0bb..0000000
--- a/commons/src/test/java/org/apache/aurora/common/net/loadbalancing/RandomStrategyTest.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net.loadbalancing;
-
-import java.util.Collection;
-import java.util.HashSet;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Sets;
-
-import org.apache.aurora.common.net.pool.ResourceExhaustedException;
-import org.easymock.Capture;
-import org.junit.Before;
-import org.junit.Test;
-
-import org.apache.aurora.common.base.Closure;
-
-import org.apache.aurora.common.testing.easymock.EasyMockTest;
-
-import static org.easymock.EasyMock.capture;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-/**
- * @author William Farner
- */
-public class RandomStrategyTest extends EasyMockTest {
-
-  private static final String BACKEND_1 = "backend1";
-  private static final String BACKEND_2 = "backend2";
-  private static final String BACKEND_3 = "backend3";
-
-  private Closure<Collection<String>> onBackendsChosen;
-
-  private LoadBalancingStrategy<String> randomStrategy;
-
-  @Before
-  public void setUp() {
-    onBackendsChosen = createMock(new Clazz<Closure<Collection<String>>>() {});
-
-    randomStrategy = new RandomStrategy<String>();
-  }
-
-  @Test(expected = ResourceExhaustedException.class)
-  public void testNoBackends() throws ResourceExhaustedException {
-    control.replay();
-
-    randomStrategy.nextBackend();
-  }
-
-  @Test
-  public void testEmptyBackends() throws ResourceExhaustedException {
-    Capture<Collection<String>> capture = createCapture();
-    onBackendsChosen.execute(capture(capture));
-    control.replay();
-
-    randomStrategy.offerBackends(Sets.<String>newHashSet(), onBackendsChosen);
-
-    try {
-      randomStrategy.nextBackend();
-      fail("Expected ResourceExhaustedException to be thrown");
-    } catch (ResourceExhaustedException e) {
-      // expected
-    }
-
-    assertTrue(capture.hasCaptured());
-    assertTrue(capture.getValue().isEmpty());
-  }
-
-  @Test
-  @SuppressWarnings("unchecked") // Needed because type information lost in vargs.
-  public void testRandomSelection() throws ResourceExhaustedException {
-    Capture<Collection<String>> capture = createCapture();
-    onBackendsChosen.execute(capture(capture));
-    control.replay();
-
-    HashSet<String> backends = Sets.newHashSet(BACKEND_1, BACKEND_2, BACKEND_3);
-    randomStrategy.offerBackends(backends, onBackendsChosen);
-
-    assertTrue(ImmutableSet.of(BACKEND_1, BACKEND_2, BACKEND_3)
-        .contains(randomStrategy.nextBackend()));
-    assertTrue(capture.hasCaptured());
-    assertEquals(backends, Sets.newHashSet(capture.getValue()));
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/net/loadbalancing/RoundRobinStrategyTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/net/loadbalancing/RoundRobinStrategyTest.java b/commons/src/test/java/org/apache/aurora/common/net/loadbalancing/RoundRobinStrategyTest.java
deleted file mode 100644
index f07b2a1..0000000
--- a/commons/src/test/java/org/apache/aurora/common/net/loadbalancing/RoundRobinStrategyTest.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net.loadbalancing;
-
-import com.google.common.collect.Sets;
-import org.apache.aurora.common.base.Closure;
-import org.apache.aurora.common.testing.easymock.EasyMockTest;
-import org.apache.aurora.common.net.pool.ResourceExhaustedException;
-import org.easymock.Capture;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-
-import static org.easymock.EasyMock.capture;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-/**
- * @author William Farner
- */
-public class RoundRobinStrategyTest extends EasyMockTest {
-
-  private static final String BACKEND_1 = "backend1";
-  private static final String BACKEND_2 = "backend2";
-  private static final String BACKEND_3 = "backend3";
-
-  private Closure<Collection<String>> onBackendsChosen;
-
-  private LoadBalancingStrategy<String> roundRobin;
-
-  @Before
-  public void setUp() {
-    onBackendsChosen = createMock(new Clazz<Closure<Collection<String>>>() {});
-
-    roundRobin = new RoundRobinStrategy<String>();
-  }
-
-  @Test(expected = ResourceExhaustedException.class)
-  public void testNoBackends() throws ResourceExhaustedException {
-    control.replay();
-
-    roundRobin.nextBackend();
-  }
-
-  @Test
-  public void testEmptyBackends() throws ResourceExhaustedException {
-    Capture<Collection<String>> capture = createCapture();
-    onBackendsChosen.execute(capture(capture));
-    control.replay();
-
-    roundRobin.offerBackends(Sets.<String>newHashSet(), onBackendsChosen);
-
-    try {
-      roundRobin.nextBackend();
-      fail("Expected ResourceExhaustedException to be thrown");
-    } catch (ResourceExhaustedException e) {
-      // expected
-    }
-
-    assertTrue(capture.hasCaptured());
-    assertTrue(capture.getValue().isEmpty());
-  }
-
-  @Test
-  public void testConsistentOrdering() throws ResourceExhaustedException {
-    Capture<Collection<String>> capture = createCapture();
-    onBackendsChosen.execute(capture(capture));
-    control.replay();
-
-    HashSet<String> backends = Sets.newHashSet(BACKEND_1, BACKEND_2, BACKEND_3);
-    roundRobin.offerBackends(backends, onBackendsChosen);
-    Set<String> iteration1 = Sets.newHashSet(
-        roundRobin.nextBackend(),
-        roundRobin.nextBackend(),
-        roundRobin.nextBackend()
-    );
-    Set<String> iteration2 = Sets.newHashSet(
-        roundRobin.nextBackend(),
-        roundRobin.nextBackend(),
-        roundRobin.nextBackend()
-    );
-
-    assertThat(iteration2, is(iteration1));
-    assertTrue(capture.hasCaptured());
-    assertEquals(backends, Sets.newHashSet(capture.getValue()));
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/net/loadbalancing/SubsetStrategyTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/net/loadbalancing/SubsetStrategyTest.java b/commons/src/test/java/org/apache/aurora/common/net/loadbalancing/SubsetStrategyTest.java
deleted file mode 100644
index 25c228a..0000000
--- a/commons/src/test/java/org/apache/aurora/common/net/loadbalancing/SubsetStrategyTest.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net.loadbalancing;
-
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Sets;
-import org.apache.aurora.common.base.Closure;
-import org.apache.aurora.common.net.pool.ResourceExhaustedException;
-import org.apache.aurora.common.testing.easymock.EasyMockTest;
-import org.apache.aurora.common.net.loadbalancing.LoadBalancingStrategy.ConnectionResult;
-import org.apache.aurora.common.net.loadbalancing.RequestTracker.RequestResult;
-import org.easymock.Capture;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.util.Collection;
-import java.util.Set;
-
-import static org.easymock.EasyMock.anyObject;
-import static org.easymock.EasyMock.capture;
-import static org.easymock.EasyMock.eq;
-import static org.easymock.EasyMock.expect;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-/**
- * @author William Farner
- */
-public class SubsetStrategyTest extends EasyMockTest {
-
-  private static final String BACKEND_1 = "backend1";
-  private static final String BACKEND_2 = "backend2";
-  private static final String BACKEND_3 = "backend3";
-
-  private Closure<Collection<String>> onBackendsChosen;
-  private LoadBalancingStrategy<String> wrappedStrategy;
-
-  private LoadBalancingStrategy<String> subsetStrategy;
-
-  @Before
-  public void setUp() {
-    wrappedStrategy = createMock(new Clazz<LoadBalancingStrategy<String>>() {});
-    onBackendsChosen = createMock(new Clazz<Closure<Collection<String>>>() {});
-
-    subsetStrategy = new SubsetStrategy<String>(2, wrappedStrategy);
-  }
-
-  @Test(expected = ResourceExhaustedException.class)
-  public void testNoBackends() throws ResourceExhaustedException {
-    expect(wrappedStrategy.nextBackend()).andThrow(new ResourceExhaustedException("No backends."));
-
-    control.replay();
-
-    subsetStrategy.nextBackend();
-  }
-
-  @Test
-  public void testForwardsSubsetBackends() {
-    Capture<Set<String>> backendCapture = createCapture();
-    wrappedStrategy.offerBackends(capture(backendCapture), eq(onBackendsChosen));
-    control.replay();
-
-    subsetStrategy.offerBackends(Sets.newHashSet(BACKEND_1, BACKEND_2, BACKEND_3),
-        onBackendsChosen);
-
-    assertThat(backendCapture.getValue().size(), is(2));
-  }
-
-  @Test
-  public void testForwardsOnlySubsetRequests() {
-    Capture<Set<String>> backendCapture = createCapture();
-    wrappedStrategy.offerBackends(capture(backendCapture), eq(onBackendsChosen));
-
-    control.replay();
-
-    Set<String> allBackends = Sets.newHashSet(BACKEND_1, BACKEND_2, BACKEND_3);
-    subsetStrategy.offerBackends(allBackends, onBackendsChosen);
-    Set<String> backends = backendCapture.getValue();
-    assertThat(backends.size(), is(2));
-
-    // One backend should have been unused, makes sure the appropriate calls are ignored for it.
-    String unusedBackend = Iterables.getOnlyElement(Sets.difference(allBackends, backends));
-    subsetStrategy.addRequestResult(unusedBackend, RequestResult.SUCCESS, 0L);
-    subsetStrategy.addConnectResult(unusedBackend, ConnectionResult.FAILED, 0L);
-    subsetStrategy.connectionReturned(unusedBackend);
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/net/monitoring/TrafficMonitorTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/net/monitoring/TrafficMonitorTest.java b/commons/src/test/java/org/apache/aurora/common/net/monitoring/TrafficMonitorTest.java
deleted file mode 100644
index 0593b26..0000000
--- a/commons/src/test/java/org/apache/aurora/common/net/monitoring/TrafficMonitorTest.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net.monitoring;
-
-import org.apache.aurora.common.net.loadbalancing.RequestTracker;
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-import org.apache.aurora.common.util.testing.FakeClock;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
-
-/**
- * @author William Farner
- */
-public class TrafficMonitorTest {
-
-  private final String HOST_A = "hostA";
-  private final String HOST_B = "hostB";
-
-  private FakeClock clock;
-  private TrafficMonitor<String> monitor;
-
-  @Before
-  public void setUp() {
-    clock = new FakeClock();
-    monitor = new TrafficMonitor<String>("test service", clock);
-  }
-
-  @Test
-  public void testBasicFlow() {
-    monitor.connected(HOST_A);
-    addSuccess(HOST_A);
-
-    verifyConnections(HOST_A, 1);
-    verifyRequests(HOST_A, 1);
-
-    monitor.released(HOST_A);
-
-    verifyConnections(HOST_A, 0);
-    verifyRequests(HOST_A, 1);
-    verifyLifetimeRequests(1);
-  }
-
-  @Test
-  public void testOutOfOrder() {
-    addSuccess(HOST_A);
-    monitor.connected(HOST_A);
-
-    verifyConnections(HOST_A, 1);
-    verifyRequests(HOST_A, 1);
-    verifyLifetimeRequests(1);
-  }
-
-  @Test
-  public void testEntriesExpire() {
-    monitor.connected(HOST_A);
-    addSuccess(HOST_A);
-    monitor.released(HOST_A);
-
-    verifyConnections(HOST_A, 0);
-    verifyRequests(HOST_A, 1);
-
-    monitor.connected(HOST_B);
-    addSuccess(HOST_B);
-
-    verifyConnections(HOST_B, 1);
-    verifyRequests(HOST_B, 1);
-
-    // Fake
-    clock.advance(Amount.of(TrafficMonitor.DEFAULT_GC_INTERVAL.as(Time.SECONDS) + 1, Time.SECONDS));
-    monitor.gc();
-
-    verifyConnections(HOST_A, 0);
-    verifyRequests(HOST_A, 0);
-    verifyConnections(HOST_B, 1);
-    verifyRequests(HOST_B, 1);
-    verifyLifetimeRequests(2);
-  }
-
-  private void addSuccess(String host) {
-    monitor.requestResult(host, RequestTracker.RequestResult.SUCCESS, 0L);
-  }
-
-  private void verifyConnections(String host, int count) {
-    TrafficMonitor<String>.TrafficInfo info = monitor.getTrafficInfo().get(host);
-
-    if (count > 0) assertNotNull(info);
-
-    if (info != null) {
-      assertThat(monitor.getTrafficInfo().get(host).getConnectionCount(), is(count));
-    }
-  }
-
-  private void verifyRequests(String host, int count) {
-    TrafficMonitor<String>.TrafficInfo info = monitor.getTrafficInfo().get(host);
-
-    if (count > 0) assertNotNull(info);
-
-    if (info != null) {
-      assertThat(monitor.getTrafficInfo().get(host).getRequestSuccessCount(), is(count));
-    }
-  }
-
-  private void verifyLifetimeRequests(long count) {
-    assertThat(monitor.getLifetimeRequestCount(), is(count));
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/net/pool/ConnectionPoolTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/net/pool/ConnectionPoolTest.java b/commons/src/test/java/org/apache/aurora/common/net/pool/ConnectionPoolTest.java
deleted file mode 100644
index c9f2c48..0000000
--- a/commons/src/test/java/org/apache/aurora/common/net/pool/ConnectionPoolTest.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net.pool;
-
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-import org.apache.aurora.common.stats.Stats;
-import org.easymock.Capture;
-import org.easymock.EasyMock;
-import org.easymock.IMocksControl;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.util.concurrent.Executor;
-import java.util.concurrent.Executors;
-import java.util.concurrent.SynchronousQueue;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-import java.util.concurrent.locks.ReentrantLock;
-
-import static org.easymock.EasyMock.*;
-import static org.junit.Assert.*;
-
-/**
- * @author John Sirois
- */
-public class ConnectionPoolTest {
-  private IMocksControl control;
-  private ConnectionFactory<Connection<String, Integer>> connectionFactory;
-  private ReentrantLock poolLock;
-
-  @Before public void setUp() throws Exception {
-    control = EasyMock.createControl();
-
-    @SuppressWarnings("unchecked") ConnectionFactory<Connection<String, Integer>> connectionFactory =
-        control.createMock(ConnectionFactory.class);
-    this.connectionFactory = connectionFactory;
-
-    poolLock = new ReentrantLock();
-  }
-
-  @Test(expected = IllegalArgumentException.class)
-  public void testReleaseUnmanaged() {
-    @SuppressWarnings("unchecked")
-    Connection<String, Integer> connection = control.createMock(Connection.class);
-
-    Executor executor = createMockExecutor();
-    control.replay();
-
-    try {
-      createConnectionPool(executor).release(connection);
-    } finally {
-      control.verify();
-    }
-  }
-
-  @Test(expected = IllegalArgumentException.class)
-  public void testReleaseUnmanagedIdentity() throws Exception {
-    class TestConnection implements Connection<String, Integer> {
-      @Override public String get() {
-        return "test";
-      }
-
-      @Override public boolean isValid() {
-        return true;
-      }
-
-      @Override public void close() {
-        // noop
-      }
-
-      @Override public Integer getEndpoint() {
-        return 1;
-      }
-
-      @Override public boolean equals(Object obj) {
-        return obj instanceof TestConnection;
-      }
-    }
-
-    Executor executor = createMockExecutor();
-
-    TestConnection connection = new TestConnection();
-    expect(connectionFactory.create(eq(ObjectPool.NO_TIMEOUT))).andReturn(connection);
-
-    control.replay();
-
-    ConnectionPool<Connection<String, Integer>> connectionPool = createConnectionPool(executor);
-    assertSame(connection, connectionPool.get());
-
-    TestConnection equalConnection = new TestConnection();
-    assertEquals(equalConnection, connection);
-    try {
-      connectionPool.release(equalConnection);
-    } finally {
-      control.verify();
-    }
-  }
-
-  @Test(expected = ResourceExhaustedException.class)
-  public void testExhaustedNull() throws Exception {
-    Executor executor = createMockExecutor();
-    expect(connectionFactory.create(eq(ObjectPool.NO_TIMEOUT))).andReturn(null);
-    control.replay();
-
-    try {
-      createConnectionPool(executor).get();
-    } finally {
-      control.verify();
-    }
-  }
-
-  @Test(expected = TimeoutException.class)
-  public void testExhaustedWillNot() throws Exception {
-    Executor executor = createMockExecutor();
-
-    @SuppressWarnings("unchecked")
-    Connection<String, Integer> connection = control.createMock(Connection.class);
-    expect(connectionFactory.create(eq(ObjectPool.NO_TIMEOUT))).andReturn(connection);
-
-    expect(connectionFactory.mightCreate()).andReturn(false);
-    control.replay();
-
-    ConnectionPool<Connection<String, Integer>> connectionPool = createConnectionPool(executor);
-    assertSame(connection, connectionPool.get());
-
-    try {
-      connectionPool.get(Amount.of(1L, Time.NANOSECONDS));
-    } finally {
-      control.verify();
-    }
-  }
-
-  @Test
-  public void testCloseDisallowsGets() throws Exception {
-    Executor executor = createMockExecutor();
-    control.replay();
-
-    ConnectionPool<Connection<String, Integer>> connectionPool = createConnectionPool(executor);
-    connectionPool.close();
-
-    try {
-      connectionPool.get();
-      fail();
-    } catch (IllegalStateException e) {
-      // expected
-    }
-
-    try {
-      connectionPool.get(Amount.of(1L, Time.MILLISECONDS));
-      fail();
-    } catch (IllegalStateException e) {
-      // expected
-    }
-
-    control.verify();
-  }
-
-  @Test
-  public void testCloseCloses() throws Exception {
-    Executor executor = Executors.newSingleThreadExecutor();
-
-    @SuppressWarnings("unchecked")
-    Connection<String, Integer> connection = control.createMock(Connection.class);
-    expect(connectionFactory.create(eq(ObjectPool.NO_TIMEOUT))).andReturn(connection);
-
-    @SuppressWarnings("unchecked")
-    Connection<String, Integer> connection2 = control.createMock(Connection.class);
-    expect(connectionFactory.create(eq(ObjectPool.NO_TIMEOUT))).andReturn(connection2);
-    expect(connectionFactory.mightCreate()).andReturn(true);
-
-    connectionFactory.destroy(connection2);
-    expect(connection2.isValid()).andReturn(true);
-
-    control.replay();
-
-    ConnectionPool<Connection<String, Integer>> connectionPool = createConnectionPool(executor);
-
-    // This 1st connection is leased out of the pool at close-time and so should not be touched
-    Connection<String, Integer> leasedDuringClose = connectionPool.get();
-
-     // this 2nd connection is available when close is called so it should be destroyed
-    connectionPool.release(connectionPool.get());
-    connectionPool.close();
-
-    control.verify();
-    control.reset();
-
-    connectionFactory.destroy(connection);
-
-    control.replay();
-
-    // After a close, releases should destroy connections
-    connectionPool.release(leasedDuringClose);
-
-    control.verify();
-  }
-
-  @Test
-  public void testCreating() throws Exception {
-    Amount<Long, Time> timeout = Amount.of(1L, Time.SECONDS);
-
-    Executor executor =
-        new ThreadPoolExecutor(1, 1, 0, TimeUnit.MILLISECONDS, new SynchronousQueue<Runnable>());
-
-    expect(connectionFactory.mightCreate()).andReturn(true);
-
-    Capture<Amount<Long, Time>> timeout1 = new Capture<Amount<Long, Time>>();
-    @SuppressWarnings("unchecked")
-    Connection<String, Integer> connection1 = control.createMock(Connection.class);
-    expect(connectionFactory.create(capture(timeout1))).andReturn(connection1);
-
-    Capture<Amount<Long, Time>> timeout2 = new Capture<Amount<Long, Time>>();
-    @SuppressWarnings("unchecked")
-    Connection<String, Integer> connection2 = control.createMock(Connection.class);
-    expect(connectionFactory.create(capture(timeout2))).andReturn(connection2);
-
-    control.replay();
-
-    ConnectionPool<Connection<String, Integer>> connectionPool = createConnectionPool(executor);
-
-    assertSame(connection1, connectionPool.get(timeout));
-    assertTrue(timeout1.hasCaptured());
-    Long timeout1Millis = timeout1.getValue().as(Time.MILLISECONDS);
-    assertTrue(timeout1Millis > 0 && timeout1Millis <= timeout.as(Time.MILLISECONDS));
-
-    assertSame(connection2, connectionPool.get(timeout));
-    assertTrue(timeout2.hasCaptured());
-    Long timeout2Millis = timeout1.getValue().as(Time.MILLISECONDS);
-    assertTrue(timeout2Millis > 0 && timeout2Millis <= timeout.as(Time.MILLISECONDS));
-
-    control.verify();
-  }
-
-  private Executor createMockExecutor() {
-    return control.createMock(Executor.class);
-  }
-
-  private ConnectionPool<Connection<String, Integer>> createConnectionPool(Executor executor) {
-    return new ConnectionPool<Connection<String, Integer>>(executor, poolLock,
-        connectionFactory, Stats.STATS_PROVIDER);
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/net/pool/DynamicHostSetUtilTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/net/pool/DynamicHostSetUtilTest.java b/commons/src/test/java/org/apache/aurora/common/net/pool/DynamicHostSetUtilTest.java
deleted file mode 100644
index b544499..0000000
--- a/commons/src/test/java/org/apache/aurora/common/net/pool/DynamicHostSetUtilTest.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net.pool;
-
-import com.google.common.collect.ImmutableSet;
-
-import org.easymock.Capture;
-import org.easymock.IAnswer;
-import org.junit.Test;
-
-import org.apache.aurora.common.base.Command;
-
-import org.apache.aurora.common.testing.easymock.EasyMockTest;
-
-import static org.easymock.EasyMock.capture;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.expectLastCall;
-import static org.junit.Assert.assertEquals;
-
-public class DynamicHostSetUtilTest extends EasyMockTest {
-
-  @Test
-  public void testSnapshot() throws DynamicHostSet.MonitorException {
-    DynamicHostSet<String> hostSet = createMock(new Clazz<DynamicHostSet<String>>() { });
-    final Capture<DynamicHostSet.HostChangeMonitor<String>> monitorCapture = createCapture();
-    final Command unwatchCommand = createMock(Command.class);
-
-    expect(hostSet.watch(capture(monitorCapture))).andAnswer(new IAnswer<Command>() {
-      @Override public Command answer() throws Throwable {
-        // Simulate the 1st blocking onChange callback.
-        DynamicHostSet.HostChangeMonitor<String> monitor = monitorCapture.getValue();
-        monitor.onChange(ImmutableSet.of("jack", "jill"));
-        return unwatchCommand;
-      }
-    });
-
-    // Confirm we clean up our watch.
-    unwatchCommand.execute();
-    expectLastCall();
-
-    control.replay();
-
-    ImmutableSet<String> snapshot = DynamicHostSetUtil.getSnapshot(hostSet);
-    assertEquals(ImmutableSet.of("jack", "jill"), snapshot);
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/net/pool/DynamicPoolTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/net/pool/DynamicPoolTest.java b/commons/src/test/java/org/apache/aurora/common/net/pool/DynamicPoolTest.java
deleted file mode 100644
index 98324b3..0000000
--- a/commons/src/test/java/org/apache/aurora/common/net/pool/DynamicPoolTest.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net.pool;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Iterables;
-import org.apache.aurora.common.base.Closure;
-import org.apache.aurora.common.base.Closures;
-import org.apache.aurora.common.base.Function;
-import org.apache.aurora.common.collections.Pair;
-import org.apache.aurora.common.thrift.testing.MockTSocket;
-import org.apache.aurora.common.net.loadbalancing.LoadBalancerImpl;
-import org.apache.aurora.common.net.loadbalancing.RandomStrategy;
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-import org.apache.aurora.common.thrift.TTransportConnection;
-import org.apache.aurora.common.thrift.Util;
-import org.apache.aurora.common.zookeeper.Group.JoinException;
-import org.apache.aurora.common.zookeeper.ServerSet;
-import org.apache.aurora.common.zookeeper.ServerSet.EndpointStatus;
-import org.apache.aurora.common.zookeeper.ServerSetImpl;
-import org.apache.aurora.common.zookeeper.testing.BaseZooKeeperTest;
-import org.apache.aurora.common.thrift.ServiceInstance;
-
-import org.apache.thrift.transport.TTransport;
-import org.apache.zookeeper.ZooDefs;
-import org.easymock.EasyMock;
-import org.easymock.IMocksControl;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.net.InetSocketAddress;
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.TimeoutException;
-
-import static org.easymock.EasyMock.createControl;
-import static org.easymock.EasyMock.expect;
-import static org.junit.Assert.*;
-
-/**
- * @author John Sirois
- */
-public class DynamicPoolTest extends BaseZooKeeperTest {
-
-  private IMocksControl control;
-  private Function<InetSocketAddress, ObjectPool<Connection<TTransport, InetSocketAddress>>>
-      poolFactory;
-  private DynamicPool connectionPool;
-  private LinkedBlockingQueue<Pair<Set<ObjectPool<Connection<TTransport, InetSocketAddress>>>,
-      Map<InetSocketAddress, ObjectPool<Connection<TTransport, InetSocketAddress>>>>> poolRebuilds;
-
-  private ServerSet serverSet;
-
-  @Before
-  public void mySetUp() throws Exception {
-    control = createControl();
-
-    @SuppressWarnings("unchecked")
-    Function<InetSocketAddress, ObjectPool<Connection<TTransport, InetSocketAddress>>> poolFactory =
-        control.createMock(Function.class);
-    this.poolFactory = poolFactory;
-
-    LoadBalancerImpl<InetSocketAddress> lb =
-        LoadBalancerImpl.create(new RandomStrategy<InetSocketAddress>());
-
-    poolRebuilds =
-        new LinkedBlockingQueue<Pair<Set<ObjectPool<Connection<TTransport, InetSocketAddress>>>,
-            Map<InetSocketAddress, ObjectPool<Connection<TTransport, InetSocketAddress>>>>>();
-    serverSet = new ServerSetImpl(createZkClient(), ZooDefs.Ids.OPEN_ACL_UNSAFE, "/test-service");
-    Closure<Collection<InetSocketAddress>> onBackendsChosen = Closures.noop();
-    Amount<Long, Time> restoreInterval = Amount.of(1L, Time.MINUTES);
-    connectionPool = new DynamicPool<ServiceInstance, TTransport, InetSocketAddress>(
-        serverSet, poolFactory, lb, onBackendsChosen, restoreInterval, Util.GET_ADDRESS,
-        Util.IS_ALIVE) {
-      @Override
-      void poolRebuilt(Set<ObjectPool<Connection<TTransport, InetSocketAddress>>> deadPools,
-          Map<InetSocketAddress, ObjectPool<Connection<TTransport, InetSocketAddress>>> livePools) {
-        super.poolRebuilt(deadPools, livePools);
-        poolRebuilds.offer(Pair.of(deadPools, livePools));
-      }
-    };
-  }
-
-  @Test
-  public void testConstructionBlocksOnInitialPoolBuild() {
-    assertNotNull(Iterables.getOnlyElement(poolRebuilds));
-  }
-
-  @Test(expected = ResourceExhaustedException.class)
-  public void testNoEndpointsAvailable() throws Exception {
-    connectionPool.get();
-  }
-
-  private EndpointStatus join(String host) throws JoinException, InterruptedException {
-    return serverSet.join(
-        InetSocketAddress.createUnresolved(host, 42), ImmutableMap.<String, InetSocketAddress>of());
-  }
-
-  @Test
-  @SuppressWarnings("unchecked")
-  public void testPoolRebuilds() throws Exception {
-    ConnectionFactory<Connection<TTransport, InetSocketAddress>> connectionFactory =
-        control.createMock(ConnectionFactory.class);
-
-    TTransport transport = new MockTSocket();
-    Connection<TTransport, InetSocketAddress> connection =
-        new TTransportConnection(transport, InetSocketAddress.createUnresolved("jake", 1137));
-
-    expect(connectionFactory.create(EasyMock.isA(Amount.class))).andReturn(connection);
-    ConnectionPool<Connection<TTransport, InetSocketAddress>> fooPool =
-        new ConnectionPool<Connection<TTransport, InetSocketAddress>>(connectionFactory);
-    expect(poolFactory.apply(InetSocketAddress.createUnresolved("foo", 42))).andReturn(fooPool);
-
-    control.replay();
-
-    Pair<Set<ObjectPool<Connection<TTransport, InetSocketAddress>>>,
-        Map<InetSocketAddress, ObjectPool<Connection<TTransport, InetSocketAddress>>>>
-        rebuild1 = poolRebuilds.take();
-    assertTrue("Should not have any dead pools on initial rebuild", rebuild1.getFirst().isEmpty());
-    assertNoLivePools(rebuild1);
-
-    EndpointStatus fooStatus = join("foo");
-
-    Pair<Set<ObjectPool<Connection<TTransport, InetSocketAddress>>>,
-        Map<InetSocketAddress, ObjectPool<Connection<TTransport, InetSocketAddress>>>>
-        rebuild2 = poolRebuilds.take();
-    assertTrue("The NULL pool should never be tracked as dead", rebuild2.getFirst().isEmpty());
-    assertEquals(transport, connectionPool.get().get());
-
-    fooStatus.leave();
-
-    Pair<Set<ObjectPool<Connection<TTransport, InetSocketAddress>>>,
-        Map<InetSocketAddress, ObjectPool<Connection<TTransport, InetSocketAddress>>>>
-        rebuild3 = poolRebuilds.take();
-    assertSame("Expected foo pool to be discarded", fooPool,
-        Iterables.getOnlyElement(rebuild3.getFirst()));
-    assertNoLivePools(rebuild1);
-
-    control.verify();
-  }
-
-  private void assertNoLivePools(Pair<Set<ObjectPool<Connection<TTransport, InetSocketAddress>>>,
-      Map<InetSocketAddress, ObjectPool<Connection<TTransport, InetSocketAddress>>>> rebuild)
-      throws TimeoutException {
-
-    assertTrue("Expected no live pools to be set", rebuild.getSecond().isEmpty());
-    try {
-      connectionPool.get();
-      fail("Expected server set to be exhausted with no endpoints");
-    } catch (ResourceExhaustedException e) {
-      // expected
-    }
-  }
-}


[05/21] aurora git commit: Remove unused classes from commons fork.

Posted by wf...@apache.org.
http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/application/modules/LifecycleModuleTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/application/modules/LifecycleModuleTest.java b/commons/src/test/java/org/apache/aurora/common/application/modules/LifecycleModuleTest.java
index d43a6db..fdbef6f 100644
--- a/commons/src/test/java/org/apache/aurora/common/application/modules/LifecycleModuleTest.java
+++ b/commons/src/test/java/org/apache/aurora/common/application/modules/LifecycleModuleTest.java
@@ -24,21 +24,18 @@ import com.google.inject.Injector;
 import com.google.inject.Module;
 
 import org.apache.aurora.common.application.ShutdownRegistry;
-import org.junit.Test;
-
 import org.apache.aurora.common.application.modules.LifecycleModule.LaunchException;
 import org.apache.aurora.common.application.modules.LifecycleModule.ServiceRunner;
 import org.apache.aurora.common.application.modules.LocalServiceRegistry.LocalService;
 import org.apache.aurora.common.base.Command;
 import org.apache.aurora.common.testing.easymock.EasyMockTest;
+import org.junit.Test;
 
+import static org.apache.aurora.common.net.InetSocketAddressHelper.getLocalAddress;
 import static org.easymock.EasyMock.expect;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 
-import static org.apache.aurora.common.application.modules.LifecycleModule.bindLocalService;
-import static org.apache.aurora.common.net.InetSocketAddressHelper.getLocalAddress;
-
 /**
  * @author William Farner
  */
@@ -67,32 +64,6 @@ public class LifecycleModuleTest extends EasyMockTest {
   }
 
   @Test
-  public void testNoRunner() throws Exception {
-    final Command primaryShutdown = createMock(Command.class);
-    final Command auxShutdown = createMock(Command.class);
-
-    primaryShutdown.execute();
-    auxShutdown.execute();
-
-    Module testModule = new AbstractModule() {
-      @Override protected void configure() {
-        bindLocalService(binder(), LocalService.primaryService(99, primaryShutdown));
-        bindLocalService(binder(), LocalService.auxiliaryService("foo", 100, auxShutdown));
-      }
-    };
-
-    Injector injector = Guice.createInjector(new SystemModule(), testModule);
-    LocalServiceRegistry registry = injector.getInstance(LocalServiceRegistry.class);
-
-    control.replay();
-
-    assertEquals(Optional.of(getLocalAddress(99)), registry.getPrimarySocket());
-    assertEquals(ImmutableMap.of("foo", getLocalAddress(100)), registry.getAuxiliarySockets());
-
-    injector.getInstance(ShutdownRegistry.ShutdownRegistryImpl.class).execute();
-  }
-
-  @Test
   public void testOrdering() throws Exception {
     final ServiceRunner runner = createMock(ServiceRunner.class);
     Command shutdown = createMock(Command.class);

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/base/CachingSupplierTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/base/CachingSupplierTest.java b/commons/src/test/java/org/apache/aurora/common/base/CachingSupplierTest.java
deleted file mode 100644
index 26eb84d..0000000
--- a/commons/src/test/java/org/apache/aurora/common/base/CachingSupplierTest.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.base;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-import org.apache.aurora.common.testing.easymock.EasyMockTest;
-import org.apache.aurora.common.util.testing.FakeClock;
-
-import static org.easymock.EasyMock.expect;
-import static org.junit.Assert.assertEquals;
-
-/**
- * @author William Farner
- */
-public class CachingSupplierTest extends EasyMockTest {
-
-  private static final Amount<Long, Time> ONE_SECOND = Amount.of(1L, Time.SECONDS);
-
-  private Supplier<String> supplier;
-  private FakeClock clock;
-  private Supplier<String> cache;
-
-  @Before
-  public void setUp() {
-    supplier = createMock(new Clazz<Supplier<String>>() { });
-    clock = new FakeClock();
-    cache = new CachingSupplier<String>(supplier, ONE_SECOND, clock);
-  }
-
-  @Test
-  public void testCaches() {
-    expect(supplier.get()).andReturn("foo");
-    expect(supplier.get()).andReturn("bar");
-
-    control.replay();
-
-    assertEquals("foo", cache.get());
-    assertEquals("foo", cache.get());
-
-    clock.advance(Amount.of(999L, Time.MILLISECONDS));
-    assertEquals("foo", cache.get());
-
-    clock.advance(Amount.of(1L, Time.MILLISECONDS));
-    assertEquals("foo", cache.get());
-
-    clock.advance(Amount.of(1L, Time.MILLISECONDS));
-    assertEquals("bar", cache.get());
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/base/EitherTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/base/EitherTest.java b/commons/src/test/java/org/apache/aurora/common/base/EitherTest.java
deleted file mode 100644
index 39cb79e..0000000
--- a/commons/src/test/java/org/apache/aurora/common/base/EitherTest.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.base;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-public class EitherTest {
-
-  @Test
-  public void testLeft() {
-    Exception left = new Exception();
-    assertLeft(left, Either.<Exception, String>left(left));
-  }
-
-  @Test
-  public void testRight() {
-    assertRight("jake", Either.<Exception, String>right("jake"));
-  }
-
-  @Test
-  public void testSwap() {
-    assertLeft("jake", Either.right("jake").swap());
-    assertRight("jake", Either.left("jake").swap());
-
-    Either<String, Object> left = Either.left("jake");
-    assertEquals(left, left.swap().swap());
-
-    Either<Object, String> right = Either.right("jake");
-    assertEquals(right, right.swap().swap());
-  }
-
-  public static final Function<CharSequence, Integer> LENGTH =
-      new Function<CharSequence, Integer>() {
-        @Override public Integer apply(CharSequence item) {
-          return item.length();
-        }
-      };
-
-  public static final Function<Object, Integer> HASHCODE = new Function<Object, Integer>() {
-    @Override public Integer apply(Object item) {
-      return item.hashCode();
-    }
-  };
-
-  @Test
-  public void testMapLeft() {
-    RuntimeException left = new RuntimeException() {
-      @Override public int hashCode() {
-        return 42;
-      }
-    };
-    assertLeft(42, Either.left(left).mapLeft(HASHCODE));
-
-    assertRight("jake", Either.right("jake").mapLeft(HASHCODE));
-  }
-
-  @Test
-  public void testMapRight() {
-    assertRight(4, Either.right("jake").mapRight(LENGTH));
-
-    RuntimeException left = new RuntimeException();
-    assertLeft(left, Either.left(left).mapRight(HASHCODE));
-  }
-
-  @Test
-  public void testMap() {
-    Either.Transformer<Object, CharSequence, Integer> transformer = Either.transformer(HASHCODE, LENGTH);
-
-    Object left = new Object() {
-      @Override public int hashCode() {
-        return 1137;
-      }
-    };
-    Either<Object, CharSequence> either = Either.left(left);
-    assertEquals(1137, either.map(transformer).intValue());
-
-    assertEquals(19, Either.right("The Meaning of Life").map(transformer).intValue());
-  }
-
-  private static final ImmutableList<Either<String, String>> LEFT_RESULTS =
-      ImmutableList.of(
-          Either.<String, String>left("jack"),
-          Either.<String, String>left("jill"));
-
-  private static final ImmutableList<Either<String, String>> RIGHT_RESULTS =
-      ImmutableList.of(
-          Either.<String, String>right("jack"),
-          Either.<String, String>right("jill"));
-
-  private static final ImmutableList<Either<String, String>> MIXED_RESULTS =
-      ImmutableList.of(
-          Either.<String, String>left("jack"),
-          Either.<String, String>right("jane"),
-          Either.<String, String>left("jill"));
-
-  @Test
-  public void testLefts() {
-    assertEquals(ImmutableList.of("jack", "jill"),
-        ImmutableList.copyOf(Either.lefts(LEFT_RESULTS)));
-    assertEquals(ImmutableList.of(), ImmutableList.copyOf(Either.lefts(RIGHT_RESULTS)));
-    assertEquals(ImmutableList.of("jack", "jill"),
-        ImmutableList.copyOf(Either.lefts(MIXED_RESULTS)));
-  }
-
-  @Test
-  public void testRights() {
-    assertEquals(ImmutableList.of(), ImmutableList.copyOf(Either.rights(LEFT_RESULTS)));
-    assertEquals(ImmutableList.of("jack", "jill"),
-        ImmutableList.copyOf(Either.rights(RIGHT_RESULTS)));
-    assertEquals(ImmutableList.of("jane"), ImmutableList.copyOf(Either.rights(MIXED_RESULTS)));
-  }
-
-  @Test
-  public void testTransformer() {
-    assertEquals(ImmutableList.of("jackjack", "4", "jilljill"),
-        ImmutableList.copyOf(Iterables.transform(MIXED_RESULTS,
-            new Either.Transformer<String, String, String>() {
-              @Override public String mapLeft(String left) {
-                return left + left;
-              }
-              @Override public String mapRight(String right) {
-                return String.valueOf(right.length());
-              }
-            })));
-  }
-
-  static <T, X extends Exception> ExceptionalSupplier<T, X> constantSupplier(final T value) {
-    return new ExceptionalSupplier<T, X>() {
-      @Override public T get() {
-        return value;
-      }
-    };
-  }
-
-  static <T, X extends Exception> ExceptionalSupplier<T, X> failedSupplier(final X failure) {
-    return new ExceptionalSupplier<T, X>() {
-      @Override public T get() throws X {
-        throw failure;
-      }
-    };
-  }
-
-  @Test
-  public void testGuard() {
-    assertRight("jake",
-        Either.guard(IOException.class, EitherTest.<String, IOException>constantSupplier("jake")));
-
-    IOException left = new IOException();
-    assertLeft(left, Either.guard(IOException.class, failedSupplier(left)));
-
-    try {
-      Either.guard(IOException.class, new ExceptionalSupplier<Object, IOException>() {
-        @Override public String get() {
-          throw new ArithmeticException();
-        }
-      });
-      fail("Expected an unguarded exception type to fail fast.");
-    } catch (Either.UnguardedException e) {
-      assertTrue(e.getCause() instanceof ArithmeticException);
-    }
-
-    Either<Exception, String> result =
-        Either.guard(ImmutableList.of(IOException.class, InterruptedException.class),
-            new SupplierE<String>() {
-              @Override public String get() throws InterruptedException {
-                throw new InterruptedException();
-              }
-            });
-    assertTrue(result.getLeft() instanceof InterruptedException);
-
-    result = Either.guard(ImmutableList.of(IOException.class, InterruptedException.class),
-        new SupplierE<String>() {
-          @Override public String get() throws IOException {
-            throw new MalformedURLException();
-          }
-        });
-    assertTrue(result.getLeft() instanceof IOException);
-
-    class MyException extends Exception { }
-    try {
-      Either.guard(ImmutableList.of(IOException.class, InterruptedException.class),
-          new SupplierE<String>() {
-            @Override public String get() throws Exception {
-              throw new MyException();
-            }
-          });
-      fail("Expected an unguarded exception type to fail fast.");
-    } catch (Either.UnguardedException e) {
-      assertTrue(e.getCause() instanceof MyException);
-    }
-  }
-
-  private static <L, R> void assertLeft(L left, Either<L, R> either) {
-    assertEquals(Either.left(left), either);
-
-    assertTrue(either.isLeft());
-    assertTrue(either.left().isPresent());
-    assertSame(left, either.getLeft());
-    assertSame(left, either.left().get());
-
-    assertFalse(either.isRight());
-    assertFalse(either.right().isPresent());
-    try {
-      either.getRight();
-      fail("Expected a a left to throw when accessing its right.");
-    } catch (IllegalStateException e) {
-      // expected
-    }
-    try {
-      either.right().get();
-      fail("Expected a a left to throw when accessing its right.");
-    } catch (IllegalStateException e) {
-      // expected
-    }
-  }
-
-  private static <L, R> void assertRight(R right, Either<L, R> either) {
-    assertEquals(Either.right(right), either);
-
-    assertTrue(either.isRight());
-    assertTrue(either.right().isPresent());
-    assertSame(right, either.getRight());
-    assertSame(right, either.right().get());
-
-    assertFalse(either.isLeft());
-    assertFalse(either.left().isPresent());
-    try {
-      either.getLeft();
-      fail("Expected a a right to throw when accessing its left.");
-    } catch (IllegalStateException e) {
-      // expected
-    }
-    try {
-      either.left().get();
-      fail("Expected a a right to throw when accessing its left.");
-    } catch (IllegalStateException e) {
-      // expected
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/base/ExceptionTransporterTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/base/ExceptionTransporterTest.java b/commons/src/test/java/org/apache/aurora/common/base/ExceptionTransporterTest.java
deleted file mode 100644
index b59f658..0000000
--- a/commons/src/test/java/org/apache/aurora/common/base/ExceptionTransporterTest.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.base;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.net.SocketException;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * @author John Sirois
- */
-public class ExceptionTransporterTest {
-
-  @Test(expected = FileNotFoundException.class)
-  public void testCheckedTransport() throws FileNotFoundException {
-    ExceptionTransporter.guard(new Function<ExceptionTransporter<FileNotFoundException>, File>() {
-      @Override public File apply(ExceptionTransporter<FileNotFoundException> transporter) {
-        throw transporter.transport(new FileNotFoundException());
-      }
-    });
-  }
-
-  @Test(expected = IllegalStateException.class)
-  public void testUncheckedTransport() throws SocketException {
-    ExceptionTransporter.guard(new Function<ExceptionTransporter<SocketException>, File>() {
-      @Override public File apply(ExceptionTransporter<SocketException> transporter) {
-        throw new IllegalStateException();
-      }
-    });
-  }
-
-  @Test
-  public void testNoTransport() throws IOException {
-    assertEquals("jake", ExceptionTransporter.guard(
-        new Function<ExceptionTransporter<IOException>, String>() {
-          @Override public String apply(ExceptionTransporter<IOException> exceptionTransporter) {
-            return "jake";
-          }
-        }));
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/base/ExceptionalFunctionsTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/base/ExceptionalFunctionsTest.java b/commons/src/test/java/org/apache/aurora/common/base/ExceptionalFunctionsTest.java
deleted file mode 100644
index 34e0ca6..0000000
--- a/commons/src/test/java/org/apache/aurora/common/base/ExceptionalFunctionsTest.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.base;
-
-import java.io.IOException;
-
-import org.easymock.EasyMock;
-import org.easymock.IMocksControl;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.easymock.EasyMock.expect;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertSame;
-
-/**
- * @author John Sirois
- */
-public class ExceptionalFunctionsTest {
-
-  private static final String STRING = "jake";
-  private ExceptionalFunction<String, Integer, NumberFormatException> stringToInt =
-      new ExceptionalFunction<String, Integer, NumberFormatException>() {
-        @Override
-        public Integer apply(String item) throws NumberFormatException {
-          return Integer.parseInt(item);
-        }
-      };
-  private ExceptionalFunction<Integer, Double, Exception> intToDouble =
-      new ExceptionalFunction<Integer, Double, Exception>() {
-        @Override
-        public Double apply(Integer item) throws NumberFormatException {
-          return item.doubleValue();
-        }
-      };
-  private IMocksControl control;
-  private ExceptionalFunction<String, Integer, IOException> function;
-
-  @Before
-  public void setUp() throws Exception {
-    control = EasyMock.createControl();
-
-    @SuppressWarnings("unchecked")
-    ExceptionalFunction<String, Integer, IOException> f =
-        control.createMock(ExceptionalFunction.class);
-    this.function = f;
-  }
-
-  @Test
-  public void testCurryLazy() throws IOException {
-    control.replay();
-
-    ExceptionalFunctions.curry(function, STRING);
-
-    control.verify();
-  }
-
-  @Test
-  public void testCurryExecution() throws IOException {
-    expect(function.apply(STRING)).andReturn(1);
-    expect(function.apply(STRING)).andReturn(2);
-
-    control.replay();
-
-    CallableExceptionalSupplier<Integer, IOException> supplier =
-        ExceptionalFunctions.curry(function, STRING);
-
-    assertEquals("curried function should be called", Integer.valueOf(1), supplier.get());
-    assertEquals("curried function should not be memoized", Integer.valueOf(2), supplier.get());
-
-    control.verify();
-  }
-
-  @Test
-  public void testCurryException() throws IOException {
-    IOException ioException = new IOException();
-    expect(function.apply(STRING)).andThrow(ioException);
-
-    RuntimeException runtimeException = new IllegalStateException();
-    expect(function.apply(STRING)).andThrow(runtimeException);
-
-    control.replay();
-
-    CallableExceptionalSupplier<Integer, IOException> supplier =
-        ExceptionalFunctions.curry(function, STRING);
-
-    try {
-      supplier.get();
-    } catch (IOException e) {
-      assertSame("Expected exception propagation to be transparent", ioException, e);
-    }
-
-    try {
-      supplier.get();
-    } catch (IllegalStateException e) {
-      assertSame("Expected exception propagation to be transparent", runtimeException, e);
-    }
-
-    control.verify();
-  }
-
-  @Test
-  public void testCompose() throws Exception {
-    ExceptionalFunction<String, Double, Exception> stringToDouble =
-        ExceptionalFunctions.compose(intToDouble, stringToInt);
-    assertEquals(new Double(2d), stringToDouble.apply("2"));
-    assertEquals(new Double(-1d), stringToDouble.apply("-1"));
-  }
-
-  @Test(expected = NumberFormatException.class)
-  public void testComposeWithException() throws Exception {
-    ExceptionalFunction<String, Double, Exception> stringToDouble =
-        ExceptionalFunctions.compose(intToDouble, stringToInt);
-    stringToDouble.apply("1.1");
-  }
-
-  @Test
-  public void testForFunction() {
-    com.google.common.base.Function<String, Integer> stringToIntegerGuavaFunction =
-        new com.google.common.base.Function<String, Integer>() {
-          @Override
-          public Integer apply(String item) {
-            return Integer.parseInt(item);
-          }
-        };
-    ExceptionalFunction<String, Integer, NumberFormatException> stringToIntegerExceptionalFunction =
-        ExceptionalFunctions.forFunction(stringToIntegerGuavaFunction);
-    assertEquals(
-        stringToIntegerGuavaFunction.apply("1234"),
-        stringToIntegerExceptionalFunction.apply("1234"));
-  }
-
-  @Test
-  public void testConstantReturn() {
-    final String value = "taxes?";
-    ExceptionalFunction<String, String, IllegalArgumentException> constant =
-        ExceptionalFunctions.constant(value);
-    assertEquals(value, constant.apply("yes"));
-  }
-
-  @Test(expected = IllegalArgumentException.class)
-  public void testConstantException() {
-    ExceptionalFunction<String, String, IllegalArgumentException> badness =
-        ExceptionalFunctions.forException(new IllegalArgumentException());
-    badness.apply("pleaseno");
-  }
-
-  @Test
-  public void testConstantExceptionReturn() {
-    final Exception value = new Exception("corner case?");
-    ExceptionalFunction<String, Exception, IllegalArgumentException> constant =
-        ExceptionalFunctions.constant(value);
-    assertEquals(value, constant.apply("yes"));
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/collections/BitsTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/collections/BitsTest.java b/commons/src/test/java/org/apache/aurora/common/collections/BitsTest.java
deleted file mode 100644
index b1c3758..0000000
--- a/commons/src/test/java/org/apache/aurora/common/collections/BitsTest.java
+++ /dev/null
@@ -1,299 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.collections;
-
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.junit.Test;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-
-/**
- * @author William Farner
- */
-public class BitsTest {
-
-  private static final List<Long> BASIC_LONGS = Arrays.asList(
-      0x0000000000000000L,
-      0x00000000FFFFFFFFL,
-      0xFFFFFFFF00000000L,
-      0xFFFFFFFFFFFFFFFFL
-  );
-
-  private static final List<Long> SINGLE_BIT_LONGS = Arrays.asList(
-      0x0000000000000001L,
-      0x0000000000000002L,
-      0x0000000000000004L,
-      0x0000000000000008L,
-      0x0000000000000010L,
-      0x0000000000000020L,
-      0x0000000000000040L,
-      0x0000000000000080L,
-      0x0000000000000100L,
-      0x0000000000000200L,
-      0x0000000000000400L,
-      0x0000000000000800L,
-      0x0000000000001000L,
-      0x0000000000002000L,
-      0x0000000000004000L,
-      0x0000000000008000L,
-      0x0000000000010000L,
-      0x0000000000020000L,
-      0x0000000000040000L,
-      0x0000000000080000L,
-      0x0000000000100000L,
-      0x0000000000200000L,
-      0x0000000000400000L,
-      0x0000000000800000L,
-      0x0000000001000000L,
-      0x0000000002000000L,
-      0x0000000004000000L,
-      0x0000000008000000L,
-      0x0000000010000000L,
-      0x0000000020000000L,
-      0x0000000040000000L,
-      0x0000000080000000L,
-      0x0000000100000000L,
-      0x0000000200000000L,
-      0x0000000400000000L,
-      0x0000000800000000L,
-      0x0000001000000000L,
-      0x0000002000000000L,
-      0x0000004000000000L,
-      0x0000008000000000L,
-      0x0000010000000000L,
-      0x0000020000000000L,
-      0x0000040000000000L,
-      0x0000080000000000L,
-      0x0000100000000000L,
-      0x0000200000000000L,
-      0x0000400000000000L,
-      0x0000800000000000L,
-      0x0001000000000000L,
-      0x0002000000000000L,
-      0x0004000000000000L,
-      0x0008000000000000L,
-      0x0010000000000000L,
-      0x0020000000000000L,
-      0x0040000000000000L,
-      0x0080000000000000L,
-      0x0100000000000000L,
-      0x0200000000000000L,
-      0x0400000000000000L,
-      0x0800000000000000L,
-      0x1000000000000000L,
-      0x2000000000000000L,
-      0x4000000000000000L,
-      0x8000000000000000L
-  );
-
-  private static final List<Long> RANDOM_LONGS = Arrays.asList(
-      0x88BA910280684BFAL,
-      0xAD4376223ACCDA29L,
-      0xE5992FBC3D222B2BL,
-      0x93385280AC0EE09CL,
-      0x7BFCB384F2B88BD1L,
-      0xABD0E19C726DC54EL,
-      0xA0C0A9D1C38073E1L,
-      0x957A232B46A01071L,
-      0x04CCBDFE1F714EB4L,
-      0xACDC6DACDF25C070L,
-      0xCE9AC78F31BA17FAL,
-      0xEAE5F04361A46FFFL,
-      0x1B18F8BE5089C1EDL,
-      0xD8E0EED9F397496DL,
-      0xD6A1F134843B4AC9L,
-      0x186F1C907FBA5B3CL,
-      0x8A1CB91A7929357AL,
-      0xB6F5B84FFBFE21F3L,
-      0xD8F2E84C73735997L,
-      0xFE9C4FBDAB495B31L,
-      0x92AB7DEB113D3E8FL,
-      0x5CBA4C59FC1C7605L,
-      0xBADD2C1E2D9A7621L,
-      0x54ADAEDF528B347DL,
-      0x1C131C0F1FC1AA11L,
-      0x00D79CEBA636527CL,
-      0x7A6B6E39E6765118L,
-      0xF021A4E5DD3845D0L,
-      0x6966FAE6CA243F1BL,
-      0xF738DC1B00956B83L,
-      0x09D616F4502784A0L,
-      0xEFDA3B2B2EF13671L
-  );
-
-  private static final List<Integer> BASIC_INTS = Arrays.asList(
-      0x00000000,
-      0xFFFFFFFF
-  );
-
-  private static final List<Integer> SINGLE_BIT_INTS = Arrays.asList(
-      0x00000001,
-      0x00000002,
-      0x00000004,
-      0x00000008,
-      0x00000010,
-      0x00000020,
-      0x00000040,
-      0x00000080,
-      0x00000100,
-      0x00000200,
-      0x00000400,
-      0x00000800,
-      0x00001000,
-      0x00002000,
-      0x00004000,
-      0x00008000,
-      0x00010000,
-      0x00020000,
-      0x00040000,
-      0x00080000,
-      0x00100000,
-      0x00200000,
-      0x00400000,
-      0x00800000,
-      0x01000000,
-      0x02000000,
-      0x04000000,
-      0x08000000,
-      0x10000000,
-      0x20000000,
-      0x40000000,
-      0x80000000
-  );
-
-  private static final List<Integer> RANDOM_INTS = Arrays.asList(
-      0x124FE3D6,
-      0xA688379A,
-      0xB49EC20C,
-      0x0C2C8D99,
-      0x32D1E1BB,
-      0xCF7169FF,
-      0x94D7D596,
-      0xE3A962CD,
-      0xA47FA154,
-      0x20DB4BA5,
-      0x27FA77BC,
-      0x2DCEDF0D,
-      0xC05ACE5A,
-      0x4C871D86,
-      0x29B4D423,
-      0xFCB5EC65,
-      0x1CAD4057,
-      0x2EC8E1C8,
-      0x251D315A,
-      0x6D6C6021,
-      0x3F58FF67,
-      0xFB917B2E,
-      0x51338D3E,
-      0xE1D6695B,
-      0x149D5142,
-      0x51B6CFD1,
-      0xABB61BA0,
-      0x4E1FD4D4,
-      0x0AB11279,
-      0xEA8EE310,
-      0x9C6C8B24,
-      0x99DD3A07
-  );
-
-  @SuppressWarnings("unchecked") //Needed because type information lost in vargs.
-  private static final List<List<Long>> LONGS_TEST_LISTS = Arrays.asList(
-      BASIC_LONGS,
-      SINGLE_BIT_LONGS,
-      RANDOM_LONGS
-  );
-
-  @SuppressWarnings("unchecked") //Needed because type information lost in vargs.
-  private static final List<List<Integer>> INTS_TEST_LISTS = Arrays.asList(
-      BASIC_INTS,
-      SINGLE_BIT_INTS,
-      RANDOM_INTS
-  );
-
-  @Test
-  public void testSetAndGetSingleLongBits() {
-    for (List<Long> testList : LONGS_TEST_LISTS) {
-      for (long testValue : testList) {
-        for (int i = 0; i < 64; ++i) {
-          long setOneBit = Bits.setBit(testValue, i);
-          assertTrue(Bits.isBitSet(setOneBit, i));
-          assertEquals(Bits.clearBit(testValue, i), Bits.clearBit(setOneBit, i));
-          assertTrue(!Bits.isBitSet(Bits.clearBit(setOneBit, i), i));
-        }
-      }
-    }
-  }
-
-  @Test
-  public void testAllLongBits() {
-    for (List<Long> testList : LONGS_TEST_LISTS) {
-      for (long testValue : testList) {
-        long inverseValue1 = 0;
-        long inverseValue2 = 0xFFFFFFFFFFFFFFFFL;
-        for (int i = 0; i < 64; ++i) {
-          if (!Bits.isBitSet(testValue, i)) {
-            inverseValue1 = Bits.setBit(inverseValue1, i);
-          } else {
-            inverseValue2 = Bits.clearBit(inverseValue2, i);
-          }
-        }
-        assertThat(0xFFFFFFFFFFFFFFFFL, is(inverseValue1 | testValue));
-        assertThat(0xFFFFFFFFFFFFFFFFL, is(inverseValue2 | testValue));
-        assertThat(0xFFFFFFFFFFFFFFFFL, is(inverseValue1 ^ testValue));
-        assertThat(0xFFFFFFFFFFFFFFFFL, is(inverseValue2 ^ testValue));
-      }
-    }
-  }
-
-  @Test
-  public void testSetAndGetSingleIntBits() {
-    for (List<Integer> testList : INTS_TEST_LISTS) {
-      for (int testValue : testList) {
-        for (int i = 0; i < 32; ++i) {
-          int setOneBit = Bits.setBit(testValue, i);
-          assertTrue(Bits.isBitSet(setOneBit, i));
-          assertEquals(Bits.clearBit(testValue, i), Bits.clearBit(setOneBit, i));
-          assertTrue(!Bits.isBitSet(Bits.clearBit(setOneBit, i), i));
-        }
-      }
-    }
-  }
-
-  @Test
-  public void testAllIntBits() {
-    for (List<Integer> testList : INTS_TEST_LISTS) {
-      for (int testValue : testList) {
-        int inverseValue1 = 0;
-        int inverseValue2 = 0xFFFFFFFF;
-        for (int i = 0; i < 32; ++i) {
-          if (!Bits.isBitSet(testValue, i)) {
-            inverseValue1 = Bits.setBit(inverseValue1, i);
-          } else {
-            inverseValue2 = Bits.clearBit(inverseValue2, i);
-          }
-        }
-        assertThat(0xFFFFFFFF, is(inverseValue1 | testValue));
-        assertThat(0xFFFFFFFF, is(inverseValue2 | testValue));
-        assertThat(0xFFFFFFFF, is(inverseValue1 ^ testValue));
-        assertThat(0xFFFFFFFF, is(inverseValue2 ^ testValue));
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/inject/DefaultProviderTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/inject/DefaultProviderTest.java b/commons/src/test/java/org/apache/aurora/common/inject/DefaultProviderTest.java
deleted file mode 100644
index 7fd74c9..0000000
--- a/commons/src/test/java/org/apache/aurora/common/inject/DefaultProviderTest.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.inject;
-
-import com.google.inject.AbstractModule;
-import com.google.inject.Guice;
-import com.google.inject.Key;
-import com.google.inject.Provides;
-import com.google.inject.name.Named;
-import com.google.inject.name.Names;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * @author John Sirois
- */
-public class DefaultProviderTest {
-  public static final Key<String> CUSTOM_STRING = Key.get(String.class, Names.named("custom"));
-  public static final Key<String> DEFAULT_STRING = Key.get(String.class, Names.named("default"));
-  public static final Key<String> FINAL_STRING = Key.get(String.class, Names.named("final"));
-
-  @Test
-  public void testDefault() {
-    assertEquals("jack", Guice.createInjector(new AbstractModule() {
-      @Override protected void configure() {
-        DefaultProvider.bindOrElse(CUSTOM_STRING, DEFAULT_STRING, FINAL_STRING, binder());
-      }
-
-      @Provides @Named("default") String provideDefault() {
-        return "jack";
-      }
-    }).getInstance(FINAL_STRING));
-  }
-
-  @Test
-  public void testCustom() {
-    assertEquals("jill", Guice.createInjector(new AbstractModule() {
-      @Override protected void configure() {
-        DefaultProvider.bindOrElse(CUSTOM_STRING, DEFAULT_STRING, FINAL_STRING, binder());
-
-      }
-
-      @Provides @Named("default") String provideDefault() {
-        return "jack";
-      }
-
-      @Provides @Named("custom") String provideCustom() {
-        return "jill";
-      }
-    }).getInstance(FINAL_STRING));
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/io/Base64ZlibCodecTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/io/Base64ZlibCodecTest.java b/commons/src/test/java/org/apache/aurora/common/io/Base64ZlibCodecTest.java
deleted file mode 100644
index 0530ca2..0000000
--- a/commons/src/test/java/org/apache/aurora/common/io/Base64ZlibCodecTest.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.io;
-
-import java.io.ByteArrayOutputStream;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
-import java.util.Random;
-import java.util.zip.GZIPOutputStream;
-
-import org.apache.commons.codec.binary.Base64OutputStream;
-import org.junit.Assert;
-
-import junit.framework.TestCase;
-
-public class Base64ZlibCodecTest extends TestCase {
-
-  public void testEncodeDecode() throws Exception {
-    testEncodeDecode(0);
-    for (int i = 1; i < 10000; i *= 10) {
-      testEncodeDecode(i * 1024);
-    }
-  }
-
-  public void testDecodeGzip() throws Exception {
-    final byte[] input = createRandomBytes(10240);
-    ByteArrayOutputStream out = new ByteArrayOutputStream();
-    final OutputStream os = new GZIPOutputStream(new Base64OutputStream(out));
-    os.write(input);
-    os.close();
-    final String encoded = new String(out.toByteArray(), "8859_1");
-    assertTrue(encoded.startsWith("H4sIAAAAAAAAA"));
-    Assert.assertArrayEquals(input, Base64ZlibCodec.decode(encoded));
-  }
-
-  public void testInvalidData() throws Exception {
-    final String plain = createRandomText(10240);
-    try {
-      Base64ZlibCodec.decode("this is invalid");
-      fail();
-    } catch (Base64ZlibCodec.InvalidDataException e) {
-      // This is expected
-    }
-  }
-
-  public void testCorruptedData() throws Exception {
-    final char[] encoded = Base64ZlibCodec.encode(createRandomBytes(1024)).toCharArray();
-    for (int i = 100; i < encoded.length; ++i) {
-      if (encoded[i] != 'Z') {
-        ++encoded[i];
-        break;
-      }
-    }
-    try {
-      Base64ZlibCodec.decode(new String(encoded));
-      fail();
-    } catch (Base64ZlibCodec.InvalidDataException e) {
-      // This is expected
-    }
-  }
-
-  private static void testEncodeDecode(int len) throws Exception {
-    final byte[] input = createRandomBytes(len);
-    final String encoded = Base64ZlibCodec.encode(input);
-    assertTrue(encoded.startsWith("eJ"));
-    Assert.assertArrayEquals(input, Base64ZlibCodec.decode(encoded));
-  }
-
-  private static String createRandomText(int len) throws UnsupportedEncodingException {
-    final byte[] msg = new byte[len];
-    new Random().nextBytes(msg);
-    return new String(msg, "8859_1");
-  }
-
-  private static byte[] createRandomBytes(int len) throws UnsupportedEncodingException {
-    final byte[] msg = new byte[len];
-    new Random().nextBytes(msg);
-    return msg;
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/io/JsonCodecTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/io/JsonCodecTest.java b/commons/src/test/java/org/apache/aurora/common/io/JsonCodecTest.java
deleted file mode 100644
index 949e78b..0000000
--- a/commons/src/test/java/org/apache/aurora/common/io/JsonCodecTest.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.io;
-
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.BitSet;
-
-import com.google.gson.GsonBuilder;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonParser;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-public class JsonCodecTest {
-  @Test
-  public void testRoundTrip() throws IOException {
-    TestClass testOut = createTestClassInstance();
-    Codec<TestClass> codec = JsonCodec.create(TestClass.class);
-    TestClass testIn = CodecTestUtilities.roundTrip(codec, testOut);
-    assertEquals(testOut.data1, testIn.data1);
-    assertEquals(testOut.data2, testIn.data2);
-    assertEquals(testOut.data3, testIn.data3);
-    assertTrue(Arrays.equals(testOut.data4, testIn.data4));
-  }
-
-  @Test
-  public void testExpectedFormat() throws IOException {
-    Codec<TestClass> codec = JsonCodec.create(TestClass.class);
-    TestClass item = createTestClassInstance();
-    JsonElement expectedElement = new JsonParser()
-        .parse("{\"data1\":\"foo\",\"data2\":\"bar\",\"data3\":42,\"data4\":[\"abc\",\"def\"]}");
-    JsonElement actualElement = new JsonParser().parse(new String(CodecTestUtilities.serialize(codec, item), "utf-8"));
-    assertEquals(expectedElement.toString(), actualElement.toString());
-  }
-
-  private TestClass createTestClassInstance() {
-    TestClass testOut = new TestClass();
-    testOut.data1 = "foo";
-    testOut.data2 = "bar";
-    testOut.data3 = 42;
-    testOut.data4 = new String[] { "abc", "def" };
-    return testOut;
-  }
-
-  @Test
-  public void testThriftExclusionWrongFieldClass() throws IOException {
-    ThriftTestClass1 test1 = new ThriftTestClass1();
-    test1.data1 = "foo";
-    test1.__isset_bit_vector = "bar";
-    assertEquals("foo", roundTrip(test1).data1);
-    assertEquals("bar", roundTrip(test1).__isset_bit_vector);
-  }
-
-  @Test
-  public void testThriftExclusionRightFieldClass() throws IOException {
-    ThriftTestClass2 test2 = new ThriftTestClass2();
-    test2.data1 = "foo";
-    test2.__isset_bit_vector = new BitSet(1);
-    assertEquals("foo", roundTrip(test2).data1);
-    assertNull(roundTrip(test2).__isset_bit_vector);
-  }
-
-  private static <T> T roundTrip(T item) throws IOException {
-    @SuppressWarnings("unchecked")
-    Class<T> itemType = (Class<T>) item.getClass();
-    return CodecTestUtilities.roundTrip(JsonCodec.create(itemType,
-        new GsonBuilder()
-            .setExclusionStrategies(JsonCodec.getThriftExclusionStrategy())
-            .create()), item);
-  }
-
-  public static class TestClass {
-    private String data1;
-    private String data2;
-    private int data3;
-    private String[] data4;
-  }
-
-  public static class ThriftTestClass1 {
-    private String data1;
-    private String __isset_bit_vector;
-  }
-
-  public static class ThriftTestClass2 {
-    private String data1;
-    private BitSet __isset_bit_vector;
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/logging/BufferedLogTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/logging/BufferedLogTest.java b/commons/src/test/java/org/apache/aurora/common/logging/BufferedLogTest.java
deleted file mode 100644
index b90fbd1..0000000
--- a/commons/src/test/java/org/apache/aurora/common/logging/BufferedLogTest.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.logging;
-
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.util.Arrays;
-import java.util.List;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.ImmutableList;
-import com.google.common.util.concurrent.MoreExecutors;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-
-/**
- * Tests the BufferedLog.
- *
- * @author William Farner
- */
-public class BufferedLogTest {
-
-  private static final Predicate<Boolean> RETRY_FILTER = new Predicate<Boolean>() {
-    @Override public boolean apply(Boolean value) {
-      return !value;
-    }
-  };
-  private static final int BUFFER_SIZE = 5;
-  private static final int MAX_BUFFER_SIZE = 10;
-
-  private static final Boolean TRUE = Boolean.TRUE;
-  private static final Boolean FALSE = Boolean.FALSE;
-
-  private static final List<String> MESSAGES = Arrays.asList("1", "2", "3", "4", "5");
-
-  private BufferedLog<String, Boolean> bufferedLog;
-  private Log<String, Boolean> wrappedLog;
-
-  @Before
-  @SuppressWarnings("unchecked") // Due to createMock.
-  public void setUp() {
-    wrappedLog = createMock(Log.class);
-
-    bufferedLog = BufferedLog.<String, Boolean>builder()
-        .buffer(wrappedLog)
-        .withRetryFilter(RETRY_FILTER)
-        .withChunkLength(BUFFER_SIZE)
-        .withMaxBuffer(MAX_BUFFER_SIZE)
-        .withFlushInterval(Amount.of(10000, Time.SECONDS))
-        .withExecutorService(MoreExecutors.sameThreadExecutor())
-        .build();
-  }
-
-  @After
-  public void runTest() {
-    verify(wrappedLog);
-    assertThat(bufferedLog.getBacklog(), is(0));
-  }
-
-  @Test
-  public void testBuffers() {
-    expect(wrappedLog.log(MESSAGES)).andReturn(TRUE);
-
-    replay(wrappedLog);
-    bufferedLog.log(MESSAGES);
-  }
-
-  @Test
-  public void testFlush() {
-    expect(wrappedLog.log(Arrays.asList("a", "b", "c"))).andReturn(TRUE);
-
-    replay(wrappedLog);
-    bufferedLog.log("a");
-    bufferedLog.log("b");
-    bufferedLog.log("c");
-    bufferedLog.flush();
-  }
-
-  @Test
-  public void testBufferRetries() {
-    List<String> bufferAppended = ImmutableList.<String>builder().addAll(MESSAGES).add("6").build();
-
-    expect(wrappedLog.log(MESSAGES)).andReturn(FALSE);
-    expect(wrappedLog.log(bufferAppended)).andReturn(TRUE);
-
-    replay(wrappedLog);
-    bufferedLog.log(MESSAGES);
-    bufferedLog.log("6");
-  }
-
-  @Test
-  public void testTruncates() {
-    expect(wrappedLog.log(MESSAGES)).andReturn(FALSE);
-    expect(wrappedLog.log(Arrays.asList("1", "2", "3", "4", "5", "a"))).andReturn(FALSE);
-    expect(wrappedLog.log(Arrays.asList("1", "2", "3", "4", "5", "a", "b"))).andReturn(FALSE);
-    expect(wrappedLog.log(Arrays.asList("1", "2", "3", "4", "5", "a", "b", "c"))).andReturn(FALSE);
-    expect(wrappedLog.log(Arrays.asList("1", "2", "3", "4", "5", "a", "b", "c", "d")))
-        .andReturn(FALSE);
-    expect(wrappedLog.log(Arrays.asList("1", "2", "3", "4", "5", "a", "b", "c", "d", "e")))
-        .andReturn(FALSE);
-    expect(wrappedLog.log(Arrays.asList("1", "2", "3", "4", "5", "a", "b", "c", "d", "e", "f")))
-        .andReturn(FALSE);
-    expect(wrappedLog.log(Arrays.asList("2", "3", "4", "5", "a", "b", "c", "d", "e", "f", "g")))
-        .andReturn(FALSE);
-    expect(wrappedLog.log(Arrays.asList("3", "4", "5", "a", "b", "c", "d", "e", "f", "g", "h")))
-        .andReturn(TRUE);
-
-    replay(wrappedLog);
-
-    bufferedLog.log(MESSAGES);
-    bufferedLog.log("a");
-    bufferedLog.log("b");
-    bufferedLog.log("c");
-    bufferedLog.log("d");
-    bufferedLog.log("e");
-    bufferedLog.log("f");
-    bufferedLog.log("g");
-    bufferedLog.log("h");
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/logging/LogUtilTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/logging/LogUtilTest.java b/commons/src/test/java/org/apache/aurora/common/logging/LogUtilTest.java
deleted file mode 100644
index 6e6c3b1..0000000
--- a/commons/src/test/java/org/apache/aurora/common/logging/LogUtilTest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.logging;
-
-import org.junit.Test;
-
-import java.io.File;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-/**
- * @author William Farner
- */
-public class LogUtilTest {
-
-  @Test
-  public void testEmptyPattern() {
-    test(null, LogUtil.DEFAULT_LOG_DIR);
-    test("", LogUtil.DEFAULT_LOG_DIR);
-  }
-
-  @Test
-  public void testLocalDir() {
-    test(".", ".");
-    test("./asdf.%g.log", ".");
-    test("asdf.%g.log", ".");
-  }
-
-  @Test
-  public void testRelativeDir() {
-    test("../asdf.%g.log", "..");
-    test("b/asdf.%g.log", "b");
-    test("b/c/d/asdf.%g.log", "b/c/d");
-  }
-
-  @Test
-  public void testAbsoluteDir() {
-    test("/a/b/c/d/logs.%g.%u.log", "/a/b/c/d");
-    test("/asdf.log", "/");
-  }
-
-  private void test(String pattern, String expected) {
-    assertThat(LogUtil.getLogManagerLogDir(pattern).getPath(), is(expected));
-  }
-
-  private void test(String pattern, File expected) {
-    test(pattern, expected.getPath());
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/logging/julbridge/JULBridgeHandlerTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/logging/julbridge/JULBridgeHandlerTest.java b/commons/src/test/java/org/apache/aurora/common/logging/julbridge/JULBridgeHandlerTest.java
deleted file mode 100644
index aef4c80..0000000
--- a/commons/src/test/java/org/apache/aurora/common/logging/julbridge/JULBridgeHandlerTest.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.logging.julbridge;
-
-import java.util.ListResourceBundle;
-import java.util.ResourceBundle;
-import java.util.logging.Level;
-import java.util.logging.LogRecord;
-
-import org.apache.log4j.Category;
-import org.apache.log4j.Logger;
-import org.apache.log4j.spi.LocationInfo;
-import org.apache.log4j.spi.LoggingEvent;
-import org.junit.Test;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.sameInstance;
-import static org.hamcrest.MatcherAssert.assertThat;
-
-public class JULBridgeHandlerTest {
-
-  @Test
-  public void checkMessageWithParametersIsFormatted() {
-    LogRecord record = new LogRecord(Level.FINEST, "test is {0}");
-    record.setParameters(new Object[] {"successful"});
-
-    assertThat(JULBridgeHandler.formatMessage(record), is("test is successful"));
-  }
-
-  @Test
-  public void checkMessageWithResourceBundleIsFormatted() {
-    ResourceBundle bundle = new ListResourceBundle() {
-      @Override protected Object[][] getContents() {
-        return new Object[][] {
-            {"test is successful", "le test fonctionne"}
-        };
-      }
-    };
-
-    LogRecord record = new LogRecord(Level.FINEST, "test is successful");
-    record.setResourceBundle(bundle);
-
-    assertThat(JULBridgeHandler.formatMessage(record), is("le test fonctionne"));
-  }
-
-  @Test
-  public void checkGetLoggerReturnsLoggerWithSameName() {
-    LogRecord record = new LogRecord(Level.FINEST, "test message");
-    record.setLoggerName("test.checkGetLogger");
-
-    assertThat(new JULBridgeHandler().getLogger(record).getName(), is("test.checkGetLogger"));
-  }
-
-  @Test
-  public void checkToLoggingEvent() {
-    LogRecord record = new LogRecord(Level.FINEST, "test is {0}");
-    record.setParameters(new Object[] {"successful"});
-
-    record.setThreadID(42);
-    Throwable t = new Throwable();
-    record.setThrown(t);
-
-    // source class and method names are usually inferred, but because there's no JUL in the stack
-    // frame, it won't work as expected.
-    record.setSourceClassName(getClass().getName());
-    record.setSourceMethodName("checkToLoggingEvent");
-
-    Logger log4jLogger = new JULBridgeHandler().getLogger(record);
-    org.apache.log4j.Level log4jLevel = JULBridgeLevelConverter.toLog4jLevel(Level.FINEST);
-    LoggingEvent event = JULBridgeHandler.toLoggingEvent(record, log4jLogger, log4jLevel, false);
-
-    assertThat(event.getLogger(), is((Category) log4jLogger));
-    assertThat(event.getLevel(), is(log4jLevel));
-    assertThat(event.getMessage(), is((Object) "test is successful"));
-    assertThat(event.getThreadName(), is("42"));
-    assertThat(event.getTimeStamp(), is(record.getMillis()));
-    assertThat(event.getThrowableInformation().getThrowable(), is(sameInstance(t)));
-
-    LocationInfo info = event.getLocationInformation();
-    assertThat(info.getClassName(), is(getClass().getName()));
-    assertThat(info.getMethodName(), is("checkToLoggingEvent"));
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/logging/julbridge/JULBridgeLevelConverterTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/logging/julbridge/JULBridgeLevelConverterTest.java b/commons/src/test/java/org/apache/aurora/common/logging/julbridge/JULBridgeLevelConverterTest.java
deleted file mode 100644
index 79dfb26..0000000
--- a/commons/src/test/java/org/apache/aurora/common/logging/julbridge/JULBridgeLevelConverterTest.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.logging.julbridge;
-
-import java.util.Arrays;
-import java.util.logging.Level;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
-
-public class JULBridgeLevelConverterTest {
-
-  @RunWith(Parameterized.class)
-  public static class JULMappingToLog4JTest {
-    @SuppressWarnings("serial")
-    @Parameters
-    public static Iterable<Object[]> data() {
-      return Arrays.asList(new Object[][] {
-          { Level.FINEST,  org.apache.log4j.Level.TRACE },
-          { Level.FINER,   org.apache.log4j.Level.DEBUG },
-          { Level.FINE,    org.apache.log4j.Level.DEBUG },
-          { Level.INFO,    org.apache.log4j.Level.INFO },
-          { Level.WARNING, org.apache.log4j.Level.WARN },
-          { Level.SEVERE,  org.apache.log4j.Level.ERROR },
-          { Level.ALL,     org.apache.log4j.Level.ALL },
-          { Level.OFF,     org.apache.log4j.Level.OFF },
-          // Unknown level should map to DEBUG
-          { new Level("test", 42) {}, org.apache.log4j.Level.DEBUG }
-      });
-    }
-
-    private final Level level;
-    private final org.apache.log4j.Level expected;
-
-    public JULMappingToLog4JTest(Level level, org.apache.log4j.Level expected) {
-      this.level = level;
-      this.expected = expected;
-    }
-
-    @Test
-    public void checkJULMapsToLog4J() {
-      assertThat(JULBridgeLevelConverter.toLog4jLevel(level), is(expected));
-    }
-  }
-
-  @RunWith(Parameterized.class)
-  public static class Log4JMappingToJULTest {
-    @SuppressWarnings("serial")
-    @Parameters
-    public static Iterable<Object[]> data() {
-      return Arrays.asList(new Object[][] {
-          { org.apache.log4j.Level.TRACE, Level.FINEST },
-          { org.apache.log4j.Level.DEBUG, Level.FINE },
-          { org.apache.log4j.Level.INFO,  Level.INFO },
-          { org.apache.log4j.Level.WARN,  Level.WARNING },
-          { org.apache.log4j.Level.ERROR, Level.SEVERE },
-          { org.apache.log4j.Level.FATAL, Level.SEVERE },
-          { org.apache.log4j.Level.ALL,   Level.ALL },
-          { org.apache.log4j.Level.OFF,   Level.OFF },
-          // Unknown level should map to FINE
-          { new org.apache.log4j.Level(42, "test", 42) {}, Level.FINE }
-      });
-    }
-
-    private final org.apache.log4j.Level level;
-    private final Level expected;
-
-    public Log4JMappingToJULTest(org.apache.log4j.Level level, Level expected) {
-      this.level = level;
-      this.expected = expected;
-    }
-
-    @Test
-    public void checkJULMapsToLog4J() {
-      assertThat(JULBridgeLevelConverter.fromLog4jLevel(level), is(expected));
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/logging/julbridge/JULBridgeLogManagerTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/logging/julbridge/JULBridgeLogManagerTest.java b/commons/src/test/java/org/apache/aurora/common/logging/julbridge/JULBridgeLogManagerTest.java
deleted file mode 100644
index 40eac59..0000000
--- a/commons/src/test/java/org/apache/aurora/common/logging/julbridge/JULBridgeLogManagerTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.logging.julbridge;
-
-import java.io.IOException;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.LogManager;
-import java.util.logging.Logger;
-
-import org.apache.log4j.AppenderSkeleton;
-import org.apache.log4j.Hierarchy;
-import org.apache.log4j.spi.LoggerRepository;
-import org.apache.log4j.spi.LoggingEvent;
-import org.apache.log4j.spi.RootLogger;
-import org.junit.After;
-import org.junit.Test;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
-
-public class JULBridgeLogManagerTest {
-
-  @After
-  public void restoreLogConfiguration() throws SecurityException, IOException {
-    LogManager.getLogManager().readConfiguration();
-  }
-
-  @Test
-  public void checkAssimilateTakesOver() {
-    // Create a test log4j environment
-    final List<LoggingEvent> events = new LinkedList<LoggingEvent>();
-
-    org.apache.log4j.Logger log4jRoot = new RootLogger(org.apache.log4j.Level.ALL);
-    LoggerRepository loggerRepository = new Hierarchy(log4jRoot);
-    loggerRepository.setThreshold(org.apache.log4j.Level.INFO);
-
-    log4jRoot.addAppender(new AppenderSkeleton() {
-      @Override public boolean requiresLayout() {
-        return false;
-      }
-
-      @Override public void close() {}
-
-      @Override protected void append(LoggingEvent event) {
-        events.add(event);
-      }
-    });
-
-
-    JULBridgeLogManager.assimilate(loggerRepository);
-
-    Logger.getLogger("test.1").log(Level.INFO, "test message 1");
-    Logger.getLogger("test.2").log(Level.FINE, "test message 2");
-    Logger.getLogger("test.3").log(Level.WARNING, "test message 3");
-
-    assertThat(events.size(), is(2));
-    assertThat(events.get(0).getLoggerName(), is("test.1"));
-    assertThat(events.get(0).getMessage(), is((Object) "test message 1"));
-    assertThat(events.get(1).getLoggerName(), is("test.3"));
-    assertThat(events.get(1).getMessage(), is((Object) "test message 3"));
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/net/UrlHelperTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/net/UrlHelperTest.java b/commons/src/test/java/org/apache/aurora/common/net/UrlHelperTest.java
deleted file mode 100644
index c6e84bd..0000000
--- a/commons/src/test/java/org/apache/aurora/common/net/UrlHelperTest.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net;
-
-import com.google.common.collect.ImmutableList;
-import org.junit.Test;
-
-import java.net.URISyntaxException;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-/**
- * @author John Sirois
- */
-public class UrlHelperTest {
-  @Test
-  public void testGetDomain() {
-    assertEquals("www.twitter.com", UrlHelper.getDomain("www.twitter.com"));
-    assertEquals("www.twitter.com", UrlHelper.getDomain("www.twitter.com/a/b/c?foo=bar&bar=baz"));
-
-    assertEquals("www.bign.com",
-        UrlHelper.getDomain("www.bign.com/davidvandiverhttp://cli.gs/da0e0"));
-    assertEquals("www.thesun.co.uk",
-        UrlHelper.getDomain("www.thesun.co.uk/sol/homepa-http://dragtotop.com/thesun.co.uk"));
-    assertEquals("www.formspring.me",
-        UrlHelper.getDomain("www.formspring.me/chuuworangerrhttp://bit.ly/7pydt3"));
-    assertEquals("www.bign.com",
-        UrlHelper.getDomain("www.bign.com/davidvandiverhttp://cli.gs/da0e0"));
-    assertEquals("www.roundplace.com",
-        UrlHelper.getDomain("www.roundplace.com/en/watch/108/3/"
-                            + "baltimore-rave-http://dragtotop.com/patriots_vs_ravens"));
-    assertEquals("www.bign.com",
-        UrlHelper.getDomain("www.bign.com/davidvandiverhttp://cli.gs/da0e0"));
-    assertEquals(null, UrlHelper.getDomain("http://?idonthaveadomain=true"));
-    assertEquals(null, UrlHelper.getDomain(":::<<<<<::IAMNOTAVALIDURI“"));
-  }
-
-  @Test
-  public void testGetDomainChecked() throws Exception {
-    assertEquals("www.twitter.com", UrlHelper.getDomainChecked("http://www.twitter.com"));
-    assertEquals("www.twitter.com", UrlHelper.getDomainChecked("https://www.twitter.com/?a=b"));
-    assertEquals(null, UrlHelper.getDomainChecked("http://?idonthaveadomain=true"));
-    try {
-      UrlHelper.getDomainChecked(":::<<<<<::IAMNOTAVALIDURI“");
-      fail();
-    } catch (URISyntaxException e) {
-      // Expected
-    }
-  }
-
-  @Test
-  public void testGetPath() {
-    assertEquals("", UrlHelper.getPath("www.twitter.com"));
-    assertEquals("/", UrlHelper.getPath("www.twitter.com/"));
-    assertEquals("/foo", UrlHelper.getPath("http://www.twitter.com/foo"));
-    assertEquals("/bar", UrlHelper.getPath("https://www.twitter.com/bar"));
-    assertEquals("/a/b/c", UrlHelper.getPath("www.twitter.com/a/b/c"));
-
-    assertEquals("/davidvandiverhttp://cli.gs/da0e0",
-        UrlHelper.getPath("www.bign.com/davidvandiverhttp://cli.gs/da0e0"));
-    assertEquals("/sol/homepa-http://dragtotop.com/thesun.co.uk",
-        UrlHelper.getPath("www.thesun.co.uk/sol/homepa-http://dragtotop.com/thesun.co.uk"));
-    assertEquals("/chuuworangerrhttp://bit.ly/7pydt3",
-        UrlHelper.getPath("www.formspring.me/chuuworangerrhttp://bit.ly/7pydt3"));
-    assertEquals("/davidvandiverhttp://cli.gs/da0e0",
-        UrlHelper.getPath("www.bign.com/davidvandiverhttp://cli.gs/da0e0"));
-    assertEquals("/en/watch/10855/3/baltimore-rave-http://dragtotop.com/patriots_vs_ravens",
-        UrlHelper.getPath("www.roundplace.com/en/watch/10855/3/"
-                            + "baltimore-rave-http://dragtotop.com/patriots_vs_ravens"));
-    assertEquals("/davidvandiverhttp://cli.gs/da0e0",
-        UrlHelper.getPath("www.bign.com/davidvandiverhttp://cli.gs/da0e0"));
-  }
-
-  @Test
-  public void testAddProtocol() {
-    assertEquals("http://www.twitter.com", UrlHelper.addProtocol("www.twitter.com"));
-    assertEquals("http://www.twitter.com", UrlHelper.addProtocol("http://www.twitter.com"));
-    assertEquals("https://www.twitter.com", UrlHelper.addProtocol("https://www.twitter.com"));
-
-    assertEquals("http://www.twitter.com/this/is/a/http://stange/but/valid/path",
-        UrlHelper.addProtocol("http://www.twitter.com/this/is/a/http://stange/but/valid/path"));
-    assertEquals("http://www.twitter.com/this/is/a/http://stange/but/valid/path",
-        UrlHelper.addProtocol("www.twitter.com/this/is/a/http://stange/but/valid/path"));
-  }
-
-  @Test
-  public void testStripUrlParameters() {
-    assertEquals("www.twitter.com", UrlHelper.stripUrlParameters("www.twitter.com"));
-    assertEquals("www.twitter.com", UrlHelper.stripUrlParameters("www.twitter.com?foo-bar"));
-    assertEquals("www.twitter.com/a/b/",
-        UrlHelper.stripUrlParameters("www.twitter.com/a/b/?foo-bar"));
-
-    assertEquals("http://www.twitter.com", UrlHelper.stripUrlParameters("http://www.twitter.com"));
-    assertEquals("http://www.twitter.com",
-        UrlHelper.stripUrlParameters("http://www.twitter.com?foo=bar"));
-    assertEquals("http://www.twitter.com/a",
-        UrlHelper.stripUrlParameters("http://www.twitter.com/a?foo=bar"));
-  }
-
-  @Test
-  public void testGetDomainLevels() {
-    assertEquals(ImmutableList.of("www.fred", "fred"), UrlHelper.getDomainLevels("fred"));
-    assertEquals(ImmutableList.of("www.twitter.com", "twitter.com", "com"),
-        UrlHelper.getDomainLevels("www.twitter.com"));
-    assertEquals(ImmutableList.of("www.twitter.co.uk", "twitter.co.uk", "co.uk", "uk"),
-        UrlHelper.getDomainLevels("twitter.co.uk"));
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/net/UrlResolverTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/net/UrlResolverTest.java b/commons/src/test/java/org/apache/aurora/common/net/UrlResolverTest.java
deleted file mode 100644
index eb066fc..0000000
--- a/commons/src/test/java/org/apache/aurora/common/net/UrlResolverTest.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net;
-
-import org.apache.aurora.common.base.ExceptionalFunction;
-import org.apache.aurora.common.net.UrlResolver.ResolvedUrl;
-import org.apache.aurora.common.net.UrlResolver.ResolvedUrl.EndState;
-import org.apache.aurora.common.util.BackoffStrategy;
-import org.apache.aurora.common.util.Clock;
-import org.easymock.IMocksControl;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.io.IOException;
-
-import static com.google.common.testing.junit4.JUnitAsserts.assertContentsInOrder;
-import static org.easymock.EasyMock.createControl;
-import static org.easymock.EasyMock.expect;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-
-/**
- * @author John Sirois
- */
-public class UrlResolverTest {
-  private IMocksControl control;
-  private ExceptionalFunction<String, String, IOException> resolver;
-  private Clock clock;
-  private BackoffStrategy backoffStrategy;
-
-  @Before
-  public void setUp() throws Exception {
-    control = createControl();
-
-    @SuppressWarnings("unchecked")
-    ExceptionalFunction<String, String, IOException> resolver =
-        control.createMock(ExceptionalFunction.class);
-    this.resolver = resolver;
-    this.clock = control.createMock(Clock.class);
-    this.backoffStrategy = control.createMock(BackoffStrategy.class);
-  }
-
-  @Test
-  public void testResolveUrlResolved() throws Exception {
-    expect(resolver.apply("jake")).andReturn("jake");
-    control.replay();
-
-    ResolvedUrl resolvedUrl = createResolver(3).resolveUrl("jake");
-    assertEquals("jake", resolvedUrl.getStartUrl());
-    assertContentsInOrder("Expected no intermediate urls", resolvedUrl.getIntermediateUrls());
-    assertNull(resolvedUrl.getEndUrl());
-    assertEquals(EndState.REACHED_LANDING, resolvedUrl.getEndState());
-
-    control.verify();
-  }
-
-  @Test
-  public void testResolveUrlSingleRedirect() throws Exception {
-    expect(resolver.apply("jake")).andReturn("joe");
-    expect(resolver.apply("joe")).andReturn("joe");
-    control.replay();
-
-    ResolvedUrl resolvedUrl = createResolver(3).resolveUrl("jake");
-    assertEquals("jake", resolvedUrl.getStartUrl());
-    assertContentsInOrder("Expected no intermediate urls", resolvedUrl.getIntermediateUrls());
-    assertEquals("joe", resolvedUrl.getEndUrl());
-    assertEquals(EndState.REACHED_LANDING, resolvedUrl.getEndState());
-
-    control.verify();
-  }
-
-  @Test
-  public void testResolveUrlMultipleRedirects() throws Exception {
-    expect(resolver.apply("jake")).andReturn("joe");
-    expect(resolver.apply("joe")).andReturn("bill");
-    expect(resolver.apply("bill")).andReturn("bob");
-    expect(resolver.apply("bob")).andReturn("fred");
-    expect(resolver.apply("fred")).andReturn("fred");
-    control.replay();
-
-    ResolvedUrl resolvedUrl = createResolver(5).resolveUrl("jake");
-    assertEquals("jake", resolvedUrl.getStartUrl());
-    assertContentsInOrder(resolvedUrl.getIntermediateUrls(), "joe", "bill", "bob");
-    assertEquals("fred", resolvedUrl.getEndUrl());
-    assertEquals(EndState.REACHED_LANDING, resolvedUrl.getEndState());
-
-    control.verify();
-  }
-
-  @Test
-  public void testResolveUrlRedirectLimit() throws Exception {
-    expect(resolver.apply("jake")).andReturn("joe");
-    expect(resolver.apply("joe")).andReturn("bill");
-    control.replay();
-
-    ResolvedUrl resolvedUrl = createResolver(2).resolveUrl("jake");
-    assertEquals("jake", resolvedUrl.getStartUrl());
-    assertContentsInOrder(resolvedUrl.getIntermediateUrls(), "joe");
-    assertEquals("bill", resolvedUrl.getEndUrl());
-    assertEquals(EndState.REDIRECT_LIMIT, resolvedUrl.getEndState());
-
-    control.verify();
-  }
-
-  @Test
-  public void testResolveUrlResolveError() throws Exception {
-    expect(resolver.apply("jake")).andThrow(new IOException());
-    control.replay();
-
-    ResolvedUrl resolvedUrl = createResolver(3).resolveUrl("jake");
-    assertEquals("jake", resolvedUrl.getStartUrl());
-    assertContentsInOrder("Expected no intermediate urls", resolvedUrl.getIntermediateUrls());
-    assertNull(resolvedUrl.getEndUrl());
-    assertEquals(EndState.ERROR, resolvedUrl.getEndState());
-
-    control.verify();
-  }
-
-  @Test
-  public void testResolveUrlResolveErrorCode() throws Exception {
-    expect(resolver.apply("jake")).andReturn(null);
-    expect(backoffStrategy.calculateBackoffMs(0L)).andReturn(1L);
-    clock.waitFor(1L);
-
-    expect(resolver.apply("jake")).andReturn(null);
-    expect(backoffStrategy.calculateBackoffMs(1L)).andReturn(2L);
-    clock.waitFor(2L);
-
-    expect(resolver.apply("jake")).andReturn(null);
-    // we shouldn't back off after the last attempt
-    control.replay();
-
-    ResolvedUrl resolvedUrl = createResolver(3).resolveUrl("jake");
-    assertEquals("jake", resolvedUrl.getStartUrl());
-    assertContentsInOrder("Expected no intermediate urls", resolvedUrl.getIntermediateUrls());
-    assertNull(resolvedUrl.getEndUrl());
-    assertEquals(EndState.ERROR, resolvedUrl.getEndState());
-
-    control.verify();
-  }
-
-  @Test
-  public void testResolveStepsToPermanentError() throws Exception {
-    expect(resolver.apply("jake")).andReturn("joe");
-    expect(resolver.apply("joe")).andReturn("fred");
-    expect(resolver.apply("fred")).andReturn(null);
-    // we shouldn't back off after the last attempt
-    control.replay();
-
-    ResolvedUrl resolvedUrl = createResolver(3).resolveUrl("jake");
-    assertEquals("jake", resolvedUrl.getStartUrl());
-    assertContentsInOrder(resolvedUrl.getIntermediateUrls(), "joe");
-    assertEquals("fred", resolvedUrl.getEndUrl());
-    assertEquals(EndState.ERROR, resolvedUrl.getEndState());
-  }
-
-  private UrlResolver createResolver(int maxRedirects) {
-    return new UrlResolver(clock, backoffStrategy, resolver, maxRedirects);
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/net/UrlResolverUtilTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/net/UrlResolverUtilTest.java b/commons/src/test/java/org/apache/aurora/common/net/UrlResolverUtilTest.java
deleted file mode 100644
index 3633da8..0000000
--- a/commons/src/test/java/org/apache/aurora/common/net/UrlResolverUtilTest.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net;
-
-import com.google.common.base.Function;
-import com.google.common.testing.TearDown;
-import com.google.common.testing.junit4.TearDownTestCase;
-import org.apache.aurora.common.base.Closure;
-import org.apache.aurora.common.collections.Pair;
-import org.easymock.Capture;
-import org.easymock.IAnswer;
-import org.easymock.IMocksControl;
-import org.junit.Before;
-import org.junit.Test;
-import org.mortbay.jetty.Server;
-import org.mortbay.jetty.bio.SocketConnector;
-import org.mortbay.jetty.servlet.Context;
-import org.mortbay.jetty.servlet.ServletHolder;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.net.URL;
-
-import static org.easymock.EasyMock.*;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-/**
- * TODO(John Sirois): add test for error conditions
- *
- * @author John Sirois
- */
-public class UrlResolverUtilTest extends TearDownTestCase {
-  private static final String REDIRECT_LOCATION = "http://bar";
-
-  private IMocksControl control;
-  private Function<URL, String> urlToUA;
-  private Closure<Pair<HttpServletRequest, HttpServletResponse>> requestHandler;
-  private UrlResolverUtil urlResolverUtil;
-  private HttpServlet servlet;
-  private String url;
-
-  @Before
-  public void setUp() {
-    control = createControl();
-
-    @SuppressWarnings("unchecked")
-    Function<URL, String> urlToUA = control.createMock(Function.class);
-    this.urlToUA = urlToUA;
-
-    @SuppressWarnings("unchecked")
-    Closure<Pair<HttpServletRequest, HttpServletResponse>> handler =
-        control.createMock(Closure.class);
-    requestHandler = handler;
-
-    urlResolverUtil = new UrlResolverUtil(urlToUA);
-
-    servlet = new HttpServlet() {
-      @Override protected void service(HttpServletRequest req, HttpServletResponse resp)
-          throws ServletException, IOException {
-        requestHandler.execute(Pair.of(req, resp));
-      }
-    };
-  }
-
-  @Test
-  public void testUASelection() throws Exception {
-    url = startServer();
-    String redirectLocation = "http://bar.com";
-
-    expect(urlToUA.apply(new URL(url))).andReturn("foo-agent");
-    expectRequestAndRedirect(redirectLocation);
-    control.replay();
-
-    String effectiveUrl = urlResolverUtil.getEffectiveUrl(url, null /* no proxy */);
-    assertEquals(redirectLocation, effectiveUrl);
-
-    control.verify();
-  }
-
-  @Test
-  public void testRelativeRedirect() throws Exception {
-    url = startServer();
-    String relativeRedirect = "relatively/speaking";
-
-    expect(urlToUA.apply(new URL(url))).andReturn("foo-agent");
-    expectRequestAndRedirect(relativeRedirect);
-    control.replay();
-
-    String effectiveUrl = urlResolverUtil.getEffectiveUrl(url, null /* no proxy */);
-    assertEquals(url + relativeRedirect, effectiveUrl);
-
-    control.verify();
-  }
-
-  @Test
-  public void testInvalidRedirect() throws Exception {
-    url = startServer();
-    String badRedirect = ":::<<<<<::IAMNOTAVALIDURI";
-
-    expect(urlToUA.apply(new URL(url))).andReturn("foo-agent");
-    expectRequestAndRedirect(badRedirect);
-    control.replay();
-
-    String effectiveUrl = urlResolverUtil.getEffectiveUrl(url, null /* no proxy */);
-    assertEquals(badRedirect, effectiveUrl);
-
-    control.verify();
-  }
-
-  private void expectRequestAndRedirect(final String location) throws Exception {
-    final Capture<Pair<HttpServletRequest, HttpServletResponse>> requestCapture =
-        new Capture<Pair<HttpServletRequest, HttpServletResponse>>();
-    requestHandler.execute(capture(requestCapture));
-    expectLastCall().andAnswer(new IAnswer<Void>() {
-      @Override public Void answer() throws Throwable {
-        assertTrue(requestCapture.hasCaptured());
-        Pair<HttpServletRequest, HttpServletResponse> pair = requestCapture.getValue();
-
-        HttpServletRequest request = pair.getFirst();
-        assertEquals("HEAD", request.getMethod());
-        assertEquals("foo-agent", request.getHeader("User-Agent"));
-
-        pair.getSecond().sendRedirect(location);
-        return null;
-      }
-    });
-  }
-
-  private String startServer() throws Exception {
-    final Server server = new Server();
-    final SocketConnector connector = new SocketConnector();
-    connector.setHost("127.0.0.1");
-    connector.setPort(0);
-    server.addConnector(connector);
-
-    Context context = new Context(server, "/", Context.NO_SECURITY);
-    context.addServlet(new ServletHolder(servlet), "/*");
-    server.start();
-    addTearDown(new TearDown() {
-      @Override public void tearDown() throws Exception {
-        server.stop();
-      }
-    });
-
-    return "http://" + connector.getHost() + ":" + connector.getLocalPort() + "/";
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/net/UrlTokenizerUtilTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/net/UrlTokenizerUtilTest.java b/commons/src/test/java/org/apache/aurora/common/net/UrlTokenizerUtilTest.java
deleted file mode 100644
index 6cc8abf..0000000
--- a/commons/src/test/java/org/apache/aurora/common/net/UrlTokenizerUtilTest.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net;
-
-import java.util.Arrays;
-import java.util.List;
-
-import com.google.common.collect.Lists;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-/**
- * @author Adam Samet
- */
-public class UrlTokenizerUtilTest {
-
-  @Test
-  public void testGetReversedDomainParts() {
-    List<String> list1 = Lists.newArrayList();
-    String url1 = "www.twitter.com";
-    list1.add("com");
-    assertEquals(list1, UrlTokenizerUtil.getReversedDomainParts(url1, 1));
-    list1.add("twitter");
-    assertEquals(list1, UrlTokenizerUtil.getReversedDomainParts(url1, 2));
-    list1.add("www");
-    assertEquals(list1, UrlTokenizerUtil.getReversedDomainParts(url1, 3));
-    list1.add("");
-    assertEquals(list1, UrlTokenizerUtil.getReversedDomainParts(url1, 4));
-    list1.add("");
-    assertEquals(list1, UrlTokenizerUtil.getReversedDomainParts(url1, 5));
-
-    List<String> list2 = Lists.newArrayList();
-    String url2 = "www.twitter.co.uk";
-    list2.add("co.uk");
-    assertEquals(list2, UrlTokenizerUtil.getReversedDomainParts(url2, 1));
-    list2.add("twitter");
-    assertEquals(list2, UrlTokenizerUtil.getReversedDomainParts(url2, 2));
-    list2.add("www");
-    assertEquals(list2, UrlTokenizerUtil.getReversedDomainParts(url2, 3));
-    list2.add("");
-    assertEquals(list2, UrlTokenizerUtil.getReversedDomainParts(url2, 4));
-    list2.add("");
-    assertEquals(list2, UrlTokenizerUtil.getReversedDomainParts(url2, 5));
-
-    List<String> list3 = Lists.newArrayList();
-    String url3= "www.twitter.co.ukNOT";
-    list3.add("ukNOT");
-    assertEquals(list3, UrlTokenizerUtil.getReversedDomainParts(url3, 1));
-    list3.add("co");
-    assertEquals(list3, UrlTokenizerUtil.getReversedDomainParts(url3, 2));
-    list3.add("twitter");
-    assertEquals(list3, UrlTokenizerUtil.getReversedDomainParts(url3, 3));
-    list3.add("www");
-    assertEquals(list3, UrlTokenizerUtil.getReversedDomainParts(url3, 4));
-    list3.add("");
-    assertEquals(list3, UrlTokenizerUtil.getReversedDomainParts(url3, 5));
-
-    assertEquals(Arrays.asList("co.jp", "google"),
-                 UrlTokenizerUtil.getReversedDomainParts("news.google.co.jp", 2));
-    assertEquals(Arrays.asList("co.jp", "google"),
-                 UrlTokenizerUtil.getReversedDomainParts("news.google.co.jp", 2));
-    assertEquals(Arrays.asList("com", "google"),
-                 UrlTokenizerUtil.getReversedDomainParts("news.google.com", 2));
-    assertEquals(Arrays.asList("com", "google", "news"),
-                 UrlTokenizerUtil.getReversedDomainParts("news.google.com", 3));
-  }
-
-  @Test
-  public void testIsTLD() throws Exception {
-    assertTrue(UrlTokenizerUtil.isTLD("com.cn", false));
-    assertTrue(UrlTokenizerUtil.isTLD("com", false));
-    assertTrue(UrlTokenizerUtil.isTLD("co.jp", false));
-    assertTrue(UrlTokenizerUtil.isTLD("co.uk", false));
-    assertTrue(UrlTokenizerUtil.isTLD("uk.co", true));
-    assertTrue(UrlTokenizerUtil.isTLD("cn.com", true));
-    assertFalse(UrlTokenizerUtil.isTLD("google.co.uk", false));
-    assertFalse(UrlTokenizerUtil.isTLD("google.jp", false));
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/net/http/RequestLoggerTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/net/http/RequestLoggerTest.java b/commons/src/test/java/org/apache/aurora/common/net/http/RequestLoggerTest.java
deleted file mode 100644
index 3f2309b..0000000
--- a/commons/src/test/java/org/apache/aurora/common/net/http/RequestLoggerTest.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net.http;
-
-import java.util.logging.Level;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mortbay.jetty.HttpHeaders;
-import org.mortbay.jetty.HttpURI;
-import org.mortbay.jetty.Request;
-import org.mortbay.jetty.RequestLog;
-import org.mortbay.jetty.Response;
-
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-import org.apache.aurora.common.testing.easymock.EasyMockTest;
-import org.apache.aurora.common.util.testing.FakeClock;
-
-import static org.easymock.EasyMock.expect;
-
-public class RequestLoggerTest extends EasyMockTest {
-
-  private FakeClock clock;
-  private RequestLogger.LogSink sink;
-  private Request request;
-  private Response response;
-
-  private RequestLog log;
-
-  @Before
-  public void setUp() throws Exception {
-    clock = new FakeClock();
-    sink = createMock(RequestLogger.LogSink.class);
-    request = createMock(Request.class);
-    response = createMock(Response.class);
-    log = new RequestLogger(clock, sink);
-  }
-
-  @Test
-  public void testFormat200() throws Exception {
-    clock.advance(Amount.of(40L * 365, Time.DAYS));
-
-    expect(response.getStatus()).andReturn(200).atLeastOnce();
-    expect(request.getServerName()).andReturn("snoopy");
-    expect(request.getHeader(HttpHeaders.X_FORWARDED_FOR)).andReturn(null);
-    expect(request.getMethod()).andReturn("GET");
-    expect(request.getUri()).andReturn(new HttpURI("/"));
-    expect(request.getProtocol()).andReturn("http");
-    expect(response.getContentCount()).andReturn(256L);
-    expect(request.getRemoteAddr()).andReturn("easymock-test");
-    expect(request.getHeader(HttpHeaders.REFERER)).andReturn(null);
-    expect(request.getHeader(HttpHeaders.USER_AGENT)).andReturn("junit");
-    expect(request.getTimeStamp()).andReturn(clock.nowMillis()).atLeastOnce();
-
-    expect(sink.isLoggable(Level.FINE)).andReturn(true);
-    sink.log(Level.FINE, "snoopy easymock-test [22/Dec/2009:00:00:00 +0000]"
-        + " \"GET / http\" 200 256 \"-\" \"junit\" 110");
-
-    control.replay();
-
-    clock.advance(Amount.of(110L, Time.MILLISECONDS));
-    log.log(request, response);
-  }
-
-  @Test
-  public void testFormat500() throws Exception {
-    clock.advance(Amount.of(40L * 365, Time.DAYS));
-
-    expect(response.getStatus()).andReturn(500).atLeastOnce();
-    expect(request.getServerName()).andReturn("woodstock");
-    expect(request.getHeader(HttpHeaders.X_FORWARDED_FOR)).andReturn(null);
-    expect(request.getMethod()).andReturn("POST");
-    expect(request.getUri()).andReturn(new HttpURI("/data"));
-    expect(request.getProtocol()).andReturn("http");
-    expect(response.getContentCount()).andReturn(128L);
-    expect(request.getRemoteAddr()).andReturn("easymock-test");
-    expect(request.getHeader(HttpHeaders.REFERER)).andReturn(null);
-    expect(request.getHeader(HttpHeaders.USER_AGENT)).andReturn("junit");
-    expect(request.getTimeStamp()).andReturn(clock.nowMillis()).atLeastOnce();
-
-    expect(sink.isLoggable(Level.INFO)).andReturn(true);
-    sink.log(Level.INFO, "woodstock easymock-test [22/Dec/2009:00:00:00 +0000]"
-        + " \"POST /data http\" 500 128 \"-\" \"junit\" 500");
-
-    control.replay();
-
-    clock.advance(Amount.of(500L, Time.MILLISECONDS));
-    log.log(request, response);
-  }
-}


[18/21] aurora git commit: Remove unused classes from commons fork.

Posted by wf...@apache.org.
http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/net/http/GuiceServletConfig.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/net/http/GuiceServletConfig.java b/commons/src/main/java/org/apache/aurora/common/net/http/GuiceServletConfig.java
deleted file mode 100644
index e4fa8aa..0000000
--- a/commons/src/main/java/org/apache/aurora/common/net/http/GuiceServletConfig.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net.http;
-
-import com.google.common.base.Preconditions;
-import com.google.inject.Inject;
-import com.google.inject.Injector;
-import com.google.inject.servlet.GuiceServletContextListener;
-
-import javax.servlet.ServletContextEvent;
-import java.util.logging.Logger;
-
-/**
- * A wrapper around the GuiceServletContextListener that has access to the injector.
- *
- * @author Florian Leibert
- */
-public class GuiceServletConfig extends GuiceServletContextListener {
-  private final Injector injector;
-
-  @Inject
-  public GuiceServletConfig(Injector injector) {
-    this.injector = Preconditions.checkNotNull(injector);
-  }
-
-  @Override
-  protected Injector getInjector() {
-    return injector;
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/net/http/HttpServerDispatch.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/net/http/HttpServerDispatch.java b/commons/src/main/java/org/apache/aurora/common/net/http/HttpServerDispatch.java
deleted file mode 100644
index 3208267..0000000
--- a/commons/src/main/java/org/apache/aurora/common/net/http/HttpServerDispatch.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net.http;
-
-import java.util.Map;
-
-import javax.annotation.Nullable;
-import javax.servlet.Filter;
-import javax.servlet.ServletContextAttributeListener;
-import javax.servlet.ServletContextListener;
-import javax.servlet.ServletRequestAttributeListener;
-import javax.servlet.ServletRequestListener;
-import javax.servlet.http.HttpServlet;
-
-/**
- * A HTTP server dispatcher. Supports registering handlers for different
- * URI paths, which will be called when a request is received.
- *
- * @author Florian Leibert
- */
-public interface HttpServerDispatch {
-
-  /**
-   * Opens the HTTP server on the given port.
-   *
-   * @param port The port to listen on.
-   * @return {@code true} if the server started successfully on the port, {@code false} otherwise.
-   */
-  boolean listen(int port);
-
-  /**
-   * Opens the HTTP server on random port within the given range.
-   *
-   * @param minPort The minimum port number to listen on.
-   * @param maxPort The maximum port number to listen on.
-   * @return {@code true} if the server started successfully on the port, {@code false} otherwise.
-   */
-  boolean listen(int minPort, int maxPort);
-
-  /**
-   * @return true if the underlying HttpServer is started, false otherwise.
-   */
-  boolean isStarted();
-
-  /**
-   * @return the port the underlying HttpServer is listening on, which requires
-   *         the underlying HttpServer to be started and listening.
-   */
-  int getPort();
-
-  /**
-   * Stops the HTTP server.
-   */
-  void stop();
-
-  /**
-   * Adds an arbitrary endpoint to the root servlet.
-   * This can be used to include convenience links, or references to endpoints served by
-   * a different servlet container under this HTTP server.
-   *
-   * @param path The URI path of the endpoint.
-   */
-  void registerIndexLink(String path);
-
-  /**
-   * Registers a URI handler, replacing the existing handler if it exists.
-   *
-   * @param path       The URI path that the handler should be called for.
-   * @param handler    The handler to call.
-   * @param initParams An optional map of servlet init parameter names and their values.
-   * @param silent     Whether to display the registered handler in the root "/" response.
-   *                   Useful for handlers that you want to avoid accidental clicks on.
-   */
-  void registerHandler(String path, HttpServlet handler,
-                       @Nullable Map<String, String> initParams, boolean silent);
-
-  /**
-   * Registers a servlet filter.
-   *
-   * @param filterClass Filter class to register.
-   * @param pathSpec Path spec that the filter should be activated on.
-   */
-  void registerFilter(Class<? extends Filter> filterClass, String pathSpec);
-
-  /**
-   * Registers a context listener.
-   *
-   * @param servletContextListener Listener to register.
-   */
-  void registerListener(ServletContextListener servletContextListener);
-
-  /**
-   * Registers a context attribute listener.
-   *
-   * @param servletContextAttributeListener Listener to register.
-   */
-  void registerListener(ServletContextAttributeListener servletContextAttributeListener);
-
-  /**
-   * Registers a request listener.
-   *
-   * @param servletRequestListener Listener to register.
-   */
-  void registerListener(ServletRequestListener servletRequestListener);
-
-  /**
-   * Registers a request attribute listener.
-   *
-   * @param servletRequestAttributeListener Listener to register.
-   */
-  void registerListener(ServletRequestAttributeListener servletRequestAttributeListener);
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/net/http/JettyHttpServerDispatch.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/net/http/JettyHttpServerDispatch.java b/commons/src/main/java/org/apache/aurora/common/net/http/JettyHttpServerDispatch.java
deleted file mode 100644
index a3fa57e..0000000
--- a/commons/src/main/java/org/apache/aurora/common/net/http/JettyHttpServerDispatch.java
+++ /dev/null
@@ -1,283 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net.http;
-
-import java.io.IOException;
-import java.util.EventListener;
-import java.util.List;
-import java.util.Map;
-import java.util.Random;
-import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.annotation.Nullable;
-import javax.servlet.Filter;
-import javax.servlet.ServletContextAttributeListener;
-import javax.servlet.ServletContextListener;
-import javax.servlet.ServletRequestAttributeListener;
-import javax.servlet.ServletRequestListener;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-
-import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Ordering;
-import com.google.common.collect.Sets;
-import com.google.inject.Inject;
-
-import org.apache.aurora.common.net.http.handlers.TextResponseHandler;
-import org.mortbay.jetty.AbstractConnector;
-import org.mortbay.jetty.Connector;
-import org.mortbay.jetty.Handler;
-import org.mortbay.jetty.RequestLog;
-import org.mortbay.jetty.Server;
-import org.mortbay.jetty.handler.RequestLogHandler;
-import org.mortbay.jetty.nio.SelectChannelConnector;
-import org.mortbay.jetty.servlet.Context;
-import org.mortbay.jetty.servlet.ServletHolder;
-
-import org.apache.aurora.common.base.MorePreconditions;
-
-/**
- * A simple multi-threaded HTTP server dispatcher.  Supports registering handlers for different
- * URI paths, which will be called when a request is received.
- *
- * @author William Farner
- */
-public class JettyHttpServerDispatch implements HttpServerDispatch {
-  private static final Logger LOG = Logger.getLogger(JettyHttpServerDispatch.class.getName());
-
-  // Registered endpoints. Used only for display.
-  private final Set<String> registeredEndpoints = Sets.newHashSet();
-
-  private final Optional<RequestLog> requestLog;
-  private Server server;
-  private Context context;
-  private int port;
-
-  /**
-   * Creates an HTTP server.
-   */
-  public JettyHttpServerDispatch() {
-    this.requestLog = Optional.absent();
-  }
-
-  /**
-   * Creates an HTTP server which will be configured to log requests to the provided request log.
-   *
-   * @param requestLog HTTP request log.
-   */
-  @Inject
-  public JettyHttpServerDispatch(RequestLog requestLog) {
-    this.requestLog = Optional.of(requestLog);
-  }
-
-  /**
-   * Opens the HTTP server on the given port.
-   *
-   * @param port The port to listen on.
-   * @return {@code true} if the server started successfully on the port, {@code false} otherwise.
-   */
-  public boolean listen(int port) {
-    return listen(port, port);
-  }
-
-  @Override
-  public synchronized boolean listen(int minPort, int maxPort) {
-    boolean state = !isStarted();
-    Preconditions.checkState(state,
-        "HttpServerDispatch has already been started on port: %d", port);
-
-    Connector connector = openConnector(minPort, maxPort);
-    if (connector == null) return false; // Couldn't open a server port.
-    port = connector.getLocalPort();
-
-    server = new Server();
-    server.addConnector(connector);
-    context = new Context(server, "/", Context.NO_SESSIONS);
-    if (requestLog.isPresent()) {
-      RequestLogHandler logHandler = new RequestLogHandler();
-      logHandler.setRequestLog(requestLog.get());
-      context.addHandler(logHandler);
-    }
-
-    context.addServlet(new ServletHolder(new RootHandler()), "/");
-
-    try {
-      server.start();
-      LOG.info("HTTP server is listening on port " + port);
-      return true;
-    } catch (Exception e) {
-      LOG.log(Level.SEVERE, "HTTP server failed to start on port " + connector.getLocalPort(), e);
-      return false;
-    }
-  }
-
-  @Override
-  public synchronized boolean isStarted() {
-    return (server != null) && server.isStarted();
-  }
-
-  @Override
-  public synchronized int getPort() {
-    Preconditions.checkState(isStarted(), "HttpServer must be started before port can be determined");
-    return port;
-  }
-
-  /**
-   * Opens a new Connector which is a Jetty specific way of handling the
-   * lifecycle and configuration of the Jetty server. The connector will
-   * open a Socket on an available port between minPort and maxPort.
-   * A subclass can override this method to modify connector configurations
-   * such as queue-size or header-buffer-size.
-   * @param minPort the minimum port number to bind to.
-   * @param maxPort the maximum port number to bind to.
-   * @return
-   */
-  protected Connector openConnector(int minPort, int maxPort) {
-    if (minPort != 0 || maxPort != 0) {
-      Preconditions.checkState(minPort > 0, "Invalid port range.");
-      Preconditions.checkState(maxPort > 0, "Invalid port range.");
-      Preconditions.checkState(minPort <= maxPort, "Invalid port range.");
-    }
-    int attempts = 0;
-    int port;
-
-    int maxAttempts = minPort == maxPort ? 1 : 5;
-    while (++attempts <= maxAttempts) {
-      if (minPort == maxPort) {
-        port = minPort;
-      } else {
-        port = minPort + new Random().nextInt(maxPort - minPort);
-      }
-      LOG.info("Attempting to listen on port " + port);
-
-      try {
-        // TODO(John Sirois): consider making Connector impl parametrizable
-        AbstractConnector connector = new SelectChannelConnector();
-        connector.setPort(port);
-        // Create the server with a maximum TCP backlog of 50, meaning that when the request queue
-        // exceeds 50, subsequent connections may be rejected.
-        connector.setAcceptQueueSize(50);
-        connector.open();
-        return connector;
-      } catch (IOException e) {
-        LOG.log(Level.WARNING, "Failed to create HTTP server on port " + port, e);
-      }
-    }
-    return null;
-  }
-
-  @Override
-  public synchronized void stop() {
-    if (isStarted()) {
-      try {
-        server.stop();
-      } catch (Exception e) {
-        LOG.log(Level.SEVERE, "Error stopping HTTPServer on " + port, e);
-      }
-    }
-  }
-
-  @Override
-  public synchronized void registerHandler(
-      String path,
-      HttpServlet handler,
-      @Nullable Map<String, String> initParams,
-      boolean silent) {
-
-    Preconditions.checkNotNull(path);
-    Preconditions.checkNotNull(handler);
-    Preconditions.checkState(path.length() > 0);
-    Preconditions.checkState(path.charAt(0) == '/');
-
-    if (silent) {
-      registeredEndpoints.remove(path);
-    } else {
-      registeredEndpoints.add(path);
-    }
-
-    ServletHolder servletHolder = new ServletHolder(handler);
-    if (initParams != null) {
-      servletHolder.setInitParameters(initParams);
-    }
-    getRootContext().addServlet(servletHolder, path.replaceFirst("/?$", "/*"));
-  }
-
-  @Override
-  public synchronized void registerFilter(Class<? extends Filter> filterClass, String pathSpec) {
-    MorePreconditions.checkNotBlank(pathSpec);
-    Preconditions.checkNotNull(filterClass);
-    getRootContext().addFilter(filterClass, pathSpec, Handler.REQUEST);
-  }
-
-  @Override
-  public synchronized void registerIndexLink(String path) {
-    MorePreconditions.checkNotBlank(path);
-    registeredEndpoints.add(path);
-  }
-
-  @Override
-  public void registerListener(ServletContextListener servletContextListener) {
-    registerEventListener(servletContextListener);
-  }
-
-  @Override
-  public void registerListener(ServletContextAttributeListener servletContextAttributeListener) {
-    registerEventListener(servletContextAttributeListener);
-  }
-
-  @Override
-  public void registerListener(ServletRequestListener servletRequestListener) {
-    registerEventListener(servletRequestListener);
-  }
-
-  @Override
-  public void registerListener(ServletRequestAttributeListener servletRequestAttributeListener) {
-    registerEventListener(servletRequestAttributeListener);
-  }
-
-  private synchronized void registerEventListener(EventListener eventListener) {
-    Preconditions.checkNotNull(eventListener);
-    getRootContext().addEventListener(eventListener);
-  }
-
-  public synchronized Context getRootContext() {
-    Preconditions.checkState(context != null, "Context is not yet available. " +
-        "Ensure that listen(...) is called prior to calling this method.");
-    return context;
-  }
-
-  /**
-   * The root handler, which will display the paths at which all handlers are registered.
-   */
-  private class RootHandler extends TextResponseHandler {
-    public RootHandler() {
-      super("text/html");
-    }
-
-    @Override
-    public Iterable<String> getLines(HttpServletRequest request) {
-      List<String> lines = Lists.newArrayList();
-      lines.add("<html>");
-      for (String handler : Ordering.natural().sortedCopy(registeredEndpoints)) {
-        lines.add(String.format("<a href='%s'>%s</a><br />", handler, handler));
-      }
-      lines.add("</html>");
-      return lines;
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/net/http/RequestLogger.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/net/http/RequestLogger.java b/commons/src/main/java/org/apache/aurora/common/net/http/RequestLogger.java
deleted file mode 100644
index 8677880..0000000
--- a/commons/src/main/java/org/apache/aurora/common/net/http/RequestLogger.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net.http;
-
-import java.util.Locale;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import com.google.common.annotations.VisibleForTesting;
-
-import org.mortbay.component.AbstractLifeCycle;
-import org.mortbay.jetty.HttpHeaders;
-import org.mortbay.jetty.Request;
-import org.mortbay.jetty.RequestLog;
-import org.mortbay.jetty.Response;
-import org.mortbay.util.DateCache;
-
-import org.apache.aurora.common.util.Clock;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * A request logger that borrows formatting code from {@link org.mortbay.jetty.NCSARequestLog},
- * but removes unneeded features (writing to file) and logging to java.util.logging.
- */
-public class RequestLogger extends AbstractLifeCycle implements RequestLog {
-
-  private static final Logger LOG = Logger.getLogger(RequestLogger.class.getName());
-
-  private final Clock clock;
-  private final LogSink sink;
-  private final DateCache logDateCache;
-
-  interface LogSink {
-    boolean isLoggable(Level level);
-    void log(Level level, String messagge);
-  }
-
-  RequestLogger() {
-    this(Clock.SYSTEM_CLOCK, new LogSink() {
-      @Override
-      public boolean isLoggable(Level level) {
-        return LOG.isLoggable(level);
-      }
-
-      @Override public void log(Level level, String message) {
-        LOG.log(level, message);
-      }
-    });
-  }
-
-  @VisibleForTesting
-  RequestLogger(Clock clock, LogSink sink) {
-    this.clock = checkNotNull(clock);
-    this.sink = checkNotNull(sink);
-    logDateCache = new DateCache("dd/MMM/yyyy:HH:mm:ss Z", Locale.getDefault());
-    logDateCache.setTimeZoneID("GMT");
-  }
-
-  private String formatEntry(Request request, Response response) {
-    StringBuilder buf = new StringBuilder();
-
-    buf.append(request.getServerName());
-    buf.append(' ');
-
-    String addr = request.getHeader(HttpHeaders.X_FORWARDED_FOR);
-    if (addr == null) {
-      addr = request.getRemoteAddr();
-    }
-
-    buf.append(addr);
-    buf.append(" [");
-    buf.append(logDateCache.format(request.getTimeStamp()));
-    buf.append("] \"");
-    buf.append(request.getMethod());
-    buf.append(' ');
-    buf.append(request.getUri().toString());
-    buf.append(' ');
-    buf.append(request.getProtocol());
-    buf.append("\" ");
-    buf.append(response.getStatus());
-    buf.append(' ');
-    buf.append(response.getContentCount());
-    buf.append(' ');
-
-    String referer = request.getHeader(HttpHeaders.REFERER);
-    if (referer == null) {
-      buf.append("\"-\" ");
-    } else {
-      buf.append('"');
-      buf.append(referer);
-      buf.append("\" ");
-    }
-
-    String agent = request.getHeader(HttpHeaders.USER_AGENT);
-    if (agent == null) {
-      buf.append("\"-\" ");
-    } else {
-      buf.append('"');
-      buf.append(agent);
-      buf.append('"');
-    }
-
-    buf.append(' ');
-    buf.append(clock.nowMillis() - request.getTimeStamp());
-    return buf.toString();
-  }
-
-  @Override
-  public void log(Request request, Response response) {
-    int statusCategory = response.getStatus() / 100;
-    Level level = ((statusCategory == 2) || (statusCategory == 3)) ? Level.FINE : Level.INFO;
-    if (!sink.isLoggable(level)) {
-      return;
-    }
-
-    sink.log(level, formatEntry(request, response));
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/net/http/filters/AbstractHttpFilter.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/net/http/filters/AbstractHttpFilter.java b/commons/src/main/java/org/apache/aurora/common/net/http/filters/AbstractHttpFilter.java
deleted file mode 100644
index 681a95d..0000000
--- a/commons/src/main/java/org/apache/aurora/common/net/http/filters/AbstractHttpFilter.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net.http.filters;
-
-import java.io.IOException;
-
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * A filter that allows subclass to omit implementations of {@link #init(FilterConfig)} and
- * {@link #destroy()}.
- */
-public abstract class AbstractHttpFilter implements Filter {
-
-  @Override
-  public void init(FilterConfig filterConfig) throws ServletException {
-    // No-op by default.
-  }
-
-  @Override
-  public final void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
-      throws IOException, ServletException {
-    doFilter((HttpServletRequest) request, (HttpServletResponse) response, chain);
-  }
-
-  /**
-   * Convenience method to allow subclasses to avoid type casting that may be necessary when
-   * implementing {@link #doFilter(ServletRequest, ServletResponse, FilterChain)}.
-   *
-   * @param request HTTP request.
-   * @param response HTTP response.
-   * @param chain Filter chain.
-   * @throws IOException If there is an error reading the request or writing the response.
-   * @throws ServletException If the filter or chain encounters an error handling the request.
-   */
-  public abstract void doFilter(
-      HttpServletRequest request,
-      HttpServletResponse response,
-      FilterChain chain) throws IOException, ServletException;
-
-  @Override
-  public void destroy() {
-    // No-op by default.
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/net/http/filters/HttpStatsFilter.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/net/http/filters/HttpStatsFilter.java b/commons/src/main/java/org/apache/aurora/common/net/http/filters/HttpStatsFilter.java
deleted file mode 100644
index 493018a..0000000
--- a/commons/src/main/java/org/apache/aurora/common/net/http/filters/HttpStatsFilter.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net.http.filters;
-
-import java.io.IOException;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import java.lang.reflect.Method;
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.logging.Logger;
-
-import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.ws.rs.core.Context;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
-import com.google.common.cache.CacheBuilder;
-import com.google.common.cache.CacheLoader;
-import com.google.common.cache.LoadingCache;
-import com.google.inject.Inject;
-import com.sun.jersey.api.core.ExtendedUriInfo;
-import com.sun.jersey.api.model.AbstractResourceMethod;
-import com.sun.jersey.spi.container.ContainerRequest;
-import com.sun.jersey.spi.container.ContainerResponse;
-import com.sun.jersey.spi.container.ContainerResponseFilter;
-
-import org.apache.aurora.common.collections.Pair;
-import org.apache.aurora.common.stats.SlidingStats;
-import org.apache.aurora.common.stats.Stats;
-import org.apache.aurora.common.util.Clock;
-
-/**
- * An HTTP filter that exports counts and timing for requests based on response code.
- */
-public class HttpStatsFilter extends AbstractHttpFilter implements ContainerResponseFilter {
-  /**
-   * Methods tagged with this annotation will be intercepted and stats will be tracked accordingly.
-   */
-  @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD)
-  public @interface TrackRequestStats {
-    /**
-     * Indicates the identifier to use when tracking requests with this annotation.
-     */
-    String value();
-  }
-
-  private static final Logger LOG = Logger.getLogger(HttpStatsFilter.class.getName());
-
-  @VisibleForTesting
-  static final String REQUEST_START_TIME = "request_start_time";
-
-  private final Clock clock;
-  @Context private ExtendedUriInfo extendedUriInfo;
-
-  @VisibleForTesting
-  final LoadingCache<Pair<String, Integer>, SlidingStats> requestCounters =
-      CacheBuilder.newBuilder()
-          .build(new CacheLoader<Pair<String, Integer>, SlidingStats>() {
-            @Override
-            public SlidingStats load(Pair<String, Integer> identifierAndStatus) {
-              return new SlidingStats("http_" + identifierAndStatus.getFirst() + "_"
-                  + identifierAndStatus.getSecond() + "_responses", "nanos");
-            }
-          });
-
-  @Context private HttpServletRequest servletRequest;
-
-  @VisibleForTesting
-  final LoadingCache<Integer, SlidingStats> statusCounters = CacheBuilder.newBuilder()
-      .build(new CacheLoader<Integer, SlidingStats>() {
-        @Override
-        public SlidingStats load(Integer status) {
-          return new SlidingStats("http_" + status + "_responses", "nanos");
-        }
-      });
-
-  @VisibleForTesting
-  final AtomicLong exceptionCount = Stats.exportLong("http_request_exceptions");
-
-  @Inject
-  public HttpStatsFilter(Clock clock) {
-    this.clock = Preconditions.checkNotNull(clock);
-  }
-
-  private void trackStats(int status) {
-    long endTime = clock.nowNanos();
-
-    Object startTimeAttribute = servletRequest.getAttribute(REQUEST_START_TIME);
-    if (startTimeAttribute == null) {
-      LOG.fine("No start time attribute was found on the request, this filter should be wired"
-          + " as both a servlet filter and a container filter.");
-      return;
-    }
-
-    long elapsed = endTime - ((Long) startTimeAttribute).longValue();
-    statusCounters.getUnchecked(status).accumulate(elapsed);
-
-    AbstractResourceMethod matchedMethod =  extendedUriInfo.getMatchedMethod();
-    // It's possible for no method to have matched, e.g. in the case of a 404, don't let those
-    // cases lead to an exception and a 500 response.
-    if (matchedMethod == null) {
-      return;
-    }
-
-    TrackRequestStats trackRequestStats = matchedMethod.getAnnotation(TrackRequestStats.class);
-
-    if (trackRequestStats == null) {
-      Method method = matchedMethod.getMethod();
-      LOG.fine("The method that handled this request (" + method.getDeclaringClass() + "#"
-          + method.getName() + ") is not annotated with " + TrackRequestStats.class.getSimpleName()
-          + ". No request stats will recorded.");
-      return;
-    }
-
-    requestCounters.getUnchecked(Pair.of(trackRequestStats.value(), status)).accumulate(elapsed);
-  }
-
-  @Override
-  public ContainerResponse filter(ContainerRequest request, ContainerResponse response) {
-    trackStats(response.getStatus());
-
-    return response;
-  }
-
-  @Override
-  public void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
-      throws IOException, ServletException {
-
-    long startTime = clock.nowNanos();
-    request.setAttribute(REQUEST_START_TIME, startTime);
-
-    try {
-      chain.doFilter(request, response);
-    } catch (IOException e) {
-      exceptionCount.incrementAndGet();
-      throw e;
-    } catch (ServletException e) {
-      exceptionCount.incrementAndGet();
-      throw e;
-    }
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/net/http/handlers/ThriftServlet.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/net/http/handlers/ThriftServlet.java b/commons/src/main/java/org/apache/aurora/common/net/http/handlers/ThriftServlet.java
deleted file mode 100644
index 540ab69..0000000
--- a/commons/src/main/java/org/apache/aurora/common/net/http/handlers/ThriftServlet.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net.http.handlers;
-
-import com.google.common.base.Preconditions;
-import com.google.inject.Inject;
-import com.google.inject.name.Named;
-import org.apache.aurora.common.base.Closure;
-import org.apache.aurora.common.net.monitoring.TrafficMonitor;
-import org.antlr.stringtemplate.StringTemplate;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.util.Set;
-
-/**
- * Servlet to display live information about registered thrift clients and servers.
- *
- * @author William Farner
- */
-public class ThriftServlet extends StringTemplateServlet {
-
-  /**
-   * {@literal @Named} binding key for client monitor.
-   */
-  public static final String THRIFT_CLIENT_MONITORS =
-      "com.twitter.common.net.http.handlers.ThriftServlet.THRIFT_CLIENT_MONITORS";
-
-  /**
-   * {@literal @Named} binding key for server monitor.
-   */
-  public static final String THRIFT_SERVER_MONITORS =
-      "com.twitter.common.net.http.handlers.ThriftServlet.THRIFT_SERVER_MONITORS";
-
-  private Set<TrafficMonitor> clientMonitors;
-  private Set<TrafficMonitor> serverMonitors;
-
-  @Inject
-  public ThriftServlet(
-      @Named(ThriftServlet.THRIFT_CLIENT_MONITORS) Set<TrafficMonitor> clientMonitors,
-      @Named(ThriftServlet.THRIFT_SERVER_MONITORS) Set<TrafficMonitor> serverMonitors) {
-    super("thrift", true);
-    this.clientMonitors = Preconditions.checkNotNull(clientMonitors);
-    this.serverMonitors = Preconditions.checkNotNull(serverMonitors);
-  }
-
-  @Override
-  protected void doGet(HttpServletRequest req, HttpServletResponse resp)
-      throws ServletException, IOException {
-    writeTemplate(resp, new Closure<StringTemplate>() {
-      @Override public void execute(StringTemplate template) {
-        template.setAttribute("clientMonitors", clientMonitors);
-        template.setAttribute("serverMonitors", serverMonitors);
-      }
-    });
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/LeastConnectedStrategy.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/LeastConnectedStrategy.java b/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/LeastConnectedStrategy.java
deleted file mode 100644
index e0beb25..0000000
--- a/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/LeastConnectedStrategy.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net.loadbalancing;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
-import java.util.SortedSet;
-import java.util.logging.Logger;
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
-
-import org.apache.aurora.common.net.pool.ResourceExhaustedException;
-
-/**
- * A load balancer that attempts to direct load towards a backend that has the fewest leased
- * connections.
- *
- * @author William Farner
- */
-public class LeastConnectedStrategy<S> extends StaticLoadBalancingStrategy<S> {
-  private static final Logger LOG = Logger.getLogger(LeastConnectedStrategy.class.getName());
-
-  // Maps from backends to the number of connections made to them.
-  private final Map<S, ConnectionStats> connections = Maps.newHashMap();
-
-  // Manages sorting of connection counts, with a reference back to the backend.
-  private final SortedSet<ConnectionStats> connectionStats = Sets.newTreeSet();
-
-  /**
-   * Encapsulates a set of connection stats that allow connections to be sorted as per the least
-   * connected strategy.
-   */
-  private class ConnectionStats implements Comparable<ConnectionStats> {
-    final S connectionKey;
-    final int connectionId;
-    int activeCount = 0; // Stores the total number of active connections.
-    long useCount = 0;  // Stores the total number times a connection has been used.
-
-    ConnectionStats(S connectionKey, int connectionId) {
-      this.connectionKey = connectionKey;
-      this.connectionId = connectionId;
-    }
-
-    @Override
-    public int compareTo(ConnectionStats other) {
-      // Sort by number of active connections first.
-      int difference = activeCount - other.activeCount;
-      if (difference != 0) {
-        return difference;
-      }
-
-      // Sub-sort by total number of times a connection has been used (this will ensure that
-      // all backends are exercised).
-      long useDifference = useCount - other.useCount;
-      if (useDifference != 0) {
-        return Long.signum(useDifference);
-      }
-
-      // If the above two are equal, break the tie using the connection id.
-      return connectionId - other.connectionId;
-    }
-
-    @Override
-    public boolean equals(Object o) {
-      // We use ConnectionStats in a sorted container and so we need to have an equals
-      // implementation consistent with compareTo, ie:
-      // (x.compareTo(y) == 0) == x.equals(y)
-      // We accomplish this directly.
-
-      @SuppressWarnings("unchecked")
-      ConnectionStats other = (ConnectionStats) o;
-      return compareTo(other) == 0;
-    }
-
-    @Override
-    public String toString() {
-      return String.format("%d-%d", activeCount, useCount);
-    }
-  }
-
-  @Override
-  protected Collection<S> onBackendsOffered(Set<S> backends) {
-    Map<S, ConnectionStats> newConnections = Maps.newHashMapWithExpectedSize(backends.size());
-    Collection<ConnectionStats> newConnectionStats =
-        Lists.newArrayListWithCapacity(backends.size());
-
-    // Recreate all connection stats since their ordering may have changed and this is used for
-    // comparison tie breaks.
-    int backendId = 0;
-    for (S backend : backends) {
-      ConnectionStats stats = new ConnectionStats(backend, backendId++);
-
-      // Retain the activeCount for existing backends to prevent dogpiling existing active servers
-      ConnectionStats existing = connections.get(backend);
-      if (existing != null) {
-        stats.activeCount = existing.activeCount;
-      }
-
-      newConnections.put(backend, stats);
-      newConnectionStats.add(stats);
-    }
-
-    connections.clear();
-    connections.putAll(newConnections);
-    connectionStats.clear();
-    connectionStats.addAll(newConnectionStats);
-
-    return connections.keySet();
-  }
-
-  @Override
-  public S nextBackend() throws ResourceExhaustedException {
-    Preconditions.checkState(connections.size() == connectionStats.size());
-
-    if (connectionStats.isEmpty()) {
-      throw new ResourceExhaustedException("No backends.");
-    }
-
-    return connectionStats.first().connectionKey;
-  }
-
-  @Override
-  public void addConnectResult(S backendKey, ConnectionResult result, long connectTimeNanos) {
-    Preconditions.checkNotNull(backendKey);
-    Preconditions.checkState(connections.size() == connectionStats.size());
-    Preconditions.checkNotNull(result);
-
-    ConnectionStats stats = connections.get(backendKey);
-    Preconditions.checkNotNull(stats);
-
-    Preconditions.checkState(connectionStats.remove(stats));
-    if (result == ConnectionResult.SUCCESS) {
-      stats.activeCount++;
-    }
-    stats.useCount++;
-    Preconditions.checkState(connectionStats.add(stats));
-  }
-
-  @Override
-  public void connectionReturned(S backendKey) {
-    Preconditions.checkNotNull(backendKey);
-    Preconditions.checkState(connections.size() == connectionStats.size());
-
-    ConnectionStats stats = connections.get(backendKey);
-    Preconditions.checkNotNull(stats);
-
-    if (stats.activeCount > 0) {
-      Preconditions.checkState(connectionStats.remove(stats));
-      stats.activeCount--;
-      Preconditions.checkState(connectionStats.add(stats));
-    } else {
-      LOG.warning("connection stats dropped below zero, ignoring");
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/LoadBalancer.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/LoadBalancer.java b/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/LoadBalancer.java
deleted file mode 100644
index b15137d..0000000
--- a/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/LoadBalancer.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net.loadbalancing;
-
-import org.apache.aurora.common.base.Closure;
-import org.apache.aurora.common.net.pool.ResourceExhaustedException;
-import org.apache.aurora.common.net.loadbalancing.LoadBalancingStrategy.ConnectionResult;
-
-import java.util.Collection;
-import java.util.Set;
-
-/**
- * A load balancer, which will be used to determine which of a set of backends should be connected
- * to for service calls.  It is expected that the backends themselves can be changed at any time,
- * and the load balancer should immediately restrict itself to using only those backends.
- *
- * It is likely that the load balancer implementation will periodically receive information about
- * backends that it technically should no longer know about.  An example is calls to
- * {@link #requestResult(Object, RequestResult, long)} and {@link #released(Object)} for
- * in-flight requests after backends were changed by {@link #offerBackends(Set, Closure)}.
- *
- * @author William Farner
- */
-public interface LoadBalancer<K> extends RequestTracker<K> {
-
-  /**
-   * Offers a set of backends that the load balancer should choose from to distribute load amongst.
-   *
-   * @param offeredBackends Backends to choose from.
-   * @param onBackendsChosen A callback that should be notified when the offered backends have been
-   *     (re)chosen from.
-   */
-  void offerBackends(Set<K> offeredBackends, Closure<Collection<K>> onBackendsChosen);
-
-  /**
-   * Gets the next backend that a request should be sent to.
-   *
-   * @return Next backend to send a request.
-   * @throws ResourceExhaustedException If there are no available backends.
-   */
-  K nextBackend() throws ResourceExhaustedException;
-
-  /**
-   * Signals the load balancer that a connection was made.
-   *
-   * @param backend The backend that was connected to.
-   * @param connectTimeNanos The time spent waiting for the connection to be established.
-   */
-  void connected(K backend, long connectTimeNanos);
-
-  /**
-   * Signals the load balancer that a connection was attempted, but failed.
-   *
-   * @param backend The backend to which connection attempt was made.
-   * @param result The result of the connection attempt (only FAILED and TIMEOUT are permitted).
-   */
-  void connectFailed(K backend, ConnectionResult result);
-
-  /**
-   * Signals the load balancer that a connection was released, and is idle.
-   *
-   * @param connection Idle connection.
-   */
-  void released(K connection);
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/LoadBalancerImpl.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/LoadBalancerImpl.java b/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/LoadBalancerImpl.java
deleted file mode 100644
index 30e77c9..0000000
--- a/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/LoadBalancerImpl.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net.loadbalancing;
-
-import java.util.Collection;
-import java.util.Set;
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableSet;
-
-import org.apache.aurora.common.base.Closure;
-import org.apache.aurora.common.net.loadbalancing.LoadBalancingStrategy.ConnectionResult;
-import org.apache.aurora.common.net.pool.ResourceExhaustedException;
-
-/**
- * Implementation of a load balancer, that uses a pluggable {@link LoadBalancingStrategy} to define
- * actual load balancing behavior.  This class handles the responsibility of associating connections
- * with backends.
- *
- * Calls to {@link #connected(Object, long)},
- * {@link #requestResult(Object, RequestResult, long)}, and {@link #released(Object)} will not
- * be forwarded for unknown backends/connections.
- *
- * @author William Farner
- */
-public class LoadBalancerImpl<K> implements LoadBalancer<K> {
-
-  private final LoadBalancingStrategy<K> strategy;
-
-  private Set<K> offeredBackends = ImmutableSet.of();
-
-  /**
-   * Creates a new load balancer that will use the given strategy.
-   *
-   * @param strategy Strategy to delegate load balancing work to.
-   */
-  public LoadBalancerImpl(LoadBalancingStrategy<K> strategy) {
-    this.strategy = Preconditions.checkNotNull(strategy);
-  }
-
-  @Override
-  public synchronized void offerBackends(Set<K> offeredBackends,
-      final Closure<Collection<K>> onBackendsChosen) {
-    this.offeredBackends = ImmutableSet.copyOf(offeredBackends);
-    strategy.offerBackends(offeredBackends, new Closure<Collection<K>>() {
-      @Override public void execute(Collection<K> chosenBackends) {
-        onBackendsChosen.execute(chosenBackends);
-      }
-    });
-  }
-
-  @Override
-  public synchronized K nextBackend() throws ResourceExhaustedException {
-    return strategy.nextBackend();
-  }
-
-  @Override
-  public synchronized void connected(K backend, long connectTimeNanos) {
-    Preconditions.checkNotNull(backend);
-
-    if (!hasBackend(backend)) return;
-
-    strategy.addConnectResult(backend, ConnectionResult.SUCCESS, connectTimeNanos);
-  }
-
-  private boolean hasBackend(K backend) {
-    return offeredBackends.contains(backend);
-  }
-
-  @Override
-  public synchronized void connectFailed(K backend, ConnectionResult result) {
-    Preconditions.checkNotNull(backend);
-    Preconditions.checkNotNull(result);
-    Preconditions.checkArgument(result != ConnectionResult.SUCCESS);
-
-    if (!hasBackend(backend)) return;
-
-    strategy.addConnectResult(backend, result, 0);
-  }
-
-  @Override
-  public synchronized void released(K backend) {
-    Preconditions.checkNotNull(backend);
-
-    if (!hasBackend(backend)) return;
-
-    strategy.connectionReturned(backend);
-  }
-
-  @Override
-  public synchronized void requestResult(K backend, RequestResult result, long requestTimeNanos) {
-    Preconditions.checkNotNull(backend);
-    Preconditions.checkNotNull(result);
-
-    if (!hasBackend(backend)) return;
-
-    strategy.addRequestResult(backend, result, requestTimeNanos);
-  }
-
-  /**
-   * Convenience method to create a new load balancer.
-   *
-   * @param strategy Strategy to use.
-   * @param <K> Backend type.
-   * @return A new load balancer.
-   */
-  public static <K> LoadBalancerImpl<K>
-      create(LoadBalancingStrategy<K> strategy) {
-    return new LoadBalancerImpl<K>(strategy);
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/LoadBalancingStrategy.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/LoadBalancingStrategy.java b/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/LoadBalancingStrategy.java
deleted file mode 100644
index 7f33416..0000000
--- a/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/LoadBalancingStrategy.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net.loadbalancing;
-
-import org.apache.aurora.common.base.Closure;
-import org.apache.aurora.common.net.pool.ResourceExhaustedException;
-
-import java.util.Collection;
-import java.util.Set;
-
-/**
- * A strategy for balancing request load among backends.
- *
- * Strategies should be externally synchronized, and therefore do not have to worry about reentrant
- * access.
- *
- * @author William Farner
- */
-public interface LoadBalancingStrategy<K> {
-
-  /**
-   * Offers a set of backends that the load balancer should choose from to distribute load amongst.
-   *
-   * @param offeredBackends Backends to choose from.
-   * @param onBackendsChosen A callback that should be notified when the offered backends have been
-   *     (re)chosen from.
-   */
-  public void offerBackends(Set<K> offeredBackends, Closure<Collection<K>> onBackendsChosen);
-
-  /**
-   * Gets the next backend that a request should be sent to.
-   *
-   * @return Next backend to send a request.
-   * @throws ResourceExhaustedException If there are no available backends.
-   */
-  public K nextBackend() throws ResourceExhaustedException;
-
-  /**
-   * Offers information about a connection result.
-   *
-   * @param key Backend key.
-   * @param result Connection result.
-   * @param connectTimeNanos Time spent waiting for connection to be established.
-   */
-  public void addConnectResult(K key, ConnectionResult result, long connectTimeNanos);
-
-  /**
-   * Offers information about a connection that was returned.
-   *
-   * @param key Backend key.
-   */
-  public void connectionReturned(K key);
-
-  /**
-   * Offers information about a request result.
-   *
-   * @param key Backend key.
-   * @param result Request result.
-   * @param requestTimeNanos Time spent waiting for a connection to be established.
-   */
-  public void addRequestResult(K key, RequestTracker.RequestResult result, long requestTimeNanos);
-
-  enum ConnectionResult {
-    FAILED,
-    TIMEOUT,
-    SUCCESS
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/MarkDeadStrategy.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/MarkDeadStrategy.java b/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/MarkDeadStrategy.java
deleted file mode 100644
index 05a4056..0000000
--- a/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/MarkDeadStrategy.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net.loadbalancing;
-
-import com.google.common.base.Function;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Predicate;
-import com.google.common.base.Predicates;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
-import org.apache.aurora.common.base.Closure;
-import org.apache.aurora.common.net.pool.ResourceExhaustedException;
-import org.apache.aurora.common.net.loadbalancing.RequestTracker.RequestResult;
-import org.apache.aurora.common.util.BackoffDecider;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
-import java.util.logging.Logger;
-
-/**
- * A load balancer that serves as a layer above another load balancer to mark hosts as dead, and
- * prevent them from being visible to the wrapped load balancer.
- * If all backends become marked as dead, they will all be unmarked.
- *
- * @author William Farner
- */
-public class MarkDeadStrategy<S> implements LoadBalancingStrategy<S> {
-  private static final Logger LOG = Logger.getLogger(MarkDeadStrategy.class.getName());
-
-  private final LoadBalancingStrategy<S> wrappedStrategy;
-  private final Map<S, BackoffDecider> targets = Maps.newHashMap();
-  private final Function<S, BackoffDecider> backoffFactory;
-  protected final Predicate<S> hostChecker;
-
-  private Set<S> liveBackends = null;
-  private Closure<Collection<S>> onBackendsChosen = null;
-
-  // Flipped when we are in "forced live" mode, where all backends are considered dead and we
-  // send them all traffic as a last-ditch effort.
-  private boolean forcedLive = false;
-
-  /**
-   * Creates a mark dead strategy with a wrapped strategy, backoff decider factory
-   * and a predicate host checker. Use this constructor if you want to pass in the
-   * your own implementation of the host checker.
-   *
-   * @param wrappedStrategy one of the implementations of the load balancing strategy.
-   * @param backoffFactory backoff decider factory per host.
-   * @param hostChecker predicate that returns {@code true} if the host is alive, otherwise returns {@code false}.
-   */
-  public MarkDeadStrategy(LoadBalancingStrategy<S> wrappedStrategy,
-      Function<S, BackoffDecider> backoffFactory, Predicate<S> hostChecker) {
-    this.wrappedStrategy = Preconditions.checkNotNull(wrappedStrategy);
-    this.backoffFactory = Preconditions.checkNotNull(backoffFactory);
-    this.hostChecker = Preconditions.checkNotNull(hostChecker);
-  }
-
-  /**
-   * Constructor that uses a default predicate host checker that always returns true.
-   * This is the default constructor that all consumers of MarkDeadStrategy currently use.
-   *
-   * @param wrappedStrategy one of the implementations of the load balancing strategy.
-   * @param backoffFactory backoff decider factory per host.
-   */
-  public MarkDeadStrategy(LoadBalancingStrategy<S> wrappedStrategy,
-      Function<S, BackoffDecider> backoffFactory) {
-    this(wrappedStrategy, backoffFactory, Predicates.<S>alwaysTrue());
-  }
-
-  @Override
-  public void offerBackends(Set<S> offeredBackends, Closure<Collection<S>> onBackendsChosen) {
-    this.onBackendsChosen = onBackendsChosen;
-    targets.keySet().retainAll(offeredBackends);
-    for (S backend : offeredBackends) {
-      if (!targets.containsKey(backend)) {
-        targets.put(backend, backoffFactory.apply(backend));
-      }
-    }
-
-    adjustBackends();
-  }
-
-  @Override
-  public void addConnectResult(S backendKey, ConnectionResult result, long connectTimeNanos) {
-    Preconditions.checkNotNull(backendKey);
-    Preconditions.checkNotNull(result);
-
-    BackoffDecider decider = targets.get(backendKey);
-    Preconditions.checkNotNull(decider);
-
-    addResult(decider, result);
-    if (shouldNotifyFor(backendKey)) {
-      wrappedStrategy.addConnectResult(backendKey, result, connectTimeNanos);
-    }
-  }
-
-  @Override
-  public void connectionReturned(S backendKey) {
-    Preconditions.checkNotNull(backendKey);
-
-    if (shouldNotifyFor(backendKey)) {
-      wrappedStrategy.connectionReturned(backendKey);
-    }
-  }
-
-  @Override
-  public void addRequestResult(S requestKey, RequestResult result,
-      long requestTimeNanos) {
-    Preconditions.checkNotNull(requestKey);
-    Preconditions.checkNotNull(result);
-
-    BackoffDecider decider = targets.get(requestKey);
-    Preconditions.checkNotNull(decider);
-
-    addResult(decider, result);
-    if (shouldNotifyFor(requestKey)) {
-      wrappedStrategy.addRequestResult(requestKey, result, requestTimeNanos);
-    }
-  }
-
-  private void addResult(BackoffDecider decider, ConnectionResult result) {
-    switch (result) {
-      case FAILED:
-      case TIMEOUT:
-        addResult(decider, false);
-        break;
-      case SUCCESS:
-        addResult(decider, true);
-        break;
-      default:
-        throw new UnsupportedOperationException("Unhandled result type " + result);
-    }
-  }
-
-  private void addResult(BackoffDecider decider, RequestTracker.RequestResult result) {
-    switch (result) {
-      case FAILED:
-      case TIMEOUT:
-        addResult(decider, false);
-        break;
-      case SUCCESS:
-        addResult(decider, true);
-        break;
-      default:
-        throw new UnsupportedOperationException("Unhandled result type " + result);
-    }
-  }
-
-  private void addResult(BackoffDecider decider, boolean success) {
-    if (success) {
-      decider.addSuccess();
-    } else {
-      decider.addFailure();
-    }
-
-    // Check if any of the backends have moved into or out of dead state.
-    for (Map.Entry<S, BackoffDecider> entry : targets.entrySet()) {
-      boolean dead = entry.getValue().shouldBackOff();
-      boolean markedDead = !liveBackends.contains(entry.getKey());
-
-      // only check the servers that were marked dead before and see if we can
-      // connect to them, otherwise set dead to true.
-      if (markedDead && !dead) {
-        boolean alive = hostChecker.apply(entry.getKey());
-        if (!alive) {
-          entry.getValue().transitionToBackOff(0, true);
-        }
-        dead = !alive;
-      }
-
-      if (dead && !markedDead && forcedLive) {
-        // Do nothing here.  Since we have forced all backends to be live, we don't want to
-        // continually advertise the backend list to the wrapped strategy.
-      } else if (dead != markedDead || !dead && forcedLive) {
-        adjustBackends();
-        break;
-      }
-    }
-  }
-
-  private boolean shouldNotifyFor(S backend) {
-    return liveBackends.contains(backend);
-  }
-
-  private final Predicate<S> deadTargetFilter = new Predicate<S>() {
-      @Override public boolean apply(S backend) {
-        return !targets.get(backend).shouldBackOff();
-      }
-    };
-
-  private void adjustBackends() {
-    liveBackends = Sets.newHashSet(Iterables.filter(targets.keySet(), deadTargetFilter));
-    if (liveBackends.isEmpty()) {
-      liveBackends = targets.keySet();
-      forcedLive = true;
-    } else {
-      forcedLive = false;
-    }
-    LOG.info("Observed backend state change, changing live backends to " + liveBackends);
-    wrappedStrategy.offerBackends(liveBackends, onBackendsChosen);
-  }
-
-  @Override
-  public S nextBackend() throws ResourceExhaustedException {
-    return wrappedStrategy.nextBackend();
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/MarkDeadStrategyWithHostCheck.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/MarkDeadStrategyWithHostCheck.java b/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/MarkDeadStrategyWithHostCheck.java
deleted file mode 100644
index 8170167..0000000
--- a/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/MarkDeadStrategyWithHostCheck.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net.loadbalancing;
-
-import java.util.Map;
-
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-import com.google.common.collect.Maps;
-
-import org.apache.aurora.common.util.BackoffDecider;
-
-/**
- * A load balancing strategy that extends the functionality of the mark dead strategy by
- * integrating a hostChecker that allows hosts to transition out of a dead state
- * if the most recent connection to the host was successful.
- *
- * @param <S> typically socket address of a backend host.
- * @author Krishna Gade
- */
-public class MarkDeadStrategyWithHostCheck<S> extends MarkDeadStrategy<S> {
-
-  /**
-   * LiveHostChecker implements Filter to determine whether a host is alive based on the
-   * result of the most recent connection attempt to that host. It keeps a map of
-   * backend -> last connection result, which gets updated every time someone tries to
-   * add to connection result.
-   */
-  protected static class LiveHostChecker<S> implements Predicate<S> {
-    private final Map<S, ConnectionResult> lastConnectionResult = Maps.newHashMap();
-
-    /**
-     * Adds the connection result of this backend to the last connection result map.
-     *
-     * @param backend typically the socket address of the backend.
-     * @param result result of what happened when the client tried to connect to this backend.
-     */
-    public void addConnectResult(S backend, ConnectionResult result) {
-      lastConnectionResult.put(backend, result);
-    }
-
-    /**
-     * Checks if the last connection result for this backend and returns {@code true} if it
-     * was {@link LoadBalancingStrategy.ConnectionResult#SUCCESS} otherwise returns {@code false}.
-     *
-     * @param backend typically the socket address of the backend.
-     */
-    @Override public boolean apply(S backend) {
-      ConnectionResult result = lastConnectionResult.get(backend);
-      return result != null && result == ConnectionResult.SUCCESS;
-    }
-  }
-
-  // Reference to the host checker we pass to the super class.
-  // We keep it here to avoid casting on every access to it.
-  protected final LiveHostChecker<S> liveHostChecker;
-
-  /**
-   * Creates a mark dead strategy with the given wrapped strategy and backoff decider factory.
-   * It uses a hostChecker {@link Predicate} that allows hosts to transition out
-   * of a dead state if the most recent connection to the host was successful.
-   *
-   * @param wrappedStrategy one of the implementations of the load balancing strategy.
-   * @param backoffFactory backoff decider factory per host.
-   */
-  public MarkDeadStrategyWithHostCheck(LoadBalancingStrategy<S> wrappedStrategy,
-      Function<S, BackoffDecider> backoffFactory) {
-    super(wrappedStrategy, backoffFactory, new LiveHostChecker<S>());
-    // Casting to LiveHostChecker is safe here as that's the only predicate that we pass to super.
-    this.liveHostChecker = ((LiveHostChecker<S>) hostChecker);
-  }
-
-
-  /**
-   * Overrides the base class implementation by adding this connection result to the
-   * host checker.
-   *
-   * @param backendKey typically the socket address of the backend.
-   * @param result result of what happened when the client tried to connect to this backend.
-   * @param connectTimeNanos time took to connect to the backend in nano seconds.
-   */
-  @Override
-  public void addConnectResult(S backendKey, ConnectionResult result, long connectTimeNanos) {
-    liveHostChecker.addConnectResult(backendKey, result);
-    super.addConnectResult(backendKey, result, connectTimeNanos);
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/RandomStrategy.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/RandomStrategy.java b/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/RandomStrategy.java
deleted file mode 100644
index a8da980..0000000
--- a/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/RandomStrategy.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net.loadbalancing;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Lists;
-import org.apache.aurora.common.net.pool.ResourceExhaustedException;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Random;
-import java.util.Set;
-
-/**
- * A load balancer that selects a random backend each time a request is made..
- *
- * @author William Farner
- */
-public class RandomStrategy<S> extends StaticLoadBalancingStrategy<S> {
-
-  private List<S> targets = Lists.newArrayList();
-  private final Random random;
-
-  public RandomStrategy() {
-    this(new Random());
-  }
-
-  @VisibleForTesting
-  RandomStrategy(Random random) {
-    this.random = Preconditions.checkNotNull(random);
-  }
-
-  @Override
-  protected Collection<S> onBackendsOffered(Set<S> targets) {
-    this.targets = ImmutableList.copyOf(targets);
-    return this.targets;
-  }
-
-  @Override
-  public S nextBackend() throws ResourceExhaustedException {
-    if (targets.isEmpty()) throw new ResourceExhaustedException("No backends.");
-    return targets.get(random.nextInt(targets.size()));
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/RequestTracker.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/RequestTracker.java b/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/RequestTracker.java
deleted file mode 100644
index 745e2f8..0000000
--- a/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/RequestTracker.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net.loadbalancing;
-
-/**
- * Tracks requests made to a backend service.
- *
- * @author William Farner
- */
-public interface RequestTracker<T> {
-
-  /**
-   * Informs the tracker of a completed request.
-   *
-   * @param key Key to identify the owner of the request.
-   * @param result Result of the request.
-   * @param requestTimeNanos Time duration spent waiting for the request to complete.
-   */
-  void requestResult(T key, RequestResult result, long requestTimeNanos);
-
-  enum RequestResult {
-    FAILED,
-    TIMEOUT,
-    SUCCESS
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/RoundRobinStrategy.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/RoundRobinStrategy.java b/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/RoundRobinStrategy.java
deleted file mode 100644
index 5678331..0000000
--- a/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/RoundRobinStrategy.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net.loadbalancing;
-
-import com.google.common.collect.Iterators;
-import com.google.common.collect.Lists;
-import org.apache.aurora.common.net.pool.ResourceExhaustedException;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-/**
- * A load balancer that distributes load by randomizing the list of available backends, and then
- * rotating through them evenly.
- *
- * @author William Farner
- */
-public class RoundRobinStrategy<S> extends StaticLoadBalancingStrategy<S> {
-
-  private Iterator<S> iterator = Iterators.emptyIterator();
-
-  @Override
-  protected Collection<S> onBackendsOffered(Set<S> targets) {
-    List<S> newTargets = Lists.newArrayList(targets);
-    Collections.shuffle(newTargets);
-    iterator = Iterators.cycle(newTargets);
-    return newTargets;
-  }
-
-  @Override
-  public S nextBackend() throws ResourceExhaustedException {
-    if (!iterator.hasNext()) throw new ResourceExhaustedException("No backends available!");
-    return iterator.next();
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/StaticLoadBalancingStrategy.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/StaticLoadBalancingStrategy.java b/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/StaticLoadBalancingStrategy.java
deleted file mode 100644
index b333b44..0000000
--- a/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/StaticLoadBalancingStrategy.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net.loadbalancing;
-
-import org.apache.aurora.common.base.Closure;
-import org.apache.aurora.common.net.loadbalancing.RequestTracker.RequestResult;
-
-import java.util.Collection;
-import java.util.Set;
-
-/**
- * A baseclass for LoadBalancingStrategies that use a static set of backends they are
- * {@link #offerBackends(java.util.Set, Closure) offered}.  Also acts as an
- * adapter, providing no-op implementations of all other LoadBalancingStrategy methods that only
- * need be overridden as required by subclass features.
- *
- * @author John Sirois
- */
-abstract class StaticLoadBalancingStrategy<K> implements LoadBalancingStrategy<K> {
-
-  @Override
-  public final void offerBackends(Set<K> offeredBackends, Closure<Collection<K>> onBackendsChosen) {
-    onBackendsChosen.execute(onBackendsOffered(offeredBackends));
-  }
-
-  /**
-   * Subclasses must override and return a collection of the backends actually chosen for use until
-   * the next offer round.
-   *
-   * @param offeredBackends The backends offered in a {@link
-   *     #offerBackends(java.util.Set, Closure)} event.
-   * @return The collection of backends that will be used until the next offer event.
-   */
-  protected abstract Collection<K> onBackendsOffered(Set<K> offeredBackends);
-
-  @Override
-  public void addConnectResult(K backendKey, ConnectionResult result, long connectTimeNanos) {
-    // No-op.
-  }
-
-  @Override
-  public void connectionReturned(K backendKey) {
-    // No-op.
-  }
-
-  @Override
-  public void addRequestResult(K requestKey, RequestResult result, long requestTimeNanos) {
-    // No-op.
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/SubsetStrategy.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/SubsetStrategy.java b/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/SubsetStrategy.java
deleted file mode 100644
index 0b852cf..0000000
--- a/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/SubsetStrategy.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net.loadbalancing;
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-import org.apache.aurora.common.base.Closure;
-import org.apache.aurora.common.net.pool.ResourceExhaustedException;
-import org.apache.aurora.common.net.loadbalancing.RequestTracker.RequestResult;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-
-/**
- * A load balancer that maintains a fixed upper bound on the number of backends that will be made
- * available for a wrapped load balancer.
- *
- * TODO(William Farner): May want to consider periodically swapping subsets.
- *
- * TODO(William Farner): May want to catch ResourceExhaustedExceptions from wrapped strategy and adjust
- *    subset if possible.
- *
- * @author William Farner
- */
-public class SubsetStrategy<S> implements LoadBalancingStrategy<S> {
-  private final LoadBalancingStrategy<S> wrapped;
-  private final int maxBackends;
-
-  private Set<S> backendSubset = Sets.newHashSet();
-
-  public SubsetStrategy(int maxBackends, LoadBalancingStrategy<S> wrapped) {
-    Preconditions.checkArgument(maxBackends > 0);
-    this.maxBackends = maxBackends;
-    this.wrapped = Preconditions.checkNotNull(wrapped);
-  }
-
-  @Override
-  public void offerBackends(Set<S> offeredBackends, Closure<Collection<S>> onBackendsChosen) {
-    List<S> allTargets = Lists.newArrayList(offeredBackends);
-    Collections.shuffle(allTargets);
-    backendSubset = ImmutableSet.copyOf(
-        allTargets.subList(0, Math.min(maxBackends, allTargets.size())));
-    wrapped.offerBackends(backendSubset, onBackendsChosen);
-  }
-
-  @Override
-  public void addConnectResult(S backendKey, ConnectionResult result,
-      long connectTimeNanos) {
-    if (backendSubset.contains(backendKey)) {
-      wrapped.addConnectResult(backendKey, result, connectTimeNanos);
-    }
-  }
-
-  @Override
-  public void connectionReturned(S backendKey) {
-    if (backendSubset.contains(backendKey)) {
-      wrapped.connectionReturned(backendKey);
-    }
-  }
-
-  @Override
-  public void addRequestResult(S requestKey, RequestResult result, long requestTimeNanos) {
-    Preconditions.checkNotNull(requestKey);
-
-    if (backendSubset.contains(requestKey)) {
-      wrapped.addRequestResult(requestKey, result, requestTimeNanos);
-    }
-  }
-
-  @Override
-  public S nextBackend() throws ResourceExhaustedException {
-    return wrapped.nextBackend();
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/TrafficMonitorAdapter.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/TrafficMonitorAdapter.java b/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/TrafficMonitorAdapter.java
deleted file mode 100644
index e0c5c35..0000000
--- a/commons/src/main/java/org/apache/aurora/common/net/loadbalancing/TrafficMonitorAdapter.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net.loadbalancing;
-
-import com.google.common.base.Preconditions;
-import org.apache.aurora.common.base.Closure;
-import org.apache.aurora.common.net.monitoring.TrafficMonitor;
-import org.apache.aurora.common.net.pool.ResourceExhaustedException;
-
-import java.util.Collection;
-import java.util.Set;
-
-/**
- * @author William Farner
- */
-public class TrafficMonitorAdapter<K> implements LoadBalancingStrategy<K> {
-  private final LoadBalancingStrategy<K> strategy;
-  private final TrafficMonitor<K> monitor;
-
-  public TrafficMonitorAdapter(LoadBalancingStrategy<K> strategy, TrafficMonitor<K> monitor) {
-    this.strategy = Preconditions.checkNotNull(strategy);
-    this.monitor = Preconditions.checkNotNull(monitor);
-  }
-
-  public static <K> TrafficMonitorAdapter<K> create(LoadBalancingStrategy<K> strategy,
-      TrafficMonitor<K> monitor) {
-    return new TrafficMonitorAdapter<K>(strategy, monitor);
-  }
-
-  @Override
-  public void offerBackends(Set<K> offeredBackends, Closure<Collection<K>> onBackendsChosen) {
-    strategy.offerBackends(offeredBackends, onBackendsChosen);
-  }
-
-  @Override
-  public K nextBackend() throws ResourceExhaustedException {
-    return strategy.nextBackend();
-  }
-
-  @Override
-  public void addConnectResult(K key, ConnectionResult result, long connectTimeNanos) {
-    strategy.addConnectResult(key, result, connectTimeNanos);
-    if (result == ConnectionResult.SUCCESS) monitor.connected(key);
-  }
-
-  @Override
-  public void connectionReturned(K key) {
-    strategy.connectionReturned(key);
-    monitor.released(key);
-  }
-
-  @Override
-  public void addRequestResult(K key, RequestTracker.RequestResult result, long requestTimeNanos) {
-    strategy.addRequestResult(key, result, requestTimeNanos);
-    monitor.requestResult(key, result, requestTimeNanos);
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/net/monitoring/ConnectionMonitor.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/net/monitoring/ConnectionMonitor.java b/commons/src/main/java/org/apache/aurora/common/net/monitoring/ConnectionMonitor.java
deleted file mode 100644
index 4d32a71..0000000
--- a/commons/src/main/java/org/apache/aurora/common/net/monitoring/ConnectionMonitor.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net.monitoring;
-
-/**
- * Monitors active connections between two hosts..
- *
- * @author William Farner
- */
-public interface ConnectionMonitor<K> {
-
-  /**
-   * Instructs the monitor that a connection was established.
-   *
-   * @param connectionKey Key for the host that a connection was established with.
-   */
-  public void connected(K connectionKey);
-
-  /**
-   * Informs the monitor that a connection was released.
-   *
-   * @param connectionKey Key for the host that a connection was released for.
-   */
-  public void released(K connectionKey);
-}


[19/21] aurora git commit: Remove unused classes from commons fork.

Posted by wf...@apache.org.
http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/net/UrlTokenizerUtil.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/net/UrlTokenizerUtil.java b/commons/src/main/java/org/apache/aurora/common/net/UrlTokenizerUtil.java
deleted file mode 100644
index 67798a3..0000000
--- a/commons/src/main/java/org/apache/aurora/common/net/UrlTokenizerUtil.java
+++ /dev/null
@@ -1,1905 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.net;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Lists;
-import org.apache.aurora.common.collections.Pair;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-
-/**
- * Utility methods to help with url tokenization.
- *
- * @author Adam Samet
- */
-public class UrlTokenizerUtil {
-
-  /**
-   * Given an url host, tokenizes the host parts by dot, reverses them, and pads (with "") or
-   * truncates up to numParts pieces.  Truncation happens post token reversal.  This method properly
-   * accounts for two-part top-level domains as listed at
-   * http://www.surbl.org/two-level-tlds as of 05/12/2010.  For example, www.twitter.co.uk will
-   * be returned as  ["co.uk", "twitter", "www"].
-   *
-   * @param host A url host
-   * @param numParts The number of host parts to return.
-   * @return The reversed and tokenized list of host parts from host.
-   */
-  public static List<String> getReversedDomainParts(String host, int numParts) {
-    List<String> domainParts = Lists.newArrayList();
-    for (String item : host.split("\\.")) {
-      domainParts.add(item);
-    }
-    Collections.reverse(domainParts);
-
-    /*
-     * If the result is at least length two, see if we can squash together the last two
-     * parts as a top-level domain.
-     */
-    if (domainParts.size() >= 2 && TWO_PART_TLDS.contains(
-        Pair.of(domainParts.get(1), domainParts.get(0)))) {
-      domainParts.set(0, domainParts.get(1) + "." + domainParts.get(0));
-      domainParts.remove(1);
-    }
-
-    if (domainParts.size() > numParts) {
-      return domainParts.subList(0, numParts);
-    } else if (domainParts.size() < numParts) {
-      int diff = numParts - domainParts.size();
-      for (int i = 0; i < diff; ++i) {
-        domainParts.add("");
-      }
-    }
-
-    return domainParts;
-  }
-
-  public static boolean isTLD(final String url, boolean reversed) {
-    if (url == null) return false;
-    String[] domainParts = url.split("\\.");
-    if (domainParts.length == 1) {
-      return true;
-    } else if (domainParts.length == 2) {
-      return TWO_PART_TLDS.contains(
-        Pair.of(domainParts[reversed ? 1 : 0], domainParts[reversed ? 0 : 1]));
-    }
-    return false;
-  }
-
-  /*
-   * These come from http://www.surbl.org/two-level-tlds as of 05/12/2010.  Be very careful about
-   * changing this list, because it can screw up our ability to query historical data depending on
-   * this list being static.
-   */
-  // Initializing this in a static block is not pretty, but doing 1.5k+ chained .add() calls on an
-  // immutable set builder causes StackOverFlowError during compilation.
-  private static final ImmutableSet.Builder<Pair<String, String>> TWO_PART_TLD_BUILDER =
-      ImmutableSet.builder();
-  private static Set<Pair<String, String>> TWO_PART_TLDS = null;
-  static {
-    TWO_PART_TLD_BUILDER.add(Pair.of("2000", "hu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ab", "ca"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ab", "se"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("abo", "pa"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ac", "ae"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ac", "am"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ac", "at"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ac", "bd"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ac", "be"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ac", "cn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ac", "com"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ac", "cr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ac", "cy"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ac", "fj"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ac", "fk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ac", "gg"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ac", "gn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ac", "hu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ac", "id"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ac", "il"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ac", "im"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ac", "in"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ac", "ir"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ac", "je"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ac", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ac", "ke"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ac", "kr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ac", "lk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ac", "ma"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ac", "mw"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ac", "ng"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ac", "nz"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ac", "om"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ac", "pa"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ac", "pg"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ac", "rs"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ac", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ac", "rw"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ac", "se"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ac", "th"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ac", "tj"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ac", "tz"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ac", "ug"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ac", "uk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ac", "vn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ac", "yu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ac", "za"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ac", "zm"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ac", "zw"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("act", "au"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ad", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("adm", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("adult", "ht"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("adv", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("adygeya", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("aero", "mv"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("aero", "tt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("aeroport", "fr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("agr", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("agrar", "hu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("agro", "pl"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ah", "cn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("aichi", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("aid", "pl"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ak", "us"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("akita", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("al", "us"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("aland", "fi"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("alderney", "gg"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("alt", "na"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("alt", "za"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("altai", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("am", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("amur", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("amursk", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("aomori", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ar", "us"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("arkhangelsk", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("army", "mil"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("arq", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("art", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("art", "do"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("art", "dz"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("art", "ht"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("art", "pl"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("arts", "co"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("arts", "ro"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("arts", "ve"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("asn", "au"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("asn", "lv"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ass", "dz"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("assedic", "fr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("assn", "lk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("asso", "dz"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("asso", "fr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("asso", "gp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("asso", "ht"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("asso", "mc"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("asso", "re"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("astrakhan", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("at", "tf"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("at", "tt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("atm", "pl"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ato", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("au", "com"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("au", "tt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("auto", "pl"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("av", "tr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("avocat", "fr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("avoues", "fr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("az", "us"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("baikal", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("barreau", "fr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("bashkiria", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("bbs", "tr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("bc", "ca"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("bd", "se"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("be", "tt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("bel", "tr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("belgie", "be"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("belgorod", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("bg", "tf"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("bialystok", "pl"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("bib", "ve"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("bio", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("bir", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("biz", "az"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("biz", "bh"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("biz", "cy"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("biz", "et"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("biz", "fj"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("biz", "ly"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("biz", "mv"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("biz", "nr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("biz", "om"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("biz", "pk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("biz", "pl"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("biz", "pr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("biz", "tj"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("biz", "tr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("biz", "tt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("biz", "vn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("bj", "cn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("bl", "uk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("bmd", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("bolt", "hu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("bourse", "za"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("br", "com"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("brand", "se"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("british-library", "uk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("bryansk", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("buryatia", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("busan", "kr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("c", "se"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ca", "tf"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ca", "tt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ca", "us"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("casino", "hu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("cbg", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("cc", "bh"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("cci", "fr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ch", "tf"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ch", "vu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("chambagri", "fr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("chel", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("chelyabinsk", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("cherkassy", "ua"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("chernigov", "ua"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("chernovtsy", "ua"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("chiba", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("chirurgiens-dentistes", "fr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("chita", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("chukotka", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("chungbuk", "kr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("chungnam", "kr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("chuvashia", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("cim", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("city", "hu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("city", "za"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ck", "ua"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("club", "tw"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("cmw", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("cn", "com"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("cn", "ua"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("cng", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("cnt", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "ae"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "ag"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "am"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "ao"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "at"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "ba"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "bw"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "ck"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "cr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "dk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "ee"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "fk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "gg"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "hu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "id"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "il"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "im"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "in"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "ir"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "je"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "ke"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "kr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "ls"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "ma"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "mu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "mw"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "mz"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "nz"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "om"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "rs"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "rw"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "st"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "th"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "tj"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "tt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "tv"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "tz"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "ua"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "ug"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "uk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "us"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "uz"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "ve"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "vi"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "yu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "za"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "zm"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("co", "zw"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "ac"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "ae"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "af"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "ag"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "ai"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "al"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "am"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "an"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "ar"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "au"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "aw"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "az"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "ba"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "bb"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "bd"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "bh"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "bm"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "bn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "bo"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "bs"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "bt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "bz"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "cd"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "ch"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "cn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "co"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "cu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "cy"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "dm"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "do"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "dz"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "ec"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "ee"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "eg"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "er"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "es"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "et"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "fj"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "fk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "fr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "ge"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "gh"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "gi"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "gn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "gp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "gr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "gt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "gu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "hk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "hn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "hr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "ht"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "io"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "jm"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "jo"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "kg"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "kh"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "ki"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "kw"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "ky"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "kz"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "la"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "lb"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "lc"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "li"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "lk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "lr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "lv"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "ly"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "mg"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "mk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "mm"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "mn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "mo"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "mt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "mu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "mv"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "mw"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "mx"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "my"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "na"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "nc"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "nf"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "ng"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "ni"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "np"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "nr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "om"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "pa"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "pe"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "pf"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "pg"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "ph"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "pk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "pl"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "pr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "ps"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "pt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "py"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "qa"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "re"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "ro"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "rw"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "sa"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "sb"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "sc"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "sd"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "sg"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "sh"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "st"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "sv"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "sy"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "tj"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "tn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "tr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "tt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "tw"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "ua"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "uy"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "uz"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "vc"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "ve"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "vi"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "vn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "vu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "ws"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("com", "ye"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("conf", "au"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("conf", "lv"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("consulado", "st"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("coop", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("coop", "ht"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("coop", "mv"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("coop", "mw"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("coop", "tt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("cpa", "pro"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("cq", "cn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("cri", "nz"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("crimea", "ua"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("csiro", "au"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ct", "us"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("cul", "na"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("cv", "ua"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("cz", "tf"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("d", "se"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("daegu", "kr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("daejeon", "kr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("dagestan", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("dc", "us"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("de", "com"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("de", "net"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("de", "tf"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("de", "tt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("de", "us"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("de", "vu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("dk", "org"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("dk", "tt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("dn", "ua"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("dnepropetrovsk", "ua"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("dni", "us"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("dns", "be"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("donetsk", "ua"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("dp", "ua"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("dpn", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("dr", "tr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("dudinka", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("e-burg", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("e", "se"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("e164", "arpa"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ebiz", "tw"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ecn", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ed", "ao"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ed", "cr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ed", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "ac"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "af"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "ai"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "al"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "am"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "an"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "ar"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "au"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "az"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "ba"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "bb"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "bd"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "bh"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "bm"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "bn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "bo"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "bt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "ck"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "cn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "co"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "cu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "dm"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "do"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "dz"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "ec"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "ee"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "eg"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "er"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "es"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "et"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "ge"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "gh"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "gi"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "gp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "gr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "gt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "gu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "hk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "hn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "ht"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "hu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "in"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "it"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "jm"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "jo"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "kg"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "kh"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "kw"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "ky"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "kz"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "lb"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "lc"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "lk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "lr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "lv"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "ly"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "mg"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "mm"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "mn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "mo"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "mt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "mv"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "mw"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "mx"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "my"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "na"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "ng"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "ni"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "np"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "nr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "om"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "pa"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "pe"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "pf"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "ph"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "pk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "pl"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "pr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "ps"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "pt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "py"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "qa"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "rs"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "rw"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "sa"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "sb"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "sc"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "sd"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "sg"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "sh"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "sk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "st"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "sv"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "tf"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "tj"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "tr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "tt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "tw"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "ua"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "uk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "uy"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "ve"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "vi"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "vn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "vu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "ws"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "ye"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "yu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edu", "za"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("edunet", "tn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ehime", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ekloges", "cy"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("embaixada", "st"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("eng", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ens", "tn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ernet", "in"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("erotica", "hu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("erotika", "hu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("es", "kr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("es", "tt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("esp", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("etc", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("eti", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("eu", "com"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("eu", "org"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("eu", "tf"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("eu", "tt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("eun", "eg"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("experts-comptables", "fr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("f", "se"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("fam", "pk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("far", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("fareast", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("fax", "nr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("fed", "us"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("fgov", "be"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("fh", "se"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("fhs", "no"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("fhsk", "se"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("fhv", "se"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("fi", "cr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("fie", "ee"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("film", "hu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("fin", "ec"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("fin", "tn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("firm", "co"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("firm", "ht"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("firm", "in"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("firm", "ro"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("firm", "ve"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("fj", "cn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("fl", "us"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("fm", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("fnd", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("folkebibl", "no"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("forum", "hu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("fot", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("fr", "tt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("fr", "vu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("from", "hr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("fst", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("fukui", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("fukuoka", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("fukushima", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("fylkesbibl", "no"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("g", "se"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("g12", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ga", "us"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("game", "tw"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("games", "hu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gangwon", "kr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gb", "com"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gb", "net"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gc", "ca"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gd", "cn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gda", "pl"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gdansk", "pl"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("geek", "nz"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gen", "in"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gen", "nz"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gen", "tr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("geometre-expert", "fr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ggf", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gifu", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gmina", "pl"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("go", "cr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("go", "id"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("go", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("go", "ke"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("go", "kr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("go", "th"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("go", "tj"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("go", "tz"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("go", "ug"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gob", "bo"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gob", "do"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gob", "es"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gob", "gt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gob", "hn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gob", "mx"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gob", "ni"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gob", "pa"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gob", "pe"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gob", "pk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gob", "sv"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gok", "pk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gon", "pk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gop", "pk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gos", "pk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gouv", "fr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gouv", "ht"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gouv", "rw"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "ac"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "ae"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "af"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "ai"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "al"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "am"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "ar"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "au"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "az"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "ba"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "bb"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "bd"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "bf"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "bh"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "bm"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "bo"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "bt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "by"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "ch"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "ck"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "cn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "co"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "cu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "cx"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "cy"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "dm"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "do"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "dz"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "ec"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "eg"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "er"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "et"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "fj"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "fk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "ge"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "gg"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "gh"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "gi"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "gn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "gr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "gu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "hk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "hu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "ie"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "il"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "im"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "in"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "io"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "ir"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "it"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "je"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "jm"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "jo"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "kg"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "kh"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "kw"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "ky"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "kz"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "lb"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "lc"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "li"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "lk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "lr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "lt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "lu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "lv"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "ly"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "ma"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "mg"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "mm"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "mn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "mo"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "mt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "mv"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "mw"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "my"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "ng"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "np"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "nr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "om"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "ph"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "pk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "pl"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "pr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "ps"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "pt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "py"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "qa"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "rs"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "rw"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "sa"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "sb"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "sc"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "sd"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "sg"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "sh"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "sk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "st"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "sy"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "tj"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "tn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "to"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "tp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "tr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "tt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "tv"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "tw"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "ua"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "uk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "ve"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "vi"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "vn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "ws"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "ye"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "za"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "zm"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gov", "zw"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("govt", "nz"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gr", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("greta", "fr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("grozny", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("grp", "lk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gs", "cn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gsm", "pl"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gub", "uy"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("guernsey", "gg"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gunma", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gv", "ao"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gv", "at"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gwangju", "kr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gx", "cn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gyeongbuk", "kr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gyeonggi", "kr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gyeongnam", "kr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("gz", "cn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("h", "se"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ha", "cn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("hb", "cn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("he", "cn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("health", "vn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("herad", "no"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("hi", "cn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("hi", "us"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("hiroshima", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("hk", "cn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("hl", "cn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("hn", "cn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("hokkaido", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("hotel", "hu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("hotel", "lk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("hs", "kr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("hu", "com"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("huissier-justice", "fr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("hyogo", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("i", "se"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ia", "us"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ibaraki", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("icnet", "uk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("id", "au"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("id", "fj"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("id", "ir"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("id", "lv"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("id", "ly"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("id", "us"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("idf", "il"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("idn", "sg"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("idrett", "no"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("idv", "hk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("idv", "tw"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("if", "ua"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("il", "us"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("imb", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("in-addr", "arpa"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("in", "rs"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("in", "th"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("in", "ua"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("in", "us"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("incheon", "kr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ind", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ind", "er"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ind", "gg"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ind", "gt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ind", "in"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ind", "je"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ind", "tn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("inf", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("inf", "cu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("info", "au"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("info", "az"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("info", "bh"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("info", "co"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("info", "cu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("info", "cy"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("info", "ec"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("info", "et"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("info", "fj"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("info", "ht"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("info", "hu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("info", "mv"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("info", "nr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("info", "pl"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("info", "pr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("info", "ro"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("info", "sd"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("info", "tn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("info", "tr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("info", "tt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("info", "ve"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("info", "vn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ing", "pa"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ingatlan", "hu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("inima", "al"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("int", "am"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("int", "ar"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("int", "az"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("int", "bo"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("int", "co"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("int", "lk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("int", "mv"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("int", "mw"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("int", "pt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("int", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("int", "rw"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("int", "tf"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("int", "tj"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("int", "tt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("int", "ve"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("int", "vn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("intl", "tn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ip6", "arpa"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("iris", "arpa"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("irkutsk", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("isa", "us"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ishikawa", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("isla", "pr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("it", "ao"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("it", "tt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ivano-frankivsk", "ua"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ivanovo", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("iwate", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("iwi", "nz"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("iz", "hr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("izhevsk", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("jamal", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("jar", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("jeju", "kr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("jeonbuk", "kr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("jeonnam", "kr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("jersey", "je"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("jet", "uk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("jl", "cn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("jobs", "tt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("jogasz", "hu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("jor", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("joshkar-ola", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("js", "cn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("jx", "cn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("k-uralsk", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("k", "se"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("k12", "ec"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("k12", "il"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("k12", "tr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("kagawa", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("kagoshima", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("kalmykia", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("kaluga", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("kamchatka", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("kanagawa", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("kanazawa", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("karelia", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("katowice", "pl"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("kawasaki", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("kazan", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("kchr", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("kemerovo", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("kg", "kr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("kh", "ua"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("khabarovsk", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("khakassia", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("kharkov", "ua"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("kherson", "ua"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("khmelnitskiy", "ua"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("khv", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("kids", "us"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("kiev", "ua"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("kirov", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("kirovograd", "ua"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("kitakyushu", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("km", "ua"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("kms", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("kobe", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("kochi", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("koenig", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("komforb", "se"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("komi", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("kommunalforbund", "se"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("kommune", "no"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("komvux", "se"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("konyvelo", "hu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("kostroma", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("kr", "ua"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("krakow", "pl"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("krasnoyarsk", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ks", "ua"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ks", "us"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("kuban", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("kumamoto", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("kurgan", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("kursk", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("kustanai", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("kuzbass", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("kv", "ua"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ky", "us"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("kyonggi", "kr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("kyoto", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("la", "us"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("lakas", "hu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("lanarb", "se"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("lanbib", "se"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("law", "pro"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("law", "za"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("lel", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("lg", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("lg", "ua"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("lipetsk", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("lkd", "co"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ln", "cn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("lodz", "pl"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ltd", "co"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ltd", "cy"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ltd", "gg"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ltd", "gi"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ltd", "je"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ltd", "lk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ltd", "uk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("lublin", "pl"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("lugansk", "ua"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("lutsk", "ua"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("lviv", "ua"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("m", "se"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ma", "us"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("magadan", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("magnitka", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mail", "pl"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("maori", "nz"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mari-el", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mari", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("marine", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mat", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("matsuyama", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mb", "ca"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("md", "us"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("me", "uk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("me", "us"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("med", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("med", "ec"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("med", "ee"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("med", "ht"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("med", "ly"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("med", "om"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("med", "pa"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("med", "pro"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("med", "sa"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("med", "sd"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("medecin", "fr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("media", "hu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("media", "pl"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mi", "th"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mi", "us"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("miasta", "pl"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mie", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "ac"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "ae"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "am"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "ar"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "az"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "ba"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "bd"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "bo"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "by"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "co"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "do"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "ec"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "eg"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "er"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "fj"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "ge"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "gh"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "gt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "gu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "hn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "id"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "in"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "io"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "jo"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "kg"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "kh"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "kr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "kw"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "kz"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "lb"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "lt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "lu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "lv"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "mg"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "mv"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "my"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "no"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "np"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "nz"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "om"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "pe"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "ph"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "pl"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "rw"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "se"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "sh"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "sk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "st"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "tj"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "tr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "tw"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "uk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "uy"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "ve"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "ye"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mil", "za"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("miyagi", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("miyazaki", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mk", "ua"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mn", "us"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mo", "cn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mo", "us"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mob", "nr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mobi", "tt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mobil", "nr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mobile", "nr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mod", "gi"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mod", "om"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mod", "uk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mordovia", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mosreg", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ms", "kr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ms", "us"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("msk", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mt", "us"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("muni", "il"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("murmansk", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mus", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("museum", "mn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("museum", "mv"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("museum", "mw"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("museum", "no"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("museum", "om"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("museum", "tt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("music", "mobi"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("mytis", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("n", "se"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nagano", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nagasaki", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nagoya", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nakhodka", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nalchik", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("name", "ae"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("name", "az"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("name", "cy"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("name", "et"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("name", "fj"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("name", "hr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("name", "mv"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("name", "my"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("name", "pr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("name", "tj"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("name", "tr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("name", "tt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("name", "vn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nara", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nat", "tn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("national-library-scotland", "uk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("naturbruksgymn", "se"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("navy", "mil"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nb", "ca"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nc", "us"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nd", "us"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ne", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ne", "ke"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ne", "kr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ne", "tz"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ne", "ug"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ne", "us"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nel", "uk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "ac"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "ae"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "af"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "ag"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "ai"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "al"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "am"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "an"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "ar"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "au"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "az"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "ba"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "bb"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "bd"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "bh"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "bm"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "bn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "bo"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "bs"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "bt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "bz"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "cd"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "ch"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "ck"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "cn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "co"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "cu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "cy"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "dm"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "do"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "dz"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "ec"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "eg"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "er"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "et"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "fj"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "fk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "ge"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "gg"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "gn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "gp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "gr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "gt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "gu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "hk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "hn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "ht"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "id"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "il"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "im"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "in"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "io"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "ir"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "je"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "jm"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "jo"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "kg"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "kh"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "ki"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "kw"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "ky"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "kz"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "la"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "lb"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "lc"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "li"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "lk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "lr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "lu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "lv"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "ly"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "ma"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "mm"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "mo"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "mt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "mu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "mv"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "mw"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "mx"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "my"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "na"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "nc"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "nf"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "ng"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "ni"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "np"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "nr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "nz"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "om"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "pa"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "pe"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "pg"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "ph"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "pk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "pl"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "pr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "ps"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "pt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "py"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "qa"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "rw"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "sa"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "sb"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "sc"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "sd"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "sg"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "sh"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "st"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "sy"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "tf"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "th"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "tj"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "tn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "tr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "tt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "tw"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "ua"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "uk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "uy"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "uz"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "vc"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "ve"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "vi"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "vn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "vu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "ws"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "ye"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("net", "za"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("new", "ke"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("news", "hu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nf", "ca"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ngo", "lk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ngo", "ph"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ngo", "pl"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ngo", "za"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nh", "us"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nhs", "uk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nic", "im"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nic", "in"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nic", "tt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nic", "uk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nieruchomosci", "pl"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("niigata", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nikolaev", "ua"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nj", "us"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nkz", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nl", "ca"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nls", "uk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nm", "cn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nm", "us"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nnov", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("no", "com"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nom", "ad"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nom", "ag"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nom", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nom", "co"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nom", "es"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nom", "fk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nom", "fr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nom", "mg"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nom", "ni"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nom", "pa"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nom", "pe"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nom", "pl"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nom", "re"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nom", "ro"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nom", "ve"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nom", "za"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nome", "pt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("norilsk", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("not", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("notaires", "fr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nov", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("novosibirsk", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ns", "ca"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nsk", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nsn", "us"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nsw", "au"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nt", "au"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nt", "ca"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nt", "ro"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ntr", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nu", "ca"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nui", "hu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nv", "us"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("nx", "cn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ny", "us"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("o", "se"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("od", "ua"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("odessa", "ua"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("odo", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("off", "ai"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("og", "ao"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("oh", "us"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("oita", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ok", "us"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("okayama", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("okinawa", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("olsztyn", "pl"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("omsk", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("on", "ca"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("opole", "pl"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("or", "at"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("or", "cr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("or", "id"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("or", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("or", "ke"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("or", "kr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("or", "th"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("or", "tz"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("or", "ug"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("or", "us"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("orenburg", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "ac"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "ae"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "ag"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "ai"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "al"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "am"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "an"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "ar"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "au"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "az"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "ba"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "bb"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "bd"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "bh"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "bm"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "bn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "bo"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "bs"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "bt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "bw"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "bz"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "cd"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "ch"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "ck"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "cn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "co"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "cu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "cy"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "dm"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "do"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "dz"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "ec"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "ee"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "eg"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "er"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "es"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "et"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "fj"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "fk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "ge"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "gg"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "gh"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "gi"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "gn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "gp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "gr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "gt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "gu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "hk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "hn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "ht"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "hu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "il"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "im"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "in"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "io"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "ir"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "je"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "jm"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "jo"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "kg"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "kh"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "ki"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "kw"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "ky"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "kz"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "la"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "lb"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "lc"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "li"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "lk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "lr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "ls"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "lu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "lv"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "ly"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "ma"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "mg"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "mk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "mm"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "mn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "mo"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "mt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "mu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "mv"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "mw"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "mx"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "my"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "na"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "nc"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "ng"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "ni"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "np"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "nr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "nz"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "om"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "pa"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "pe"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "pf"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "ph"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "pk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "pl"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "pr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "ps"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "pt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "py"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "qa"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "ro"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "rs"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "sa"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "sb"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "sc"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "sd"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "se"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "sg"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "sh"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "st"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "sv"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "sy"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "tj"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "tn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "tr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "tt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "tw"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "ua"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "uk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "uy"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "uz"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "vc"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "ve"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "vi"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "vn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "vu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "ws"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "ye"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "yu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "za"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "zm"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("org", "zw"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("oryol", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("osaka", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("oskol", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("otc", "au"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("oz", "au"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("pa", "us"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("palana", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("parliament", "cy"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("parliament", "uk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("parti", "se"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("pb", "ao"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("pc", "pl"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("pe", "ca"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("pe", "kr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("penza", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("per", "kh"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("per", "sg"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("perm", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("perso", "ht"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("pharmacien", "fr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("pl", "tf"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("pl", "ua"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("plc", "co"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("plc", "ly"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("plc", "uk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("plo", "ps"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("pol", "dz"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("pol", "ht"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("pol", "tr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("police", "uk"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("poltava", "ua"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("port", "fr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("powiat", "pl"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("poznan", "pl"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("pp", "az"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("pp", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("pp", "se"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ppg", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("prd", "fr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("prd", "mg"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("press", "cy"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("press", "ma"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("press", "se"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("presse", "fr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("pri", "ee"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("principe", "st"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("priv", "at"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("priv", "hu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("priv", "no"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("priv", "pl"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("pro", "ae"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("pro", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("pro", "cy"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("pro", "ec"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("pro", "fj"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("pro", "ht"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("pro", "mv"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("pro", "om"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("pro", "pr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("pro", "tt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("pro", "vn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("psc", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("psi", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("pskov", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ptz", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("pub", "sa"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("publ", "pt"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("pvt", "ge"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("pyatigorsk", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("qc", "ca"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("qc", "com"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("qh", "cn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("qld", "au"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("qsl", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("re", "kr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("realestate", "pl"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("rec", "br"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("rec", "co"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("rec", "ro"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("rec", "ve"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("red", "sv"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("reklam", "hu"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("rel", "ht"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("rel", "pl"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("res", "in"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ri", "us"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("rnd", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("rnrt", "tn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("rns", "tn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("rnu", "tn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("rovno", "ua"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("rs", "ba"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ru", "com"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ru", "tf"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("rubtsovsk", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("rv", "ua"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("ryazan", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("s", "se"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("sa", "au"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("sa", "com"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("sa", "cr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("saga", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("saitama", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("sakhalin", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("samara", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("saotome", "st"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("sapporo", "jp"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("saratov", "ru"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("sark", "gg"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("sc", "cn"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("sc", "ke"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("sc", "kr"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("sc", "ug"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("sc", "us"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("sch", "ae"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("sch", "gg"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("sch", "id"));
-    TWO_PART_TLD_BUILDER.add(Pair.of("sch", "ir"));
-    

<TRUNCATED>

[03/21] aurora git commit: Remove unused classes from commons fork.

Posted by wf...@apache.org.
http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/objectsize/ObjectSizeCalculatorTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/objectsize/ObjectSizeCalculatorTest.java b/commons/src/test/java/org/apache/aurora/common/objectsize/ObjectSizeCalculatorTest.java
deleted file mode 100644
index b912844..0000000
--- a/commons/src/test/java/org/apache/aurora/common/objectsize/ObjectSizeCalculatorTest.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.objectsize;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-public class ObjectSizeCalculatorTest {
-
-  private int A;
-  private int O;
-  private int R;
-  private int S;
-  private ObjectSizeCalculator objectSizeCalculator;
-
-  @Before
-  public void setUp() {
-    ObjectSizeCalculator.MemoryLayoutSpecification memoryLayoutSpecification =
-        new ObjectSizeCalculator.MemoryLayoutSpecification() {
-          @Override public int getArrayHeaderSize() {
-            return 16;
-          }
-          @Override public int getObjectHeaderSize() {
-            return 12;
-          }
-          @Override public int getObjectPadding() {
-            return 8;
-          }
-          @Override public int getReferenceSize() {
-            return 4;
-          }
-          @Override public int getSuperclassFieldPadding() {
-            return 4;
-          }
-        };
-
-    A = memoryLayoutSpecification.getArrayHeaderSize();
-    O = memoryLayoutSpecification.getObjectHeaderSize();
-    R = memoryLayoutSpecification.getReferenceSize();
-    S = memoryLayoutSpecification.getSuperclassFieldPadding();
-
-    objectSizeCalculator = new ObjectSizeCalculator(memoryLayoutSpecification);
-  }
-
-  @Test
-  public void testRounding() {
-    assertEquals(0, roundTo(0, 8));
-    assertEquals(8, roundTo(1, 8));
-    assertEquals(8, roundTo(7, 8));
-    assertEquals(8, roundTo(8, 8));
-    assertEquals(16, roundTo(9, 8));
-    assertEquals(16, roundTo(15, 8));
-    assertEquals(16, roundTo(16, 8));
-    assertEquals(24, roundTo(17, 8));
-  }
-
-  @Test
-  public void testObjectSize() {
-    assertSizeIs(O, new Object());
-  }
-
-  static class ObjectWithFields {
-    int length;
-    int offset;
-    int hashcode;
-    char[] data = {};
-  }
-
-  @Test
-  public void testObjectWithFields() {
-    assertSizeIs(O + 3 * 4 + R + A, new ObjectWithFields());
-  }
-
-  public static class Class1 {
-    private boolean b1;
-  }
-
-  @Test
-  public void testOneBooleanSize() {
-    assertSizeIs(O + 1, new Class1());
-  }
-
-  public static class Class2 extends Class1 {
-    private int i1;
-  }
-
-  @Test
-  public void testSimpleSubclassSize() {
-    assertSizeIs(O + roundTo(1, S) + 4, new Class2());
-  }
-
-  @Test
-  public void testZeroLengthArray() {
-    assertSizeIs(A, new byte[0]);
-    assertSizeIs(A, new int[0]);
-    assertSizeIs(A, new long[0]);
-    assertSizeIs(A, new Object[0]);
-  }
-
-  @Test
-  public void testByteArrays() {
-    assertSizeIs(A + 1, new byte[1]);
-    assertSizeIs(A + 8, new byte[8]);
-    assertSizeIs(A + 9, new byte[9]);
-  }
-
-  @Test
-  public void testCharArrays() {
-    assertSizeIs(A + 2 * 1, new char[1]);
-    assertSizeIs(A + 2 * 4, new char[4]);
-    assertSizeIs(A + 2 * 5, new char[5]);
-  }
-
-  @Test
-  public void testIntArrays() {
-    assertSizeIs(A + 4 * 1, new int[1]);
-    assertSizeIs(A + 4 * 2, new int[2]);
-    assertSizeIs(A + 4 * 3, new int[3]);
-  }
-
-  @Test
-  public void testLongArrays() {
-    assertSizeIs(A + 8 * 1, new long[1]);
-    assertSizeIs(A + 8 * 2, new long[2]);
-    assertSizeIs(A + 8 * 3, new long[3]);
-  }
-
-  @Test
-  public void testObjectArrays() {
-    assertSizeIs(A + R * 1, new Object[1]);
-    assertSizeIs(A + R * 2, new Object[2]);
-    assertSizeIs(A + R * 3, new Object[3]);
-    assertSizeIs(A + R * 1, new String[1]);
-    assertSizeIs(A + R * 2, new String[2]);
-    assertSizeIs(A + R * 3, new String[3]);
-  }
-
-  public static class Circular {
-    Circular c;
-  }
-
-  @Test
-  public void testCircular() {
-    Circular c1 = new Circular();
-    long size = objectSizeCalculator.calculateObjectSize(c1);
-    c1.c = c1;
-    assertEquals(size, objectSizeCalculator.calculateObjectSize(c1));
-  }
-
-  static class ComplexObject<T> {
-    static class Node<T> {
-      final T value;
-      Node<T> previous;
-      Node<T> next;
-
-      Node(T value) {
-        this.value = value;
-      }
-    }
-
-    private Node<T> first;
-    private Node<T> last;
-
-    void add(T item) {
-      Node<T> node = new Node<T>(item);
-      if (first == null) {
-        first = node;
-      } else {
-        last.next = node;
-        node.previous = last;
-      }
-      last = node;
-    }
-  }
-
-  @Test
-  public void testComplexObject() {
-    ComplexObject<Object> l = new ComplexObject<Object>();
-    l.add(new Object());
-    l.add(new Object());
-    l.add(new Object());
-
-    long expectedSize = 0;
-    expectedSize += roundTo(O + 2 * R, 8); // The complex object itself plus first and last refs.
-    expectedSize += roundTo(O + 3 * R, 8) * 3; // 3 Nodes - each with 3 object references.
-    expectedSize += roundTo(O, 8) * 3; // 3 vanilla objects contained in the node values.
-
-    assertSizeIs(expectedSize, l);
-  }
-
-  private void assertSizeIs(long size, Object o) {
-    assertEquals(roundTo(size, 8), objectSizeCalculator.calculateObjectSize(o));
-  }
-
-  private static long roundTo(long x, int multiple) {
-    return ObjectSizeCalculator.roundTo(x, multiple);
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/stats/ApproximateHistogramTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/stats/ApproximateHistogramTest.java b/commons/src/test/java/org/apache/aurora/common/stats/ApproximateHistogramTest.java
deleted file mode 100644
index 62b8846..0000000
--- a/commons/src/test/java/org/apache/aurora/common/stats/ApproximateHistogramTest.java
+++ /dev/null
@@ -1,321 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.stats;
-
-import java.util.Arrays;
-import java.util.List;
-
-import com.google.common.base.Supplier;
-import com.google.common.base.Suppliers;
-import com.google.common.collect.ImmutableList;
-
-import org.junit.Test;
-
-import org.apache.aurora.common.objectsize.ObjectSizeCalculator;
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Data;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-public class ApproximateHistogramTest {
-  final int b = 10;
-  final int h = 3;
-
-  @Test
-  public void testCollapse() {
-    ApproximateHistogram hist = new ApproximateHistogram();
-    long[] buf1 = {2,5,7};
-    long[] buf2 = {3,8,9};
-    long[] expected = {3,7,9};
-    long[] result = new long[3];
-    // [2,5,7] weight 2 and [3,8,9] weight 3
-    // weight x array + concat = [2,2,5,5,7,7,3,3,3,8,8,8,9,9,9]
-    // sort = [2,2,3,3,3,5,5,7,7,8,8,8,9,9,9]
-    // select every nth elems = [3,7,9]  (n = sum weight / 2, ie. 5/3 = 2)
-    // [2,2,3,3,3,5,5,7,7,8,8,8,9,9,9]
-    //  . . ^ . . . . ^ . . . . ^ . .
-    //  [-------] [-------] [-------] we make 3 packets of 5 elements and take the middle
-
-    ApproximateHistogram.collapse(buf1, 2, buf2, 3, result);
-    assertArrayEquals(result, expected);
-
-    long[] buf3 = {2, 5, 7, 9};
-    long[] buf4 = {3, 8, 9, 12};
-    long[] expected2 = {3, 7, 9, 12};
-    long[] result2 = new long[4];
-    ApproximateHistogram.collapse(buf3, 2, buf4, 2, result2);
-    assertArrayEquals(expected2, result2);
-  }
-
-  @Test
-  public void testRecCollapse() {
-    long[] empty = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
-    long[] full = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
-    ApproximateHistogram hist = new ApproximateHistogram(b, h);
-    assertArrayEquals(empty, hist.buffer[0]);
-    assertArrayEquals(empty, hist.buffer[1]);
-
-    initializeValues(hist, b, Suppliers.ofInstance(1L));
-    assertArrayEquals(full, hist.buffer[0]);
-    assertArrayEquals(empty, hist.buffer[1]);
-
-    initializeValues(hist, b, Suppliers.ofInstance(1L));
-    assertArrayEquals(full, hist.buffer[0]);
-    assertArrayEquals(full, hist.buffer[1]);
-
-    hist.add(1);
-    assertEquals(2, hist.currentTop);
-    // Buffers are not cleared so we can't check that!
-    assertArrayEquals(full, hist.buffer[2]);
-
-    initializeValues(hist, 2 * b, Suppliers.ofInstance(1L));
-    assertEquals(3, hist.currentTop);
-    assertArrayEquals(full, hist.buffer[3]);
-  }
-
-  @Test
-  public void testReachingMaxDepth() {
-    ApproximateHistogram hist = new ApproximateHistogram(b, h);
-
-    initializeValues(hist, 8 * b, Suppliers.ofInstance(1L));
-    assertEquals(3, hist.currentTop);
-
-    hist.add(1);
-    assertEquals(3, hist.currentTop);
-  }
-
-  @Test
-  public void testMem() {
-    for (int b = 10; b < 100; b += 10) {
-      for (int h = 4; h < 16; h += 4) {
-        ApproximateHistogram hist = new ApproximateHistogram(b, h);
-        long actualSize = ObjectSizeCalculator.getObjectSize(hist);
-        long estimatedSize = ApproximateHistogram.memoryUsage(b, h);
-        assertTrue("Consume less memory than the constraint", actualSize < estimatedSize);
-      }
-    }
-  }
-
-  @Test
-  public void testMemConstraint() {
-    ImmutableList.Builder<Amount<Long, Data>> builder = ImmutableList.builder();
-    builder.add(Amount.of(1L, Data.KB));
-    builder.add(Amount.of(4L, Data.KB));
-    builder.add(Amount.of(8L, Data.KB));
-    builder.add(Amount.of(16L, Data.KB));
-    builder.add(Amount.of(32L, Data.KB));
-    builder.add(Amount.of(64L, Data.KB));
-    builder.add(Amount.of(256L, Data.KB));
-    builder.add(Amount.of(1L, Data.MB));
-    builder.add(Amount.of(16L, Data.MB));
-    builder.add(Amount.of(32L, Data.MB));
-    List<Amount<Long, Data>> sizes = builder.build();
-
-    for (Amount<Long, Data> maxSize: sizes) {
-      ApproximateHistogram hist = new ApproximateHistogram(maxSize);
-      for (long i = 0; i < 1000 * 1000; i++) { hist.add(i); }
-      long size = ObjectSizeCalculator.getObjectSize(hist);
-      assertTrue(size < maxSize.as(Data.BYTES));
-    }
-  }
-
-  @Test
-  public void testLowMemoryPrecision() {
-    double e = ApproximateHistogram.DEFAULT_PRECISION.getEpsilon();
-    int n = ApproximateHistogram.DEFAULT_PRECISION.getN();
-    int defaultDepth = ApproximateHistogram.computeDepth(e, n);
-    int defaultBufferSize = ApproximateHistogram.computeBufferSize(defaultDepth, n);
-
-    ApproximateHistogram hist = new ApproximateHistogram(Amount.of(1L, Data.KB));
-    int depth = hist.buffer.length - 1;
-    int bufferSize = hist.buffer[0].length;
-
-    assertTrue(depth > defaultDepth);
-    assertTrue(bufferSize < defaultBufferSize);
-  }
-
-  @Test
-  public void testHighMemoryPrecision() {
-    double e = ApproximateHistogram.DEFAULT_PRECISION.getEpsilon();
-    int n = ApproximateHistogram.DEFAULT_PRECISION.getN();
-    int defaultDepth = ApproximateHistogram.computeDepth(e, n);
-    int defaultBufferSize = ApproximateHistogram.computeBufferSize(defaultDepth, n);
-
-    ApproximateHistogram hist = new ApproximateHistogram(Amount.of(1L, Data.MB));
-    int depth = hist.buffer.length - 1;
-    int bufferSize = hist.buffer[0].length;
-
-    assertTrue(depth < defaultDepth);
-    assertTrue(bufferSize > defaultBufferSize);
-  }
-
-  private void initIndexArray(ApproximateHistogram hist, int b) {
-    Arrays.fill(hist.indices, b - 1);
-    int buf0Size = Math.min(b, hist.leafCount);
-    int buf1Size = Math.max(0, hist.leafCount - buf0Size);
-    hist.indices[0] = buf0Size - 1;
-    hist.indices[1] = buf1Size - 1;
-  }
-
-  private long getBiggest(ApproximateHistogram hist) {
-    int j = hist.biggest(hist.indices);
-    int idx = hist.indices[j];
-    hist.indices[j] -= 1;
-    return hist.buffer[j][idx];
-  }
-
-  @Test
-  public void testBiggestIndexFinder() {
-    ApproximateHistogram hist = new ApproximateHistogram(b, h);
-    int n = 3;
-    for (int i=1; i <= n; i++) {
-      hist.add(i);
-    }
-
-    initIndexArray(hist, b);
-    for (int i=1; i <= n; i++) {
-      assertEquals(n - i + 1, getBiggest(hist));
-    }
-
-    n = 2 * b;
-    for (int i=4; i <= n; i++) {
-      hist.add(i);
-    }
-
-    initIndexArray(hist, b);
-    for (int i=1; i <= n; i++) {
-      assertEquals(n - i + 1, getBiggest(hist));
-    }
-
-    hist.add(2*b + 1);
-    n += 1;
-
-    initIndexArray(hist, b);
-    assertEquals(n, getBiggest(hist));
-
-    for (int i=2; i <= n; i += 2) {
-      assertEquals(n - i + 1, getBiggest(hist));
-    }
-  }
-
-  @Test
-  public void testIsBufferEmpty() {
-    ApproximateHistogram hist = new ApproximateHistogram(b, h);
-
-    for (int i=0; i < 3*b; i++) {
-      hist.add(i);
-    }
-    assertEquals(false, hist.isBufferEmpty(2));
-    assertEquals(true, hist.isBufferEmpty(3));
-
-    for (int i=0; i < 2*b; i++) {
-      hist.add(i);
-    }
-    assertEquals(true, hist.isBufferEmpty(2));
-    assertEquals(false, hist.isBufferEmpty(3));
-  }
-
-  @Test
-  public void testHistogramWithNegative() {
-    ApproximateHistogram hist = new ApproximateHistogram();
-    hist.add(-1L);
-    assertEquals(-1L, hist.getQuantile(0.0));
-    assertEquals(-1L, hist.getQuantile(0.5));
-    assertEquals(-1L, hist.getQuantile(1.0));
-  }
-
-  @Test
-  public void testHistogramWithEdgeCases() {
-    ApproximateHistogram hist = new ApproximateHistogram();
-    hist.add(Long.MIN_VALUE);
-    assertEquals(Long.MIN_VALUE, hist.getQuantile(0.0));
-    assertEquals(Long.MIN_VALUE, hist.getQuantile(1.0));
-
-    hist.add(Long.MAX_VALUE);
-    assertEquals(Long.MIN_VALUE, hist.getQuantile(0.0));
-    assertEquals(Long.MAX_VALUE, hist.getQuantile(1.0));
-  }
-
-  @Test
-  public void testQueryZerothQuantile() {
-    // Tests that querying the zeroth quantile does not throw an exception
-    ApproximateHistogram hist = new ApproximateHistogram(b, h);
-    initializeValues(hist, 10, Suppliers.ofInstance(1L));
-    assertEquals(1L, hist.getQuantile(0.0));
-  }
-
-  @Test
-  public void testSmallDataCase() {
-    // Tests that querying the zeroth quantile does not throw an exception
-    ApproximateHistogram hist = new ApproximateHistogram(b, h);
-    initializeValues(hist, 1, Suppliers.ofInstance(1L));
-    assertEquals(1L, hist.getQuantile(0.5));
-  }
-
-  @Test
-  public void testSimpleCase() {
-    ApproximateHistogram hist = new ApproximateHistogram();
-    int n = 10;
-    initializeValues(hist, n, monotonic());
-    for (int i = 1; i <= n; i++) {
-      double q = i / 10.0;
-      assertEquals(i, hist.getQuantile(q), 1.0);
-    }
-  }
-
-  @Test
-  public void testGetQuantiles() {
-    ApproximateHistogram hist = new ApproximateHistogram();
-    int n = 10;
-    initializeValues(hist, n, monotonic());
-    double[] quantiles = new double[n];
-    for (int i = 0; i < n; i++) {
-      quantiles[i] = (i + 1) / 10.0;
-    }
-    long[] results = hist.getQuantiles(quantiles);
-    for (int i = 0; i < n; i++) {
-      long res = results[i];
-      double q = quantiles[i];
-      assertEquals(hist.getQuantile(q), res);
-    }
-  }
-
-  @Test
-  public void testYetAnotherGetQuantiles() {
-    // this test originates from issue CSL-586
-    ApproximateHistogram hist = new ApproximateHistogram();
-    hist.add(0);
-    hist.add(4);
-    hist.add(9);
-    hist.add(8);
-    double[] quantiles = new double[]{0.5, 0.9, 0.99};
-    long[] expected = new long[]{8,9,9};
-    assertArrayEquals(hist.getQuantiles(quantiles), expected);
-  }
-
-  private static void initializeValues(ApproximateHistogram hist, int n, Supplier<Long> what) {
-    for (int i=0; i<n ; i++) {
-      hist.add(what.get());
-    }
-  }
-
-  private static Supplier<Long> monotonic() {
-    return new Supplier<Long>() {
-      long i = 0;
-      @Override public Long get() { return ++i; }
-    };
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/stats/ElapsedTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/stats/ElapsedTest.java b/commons/src/test/java/org/apache/aurora/common/stats/ElapsedTest.java
deleted file mode 100644
index 3343f4f..0000000
--- a/commons/src/test/java/org/apache/aurora/common/stats/ElapsedTest.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.stats;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-import org.apache.aurora.common.util.testing.FakeTicker;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * @author William Farner
- */
-public class ElapsedTest {
-
-  private static final Amount<Long, Time> ONE_SECOND = Amount.of(1L, Time.SECONDS);
-
-  private static final String NAME = "elapsed";
-
-  private FakeTicker ticker;
-
-  @Before
-  public void setUp() {
-    ticker = new FakeTicker();
-    Stats.flush();
-  }
-
-  private Elapsed elapsed(Time granularity) {
-    return new Elapsed(NAME, granularity, ticker);
-  }
-
-  @Test
-  public void testTimeSince() {
-    Elapsed elapsed = elapsed(Time.MILLISECONDS);
-    checkValue(0);
-    ticker.advance(ONE_SECOND);
-    checkValue(1000);
-
-    elapsed.reset();
-    checkValue(0);
-
-    elapsed.reset();
-    ticker.advance(ONE_SECOND);
-    checkValue(1000);
-    ticker.advance(ONE_SECOND);
-    checkValue(2000);
-    ticker.advance(ONE_SECOND);
-    checkValue(3000);
-    ticker.advance(ONE_SECOND);
-    checkValue(4000);
-  }
-
-  @Test
-  public void testGranularity() {
-    Elapsed elapsed = elapsed(Time.HOURS);
-    checkValue(0);
-    ticker.advance(Amount.of(1L, Time.DAYS));
-    checkValue(24);
-
-    elapsed.reset();
-    ticker.advance(Amount.of(1L, Time.MINUTES));
-    checkValue(0);
-  }
-
-  private void checkValue(long expected) {
-    long actual = (Long) Stats.getVariable(NAME).read();
-    assertEquals(expected, actual);
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/stats/EntropyTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/stats/EntropyTest.java b/commons/src/test/java/org/apache/aurora/common/stats/EntropyTest.java
deleted file mode 100644
index 0807986..0000000
--- a/commons/src/test/java/org/apache/aurora/common/stats/EntropyTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.stats;
-
-import com.google.common.collect.Lists;
-import junit.framework.TestCase;
-import org.junit.Test;
-
-import java.util.List;
-
-/**
- * Tests Entropy.
- *
- * @author Gilad Mishne
- */
-public class EntropyTest extends TestCase {
-
-  private void assertEqualsWithDeviation(double expected, double predicted, double deviation) {
-    assertTrue(String.format("%2.4f not within %2.4f distance of %2.4f",
-        predicted, deviation, expected),
-        Math.abs(expected - predicted) <= deviation);
-  }
-
-  @Test
-  public void test() throws Exception {
-    List<Integer> numbers = Lists.newArrayList();
-    double deviation = 0.01;
-
-    assertEqualsWithDeviation(new Entropy<Integer>(numbers).entropy(), 0, deviation);
-
-    numbers.add(1);
-    assertEqualsWithDeviation(new Entropy<Integer>(numbers).entropy(), 0, deviation);
-
-    numbers.add(2);
-    assertEqualsWithDeviation(new Entropy<Integer>(numbers).entropy(), 1, deviation);
-
-    numbers.addAll(Lists.newArrayList(1, 2));
-    assertEqualsWithDeviation(new Entropy<Integer>(numbers).entropy(), 1, deviation);
-    assertEqualsWithDeviation(new Entropy<Integer>(numbers).perplexity(), 2, deviation);
-
-    numbers.addAll(Lists.newArrayList(2, 2, 3, 4));
-    assertEqualsWithDeviation(new Entropy<Integer>(numbers).entropy(), 1.75, deviation);
-
-    numbers.addAll(Lists.newArrayList(1, 1, 1, 1));
-    assertEqualsWithDeviation(new Entropy<Integer>(numbers).entropy(), 1.625, deviation);
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/stats/MergedHistogramTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/stats/MergedHistogramTest.java b/commons/src/test/java/org/apache/aurora/common/stats/MergedHistogramTest.java
deleted file mode 100644
index e71a34f..0000000
--- a/commons/src/test/java/org/apache/aurora/common/stats/MergedHistogramTest.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.stats;
-
-import org.junit.Test;
-
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Data;
-
-import static org.junit.Assert.assertEquals;
-
-public class MergedHistogramTest {
-
-  @Test
-  public void testEmptyMergedHistogram() {
-    ApproximateHistogram empty[] = new ApproximateHistogram[0];
-    Histogram mergedHistogram = ApproximateHistogram.merge(empty);
-
-    assertEquals(0L, mergedHistogram.getQuantile(0.5));
-  }
-
-  @Test
-  public void testMergedSimilarHistogram() {
-    int n = 10;
-    ApproximateHistogram histograms[] = new ApproximateHistogram[n];
-    for (int i = 0; i < n; i++) {
-      ApproximateHistogram h = new ApproximateHistogram();
-      h.add(i);
-      histograms[i] = h;
-    }
-
-    Histogram mergedHistogram = ApproximateHistogram.merge(histograms);
-    assertEquals(0L, mergedHistogram.getQuantile(0.0));
-    assertEquals(1L, mergedHistogram.getQuantile(0.1));
-    assertEquals(5L, mergedHistogram.getQuantile(0.5));
-    assertEquals(9L, mergedHistogram.getQuantile(0.9));
-    assertEquals(9L, mergedHistogram.getQuantile(0.99));
-  }
-
-  @Test
-  public void testMergedDifferentHistogram() {
-    int n = 10;
-    ApproximateHistogram histograms[] = new ApproximateHistogram[n];
-    for (int i = 0; i < n; i++) {
-      ApproximateHistogram h = new ApproximateHistogram(Amount.of(2L + 4*i, Data.KB));
-      h.add(i);
-      histograms[i] = h;
-    }
-
-    Histogram mergedHistogram = ApproximateHistogram.merge(histograms);
-    assertEquals(0L, mergedHistogram.getQuantile(0.0));
-    assertEquals(1L, mergedHistogram.getQuantile(0.1));
-    assertEquals(5L, mergedHistogram.getQuantile(0.5));
-    assertEquals(9L, mergedHistogram.getQuantile(0.9));
-    assertEquals(9L, mergedHistogram.getQuantile(0.99));
-  }
-
-  @Test
-  public void testMergedBigHistogram() {
-    int n = 10;
-    int m = 5000;
-    ApproximateHistogram histograms[] = new ApproximateHistogram[n];
-    int x = 0;
-    for (int i = 0; i < n; i++) {
-      ApproximateHistogram h = new ApproximateHistogram();
-      while(x < m * (i + 1)) {
-        h.add(x);
-        x += 1;
-      }
-      histograms[i] = h;
-    }
-    long sum = m * n;
-
-    double maxError = ApproximateHistogram.DEFAULT_PRECISION.getEpsilon() *
-        ApproximateHistogram.DEFAULT_PRECISION.getN();
-    Histogram mergedHistogram = ApproximateHistogram.merge(histograms);
-    for (int i = 1; i < 10; i++) {
-      double q = i / 10.0;
-      double expected = q * sum;
-      assertEquals(expected, mergedHistogram.getQuantile(q), maxError);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/stats/MovingAverageTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/stats/MovingAverageTest.java b/commons/src/test/java/org/apache/aurora/common/stats/MovingAverageTest.java
deleted file mode 100644
index cce2f69..0000000
--- a/commons/src/test/java/org/apache/aurora/common/stats/MovingAverageTest.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.stats;
-
-import java.util.List;
-
-import com.google.common.collect.Lists;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import org.apache.aurora.common.testing.easymock.EasyMockTest;
-
-import static org.easymock.EasyMock.expect;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-/**
- * Test for MovingAverage.
- *
- * @author William Farner
- */
-public class MovingAverageTest extends EasyMockTest {
-
-  private Stat<Integer> input;
-
-  @Before
-  public void setUp() {
-    input = createMock(new Clazz<Stat<Integer>>() {});
-  }
-
-  @Test
-  public void testEmptySeries() {
-    runTest(Lists.<Integer>newArrayList(), Lists.<Double>newArrayList());
-  }
-
-  @Test
-  public void testConstantValues() {
-    runTest(
-        Lists.newArrayList( 5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5),
-        Lists.newArrayList(5d, 5d, 5d, 5d, 5d, 5d, 5d, 5d, 5d, 5d, 5d, 5d, 5d, 5d, 5d, 5d, 5d, 5d));
-  }
-
-  @Test
-  public void testLinear() {
-    runTest(
-        Lists.newArrayList( 1,    2,  3,    4,  5,    6,  7,    8,  9,   10,   11,   12,   13),
-        Lists.newArrayList(1d, 1.5d, 2d, 2.5d, 3d, 3.5d, 4d, 4.5d, 5d, 5.5d, 6.5d, 7.5d, 8.5d));
-  }
-
-  @Test
-  public void testStep() {
-    runTest(
-        Lists.newArrayList( 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 10, 10, 10, 10, 10),
-        Lists.newArrayList(0d, 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0d, 1d, 2d, 3d, 4d, 5d));
-  }
-
-  private void runTest(List<Integer> inputs, List<Double> expectedOutputs) {
-    expect(input.getName()).andReturn("test").atLeastOnce();
-    for (int value : inputs) {
-      expect(input.read()).andReturn(value);
-    }
-
-    control.replay();
-
-    MovingAverage<Integer> movingAvg = MovingAverage.of(input, 10 /* window size */);
-
-    for (double output : expectedOutputs) {
-      assertThat(movingAvg.sample(), is(output));
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/stats/MovingWindowDeltaTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/stats/MovingWindowDeltaTest.java b/commons/src/test/java/org/apache/aurora/common/stats/MovingWindowDeltaTest.java
deleted file mode 100644
index 857916c..0000000
--- a/commons/src/test/java/org/apache/aurora/common/stats/MovingWindowDeltaTest.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.stats;
-
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-import java.util.concurrent.atomic.AtomicLong;
-
-import com.google.common.base.Supplier;
-
-/**
- * Test for MovingWindowDelta.
- *
- * @author Feng Zhuge
- */
-public class MovingWindowDeltaTest {
-  private static final int DEFAULT_WINDOW_SIZE = 5;
-
-  private AtomicLong externalValue = new AtomicLong();
-
-  public Supplier<AtomicLong> getSupplier() {
-    return new Supplier<AtomicLong>() {
-      @Override
-      public AtomicLong get() {
-        return externalValue;
-      }
-    };
-  }
-
-  @Test
-  public void testOneSample() {
-    MovingWindowDelta<AtomicLong> movingWindowDelta = MovingWindowDelta.of(
-      "test", getSupplier(), DEFAULT_WINDOW_SIZE);
-
-    externalValue.getAndSet(7l);
-    externalValue.getAndSet(11l);
-
-    assertEquals(11l, movingWindowDelta.doSample().longValue());
-  }
-
-  @Test
-  public void testMultipleSamples() {
-    MovingWindowDelta<AtomicLong> movingWindowDelta = MovingWindowDelta.of(
-      "test", getSupplier(), DEFAULT_WINDOW_SIZE);
-
-    externalValue.getAndSet(3l);
-    assertEquals(3l, movingWindowDelta.doSample().longValue());
-    externalValue.getAndSet(8l);
-    assertEquals(8l, movingWindowDelta.doSample().longValue());
-  }
-
-  @Test
-  public void TestExpiringCounts() {
-    MovingWindowDelta<AtomicLong> movingWindowDelta = MovingWindowDelta.of(
-      "test", getSupplier(), DEFAULT_WINDOW_SIZE);
-
-    long expectedDelta;
-    for (long i = 0; i < 100; ++i) {
-      expectedDelta = i < DEFAULT_WINDOW_SIZE ? i + 1 : DEFAULT_WINDOW_SIZE;
-
-      externalValue.getAndSet(i + 1);
-      assertEquals(expectedDelta, movingWindowDelta.doSample().longValue());
-    }
-  }
-
-  @Test
-  public void TestDifferentValueExpiring() {
-    MovingWindowDelta<AtomicLong> movingWindowDelta =
-        MovingWindowDelta.of("test", getSupplier(), 5);
-
-    long ret = 0l;
-    for (long  i = 0; i < 10; ++i) {
-      externalValue.getAndSet(i * i);
-      ret = movingWindowDelta.doSample();
-    }
-    assertEquals(65l, ret);
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/stats/NumericStatExporterTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/stats/NumericStatExporterTest.java b/commons/src/test/java/org/apache/aurora/common/stats/NumericStatExporterTest.java
deleted file mode 100644
index 23a767d..0000000
--- a/commons/src/test/java/org/apache/aurora/common/stats/NumericStatExporterTest.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.stats;
-
-import java.util.Map;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Captor;
-import org.mockito.Matchers;
-import org.mockito.Mock;
-
-import org.apache.aurora.common.application.ShutdownRegistry;
-import org.apache.aurora.common.base.Closure;
-import org.apache.aurora.common.base.Command;
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-import org.apache.aurora.common.testing.mockito.MockitoTest;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.anyLong;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyNoMoreInteractions;
-import static org.mockito.Mockito.when;
-
-/**
- * Unit tests for {@code NumericStatExporter}
- */
-public class NumericStatExporterTest extends MockitoTest {
-  private static final Amount<Long, Time> TEST_EXPORT_INTERVAL = Amount.of(1L, Time.MINUTES);
-  private static final String MOCK_STAT_NAME = "NumericStatExporterTest_mock_stat";
-  private static final int MOCK_STAT_READ_VALUE = 0;
-  private static final int MOCK_STAT_SAMPLED_VALUE = 1;
-
-  @Mock
-  private Closure<Map<String, ? extends Number>> mockExportSink;
-  @Mock
-  private ScheduledExecutorService mockExecutor;
-  @Mock
-  private ShutdownRegistry mockShutdownRegistry;
-  @Mock
-  private RecordingStat<Integer> mockRecordingStat;
-
-  @Captor
-  private ArgumentCaptor<Runnable> runnableCaptor;
-  @Captor
-  private ArgumentCaptor<Command> commandCaptor;
-  @Captor
-  private ArgumentCaptor<Map<String, ? extends Number>> statReadValueMapCaptor;
-
-
-  private NumericStatExporter numericStatExporter;
-
-  @Before
-  public void setUp() {
-    when(mockRecordingStat.getName()).thenReturn(MOCK_STAT_NAME);
-    when(mockRecordingStat.read()).thenReturn(MOCK_STAT_READ_VALUE);
-    when(mockRecordingStat.sample()).thenReturn(MOCK_STAT_SAMPLED_VALUE);
-    Stats.export(mockRecordingStat);
-
-    numericStatExporter
-        = new NumericStatExporter(mockExportSink, mockExecutor, TEST_EXPORT_INTERVAL);
-  }
-
-  @Test
-  public void testStartMethodScheduleExport() {
-    numericStatExporter.start(mockShutdownRegistry);
-
-    // Verify the executor is scheduled properly.
-    verify(mockExecutor).scheduleAtFixedRate(runnableCaptor.capture(),
-        anyLong(), anyLong(), Matchers.<TimeUnit>anyObject());
-    // Verify the behavior of the schedule runnable.
-    runnableCaptor.getValue().run();
-    verify(mockExportSink).execute(statReadValueMapCaptor.capture());
-    // Verify stat reading behavior.
-    assertEquals(MOCK_STAT_READ_VALUE, statReadValueMapCaptor.getValue().get(MOCK_STAT_NAME));
-  }
-
-  @Test
-  public void testStartMethodShutdownRegistryFinalSampleAndExport() {
-    numericStatExporter.start(mockShutdownRegistry);
-
-    // Verify the shutdown registry is called.
-    verify(mockShutdownRegistry).addAction(commandCaptor.capture());
-    // Verify the behavior of the shutdown registry command.
-    commandCaptor.getValue().execute();
-
-    // The shutdown command calls stop(), which we'll test separately.
-
-    // Now verifies the final sample and export behavior.
-    verify(mockExportSink).execute(statReadValueMapCaptor.capture());
-    // Verify stat sampling and reading behavior.
-    assertEquals(MOCK_STAT_SAMPLED_VALUE, statReadValueMapCaptor.getValue().get(MOCK_STAT_NAME));
-  }
-
-  @Test
-  public void testStopMethodAwaitTerminationReturnsFast() throws Exception {
-    when(mockExecutor.awaitTermination(anyLong(), Matchers.<TimeUnit>anyObject()))
-        .thenReturn(true);
-    numericStatExporter.stop();
-    verify(mockExecutor).awaitTermination(eq(1L), eq(TimeUnit.SECONDS));
-    verifyNoMoreInteractions(mockExecutor);
-  }
-
-  @Test
-  public void testStopMethodAwaitTerminationReturnsSlowly() throws Exception {
-    when(mockExecutor.awaitTermination(anyLong(), Matchers.<TimeUnit>anyObject()))
-        .thenReturn(false);
-    numericStatExporter.stop();
-    verify(mockExecutor, times(2)).awaitTermination(eq(1L), eq(TimeUnit.SECONDS));
-    verify(mockExecutor).shutdownNow();
-    verifyNoMoreInteractions(mockExecutor);
-  }
-
-  @Test
-  public void testStopMethodAwaitTerminationInterrupted() throws Exception {
-    when(mockExecutor.awaitTermination(anyLong(), Matchers.<TimeUnit>anyObject()))
-        .thenThrow(new InterruptedException("mock failure"));
-    numericStatExporter.stop();
-    verify(mockExecutor).awaitTermination(eq(1L), eq(TimeUnit.SECONDS));
-    verify(mockExecutor).shutdownNow();
-    verifyNoMoreInteractions(mockExecutor);
-    // We need to reset the thread's interrupt flag so other tests who uses certain
-    // concurrent calls like latches and various waits wouldn't fail.
-    Thread.currentThread().interrupted();
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/stats/PipelineStatsTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/stats/PipelineStatsTest.java b/commons/src/test/java/org/apache/aurora/common/stats/PipelineStatsTest.java
deleted file mode 100644
index b090c64..0000000
--- a/commons/src/test/java/org/apache/aurora/common/stats/PipelineStatsTest.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.stats;
-
-import com.google.common.collect.Sets;
-import org.apache.aurora.common.quantity.Time;
-import org.apache.aurora.common.util.Clock;
-import org.apache.aurora.common.util.testing.FakeClock;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.util.concurrent.atomic.AtomicLong;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-/**
- * Tests the PipelineStats class.
- *
- * @author William Farner
- */
-public class PipelineStatsTest {
-
-  private Clock clock = new FakeClock();
-  private PipelineStats stats;
-
-  @Before
-  public void setUp() {
-    stats = new PipelineStats("test", Sets.newHashSet("a", "b", "c"), clock, Time.MILLISECONDS);
-  }
-
-  @Test
-  public void testEmptyFlow() {
-    PipelineStats.Snapshot pipeline = stats.newSnapshot();
-    pipeline.end();
-
-    checkSample("a", 0, 0);
-    checkSample("b", 0, 0);
-    checkSample("c", 0, 0);
-    checkSample("full", 1, 0);
-  }
-
-  @Test
-  public void testSimpleFlow() throws Exception {
-    PipelineStats.Snapshot pipeline = stats.newSnapshot();
-    pipeline.start("a");
-    clock.waitFor(10);
-    pipeline.start("b");
-    clock.waitFor(20);
-    pipeline.start("c");
-    clock.waitFor(30);
-    pipeline.end();
-
-    checkSample("a", 1, 10);
-    checkSample("b", 1, 20);
-    checkSample("c", 1, 30);
-    checkSample("full", 1, 60);
-  }
-
-  @Test
-  public void testEarlyExit() throws Exception {
-    PipelineStats.Snapshot pipeline = stats.newSnapshot();
-    pipeline.start("a");
-    clock.waitFor(10);
-    pipeline.start("b");
-    clock.waitFor(20);
-    pipeline.end();
-
-    checkSample("a", 1, 10);
-    checkSample("b", 1, 20);
-    checkSample("full", 1, 30);
-  }
-
-  @Test
-  public void testDuplicatedStages() throws Exception {
-    PipelineStats.Snapshot pipeline = stats.newSnapshot();
-    pipeline.start("a");
-    clock.waitFor(10);
-    pipeline.start("b");
-    clock.waitFor(20);
-    pipeline.start("b");
-    clock.waitFor(10);
-    pipeline.start("b");
-    clock.waitFor(50);
-    pipeline.start("c");
-    clock.waitFor(30);
-    pipeline.start("c");
-    clock.waitFor(70);
-    pipeline.end();
-
-    checkSample("a", 1, 10);
-    checkSample("b", 3, 80);
-    checkSample("c", 2, 100);
-    checkSample("full", 1, 190);
-  }
-
-  @Test
-  public void testSimultaneousSnapshots() throws Exception {
-    PipelineStats.Snapshot pipeline1 = stats.newSnapshot();
-    PipelineStats.Snapshot pipeline2 = stats.newSnapshot();
-    pipeline1.start("a");
-    clock.waitFor(10);
-    pipeline2.start("a");
-    pipeline1.start("b");
-    clock.waitFor(20);
-    pipeline2.start("b");
-    clock.waitFor(10);
-    pipeline2.start("c");
-    clock.waitFor(10);
-    pipeline2.end();
-
-    // Only pipeline2 was recorded, so we should not see pipeline1 in the time series yet.
-    checkSample("a", 1, 20);
-    checkSample("b", 1, 10);
-    checkSample("c", 1, 10);
-    checkSample("full", 1, 40);
-
-    pipeline1.start("c");
-    clock.waitFor(30);
-    pipeline1.end();
-
-    // The current sample will now be the sum of pipeline1 and pipeline2.
-    checkSample("a", 2, 30);
-    checkSample("b", 2, 50);
-    checkSample("c", 2, 40);
-    checkSample("full", 2, 120);
-  }
-
-  private void checkSample(String stage, long events, long latency) {
-    AtomicLong eventsCounter = stats.getStatsForStage(stage).getEventCounter();
-    AtomicLong latencyCounter = stats.getStatsForStage(stage).getTotalCounter();
-
-    assertThat(eventsCounter.get(), is(events));
-    assertThat(latencyCounter.get(), is(latency));
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/stats/PrintableHistogramTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/stats/PrintableHistogramTest.java b/commons/src/test/java/org/apache/aurora/common/stats/PrintableHistogramTest.java
deleted file mode 100644
index d2aa019..0000000
--- a/commons/src/test/java/org/apache/aurora/common/stats/PrintableHistogramTest.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.stats;
-
-import junit.framework.TestCase;
-
-public class PrintableHistogramTest extends TestCase {
-
-  public void testPrintHistogram() {
-    PrintableHistogram hist = new PrintableHistogram(10, 20, 30, 40, 50, 60, 70, 80, 90, 100);
-    for (int i = 10; i > 0; i--) {
-      hist.addValue(i * 10, 10 - i);
-    }
-    System.out.println(hist);
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/stats/ReservoirSamplerTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/stats/ReservoirSamplerTest.java b/commons/src/test/java/org/apache/aurora/common/stats/ReservoirSamplerTest.java
deleted file mode 100644
index 4d5a7e9..0000000
--- a/commons/src/test/java/org/apache/aurora/common/stats/ReservoirSamplerTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.stats;
-
-import java.util.List;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import com.google.common.collect.ImmutableList;
-
-import org.apache.aurora.common.testing.easymock.EasyMockTest;
-import org.apache.aurora.common.util.Random;
-
-import static org.easymock.EasyMock.expect;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertEquals;
-
-/**
- * Tests the Reservoir Sampler code
- *
- * @author Delip Rao
- */
-public class ReservoirSamplerTest extends EasyMockTest {
-
-  private Random random;
-
-  @Before
-  public void setUp() throws Exception {
-    random = createMock(Random.class);
-  }
-
-  @Test
-  public void testSampling() throws Exception {
-    int mockValues[] = {3, 4, 5, 6, 7};
-    for (int value : mockValues) {
-      expect(random.nextInt(value + 1)).andReturn(value);
-    }
-    control.replay();
-
-    ReservoirSampler<Integer> sampler = new ReservoirSampler<Integer>(3, random);
-    List<Integer> stream = ImmutableList.of(1, 2, 3, 4, 5, 6, 7, 8);
-    for (int i : stream) {
-      sampler.sample(i);
-    }
-    List<Integer> expectedSamples = ImmutableList.of(1, 2, 3);
-    assertEquals("The samples should be 1, 2, 3", expectedSamples,
-        ImmutableList.copyOf(sampler.getSamples()));
-  }
-
-  @Test
-  public void testNoSampling() throws Exception {
-    // no calls to random.nextInt should happen in this test
-    control.replay();
-    List<Integer> stream = ImmutableList.of(1, 2, 3);
-    // reservoir is larger than the stream. No sampling should happen here.
-    ReservoirSampler<Integer> sampler = new ReservoirSampler<Integer>(20);
-    for (int i : stream) {
-      sampler.sample(i);
-    }
-    assertEquals("The samples should be same as the stream", stream,
-        ImmutableList.copyOf(sampler.getSamples()));
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/stats/StatisticsTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/stats/StatisticsTest.java b/commons/src/test/java/org/apache/aurora/common/stats/StatisticsTest.java
deleted file mode 100644
index 35c076b..0000000
--- a/commons/src/test/java/org/apache/aurora/common/stats/StatisticsTest.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.stats;
-
-import java.util.Arrays;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import com.google.common.collect.ImmutableList;
-
-/**
- * Tests the functionality of the Statistics class.
- *
- * @author William Farner
- */
-public class StatisticsTest extends TestCase {
-  private static final double ERROR_THRESHOLD = 1e-10;
-
-  private static final List<Integer> EMPTY_SET = ImmutableList.of();
-
-  private static final List<Integer> TEST_SET_A = Arrays.asList(76117373, 76167137, 75870125, 75880508, 78099974,
-                                       77810738, 75763975, 78042301, 76109165, 77816921,
-                                       76115544, 76075750, 75391297, 75597249, 77793835,
-                                       76001118, 77752542, 78413670, 60351776, 75607235,
-                                       76057629, 80011920, 24067379, 75767484, 80052983,
-                                       79278613, 75600277);
-
-  private Statistics createAndLoad(List<Integer> values) {
-    Statistics stats = new Statistics();
-    for (long value : values) {
-      stats.accumulate(value);
-    }
-
-    return stats;
-  }
-
-  private void checkWithinThreshold(double expected, double actual) {
-    assertTrue(Math.abs(expected - actual) < ERROR_THRESHOLD);
-  }
-
-  public void testMin() {
-    // min is undefined for an empty set, but it should not fail.
-    Statistics stats = createAndLoad(EMPTY_SET);
-    stats.min();
-
-    stats = createAndLoad(TEST_SET_A);
-    assertEquals(24067379, stats.min());
-  }
-
-  public void testMax() {
-    // max is undefined for an empty set, but it should not fail.
-    Statistics stats = createAndLoad(EMPTY_SET);
-    stats.max();
-
-    stats = createAndLoad(TEST_SET_A);
-    assertEquals(80052983, stats.max());
-  }
-
-  public void testMean() {
-    // mean is undefined for an empty set, but it should not fail.
-    Statistics stats = createAndLoad(EMPTY_SET);
-    stats.mean();
-
-    stats = createAndLoad(TEST_SET_A);
-    checkWithinThreshold(7.435609325925925E7, stats.mean());
-  }
-
-  public void testVariance() {
-    Statistics stats = createAndLoad(EMPTY_SET);
-    assertEquals(Double.NaN, stats.variance());
-
-    stats = createAndLoad(TEST_SET_A);
-    checkWithinThreshold(1.089077613763465E14, stats.variance());
-  }
-
-  public void testStandardDeviation() {
-    Statistics stats = createAndLoad(EMPTY_SET);
-    assertEquals(Double.NaN, stats.standardDeviation());
-
-    stats = createAndLoad(TEST_SET_A);
-    checkWithinThreshold(1.0435888145066835E7, stats.standardDeviation());
-  }
-
-  public void testPopulationSize() {
-    Statistics stats = createAndLoad(EMPTY_SET);
-    assertEquals(0L, stats.populationSize());
-
-    stats = createAndLoad(TEST_SET_A);
-    assertEquals(TEST_SET_A.size(), stats.populationSize());
-  }
-
-  public void testSum() {
-    Statistics stats = createAndLoad(EMPTY_SET);
-    assertEquals(0L, stats.sum());
-
-    stats = createAndLoad(TEST_SET_A);
-    long expectedSum = 0;
-    for (long x: TEST_SET_A) {
-      expectedSum += x;
-    }
-    assertEquals(expectedSum, stats.sum());
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/stats/WindowedHistogramTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/stats/WindowedHistogramTest.java b/commons/src/test/java/org/apache/aurora/common/stats/WindowedHistogramTest.java
deleted file mode 100644
index c93801a..0000000
--- a/commons/src/test/java/org/apache/aurora/common/stats/WindowedHistogramTest.java
+++ /dev/null
@@ -1,234 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.stats;
-
-import java.util.List;
-
-import com.google.common.collect.ImmutableList;
-
-import org.junit.Test;
-
-import org.apache.aurora.common.objectsize.ObjectSizeCalculator;
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Data;
-import org.apache.aurora.common.quantity.Time;
-import org.apache.aurora.common.stats.testing.RealHistogram;
-import org.apache.aurora.common.util.testing.FakeClock;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import static org.apache.aurora.common.stats.WindowedApproxHistogram.DEFAULT_MAX_MEMORY;
-
-/**
- * Tests WindowedHistogram.
- */
-public class WindowedHistogramTest {
-
-  @Test
-  public void testEmptyWinHistogram() {
-    WindowedApproxHistogram wh = new WindowedApproxHistogram();
-    assertEquals(0L, wh.getQuantile(0.0));
-  }
-
-  @Test
-  public void testWinHistogramWithEdgeCases() {
-    FakeClock clock = new FakeClock();
-    Amount<Long, Time> window = Amount.of(100L, Time.MILLISECONDS);
-    int slices = 10;
-    long sliceDuration = window.as(Time.NANOSECONDS) / slices;
-    WindowedApproxHistogram h =
-        new WindowedApproxHistogram(window, slices, DEFAULT_MAX_MEMORY, clock);
-
-    h.add(Long.MIN_VALUE);
-    clock.advance(Amount.of(2 * sliceDuration, Time.NANOSECONDS));
-    assertEquals(Long.MIN_VALUE, h.getQuantile(0.0));
-    assertEquals(Long.MIN_VALUE, h.getQuantile(0.5));
-    assertEquals(Long.MIN_VALUE, h.getQuantile(1.0));
-
-    h.add(Long.MAX_VALUE);
-    clock.advance(Amount.of(2 * sliceDuration, Time.NANOSECONDS));
-    assertEquals(Long.MIN_VALUE, h.getQuantile(0.0));
-    assertEquals(Long.MIN_VALUE, h.getQuantile(0.25));
-    assertEquals(Long.MAX_VALUE, h.getQuantile(0.75));
-    assertEquals(Long.MAX_VALUE, h.getQuantile(1.0));
-  }
-
-  @Test
-  public void testClearedWinHistogram() {
-    FakeClock clock = new FakeClock();
-    Amount<Long, Time> window = Amount.of(100L, Time.MILLISECONDS);
-    int slices = 10;
-    Amount<Long, Time> sliceDuration = Amount.of(
-        window.as(Time.NANOSECONDS) / slices, Time.NANOSECONDS);
-    WindowedHistogram<?> h = createFullHistogram(window, slices, clock);
-    long p0 = h.getQuantile(0.1);
-    long p50 = h.getQuantile(0.5);
-    long p90 = h.getQuantile(0.9);
-    assertFalse(0 == p0);
-    assertFalse(0 == p50);
-    assertFalse(0 == p90);
-
-    h.clear();
-
-    assertEquals(0, h.getQuantile(0.1));
-    assertEquals(0, h.getQuantile(0.5));
-    assertEquals(0, h.getQuantile(0.9));
-
-    // reload the histogram with the exact same values than before
-    fillHistogram(h, sliceDuration, slices, clock);
-
-    assertEquals(p0, h.getQuantile(0.1));
-    assertEquals(p50, h.getQuantile(0.5));
-    assertEquals(p90, h.getQuantile(0.9));
-  }
-
-  @Test
-  public void testSimpleWinHistogram() {
-    FakeClock clock = new FakeClock();
-    Amount<Long, Time> window = Amount.of(100L, Time.MILLISECONDS);
-    int slices = 10;
-    WindowedHistogram<?> wh = createFullHistogram(window, slices, clock);
-
-    // check that the global distribution is the aggregation of all underlying histograms
-    for (int i = 1; i <= slices; i++) {
-      double q = (double) i / slices;
-      assertEquals(i, wh.getQuantile(q), 1.0);
-    }
-
-    // advance in time an forget about old values
-    long sliceDuration = window.as(Time.NANOSECONDS) / slices;
-    clock.advance(Amount.of(sliceDuration, Time.NANOSECONDS));
-    for (int j = 0; j < 1000; j++) {
-      wh.add(11);
-    }
-    assertEquals(2, wh.getQuantile(0.05), 1.0);
-    assertEquals(11, wh.getQuantile(0.99), 1.0);
-  }
-
-  @Test
-  public void testWinHistogramWithGap() {
-    FakeClock clock = new FakeClock();
-    Amount<Long, Time> window = Amount.of(100L, Time.MILLISECONDS);
-    int slices = 10;
-    WindowedHistogram<?> wh = createFullHistogram(window, slices, clock);
-    // wh is a WindowedHistogram of 10 slices + the empty current with values from 1 to 10
-    // [1][2][3][4][5][6][7][8][9][10][.]
-    //                                 ^
-
-    for (int j = 0; j < 1000; j++) {
-      wh.add(100);
-    }
-    // [1][2][3][4][5][6][7][8][9][10][100]
-    //                                  ^
-    // quantiles are computed based on [1] -> [10]
-
-    clock.advance(Amount.of((slices - 1) * 100L / slices, Time.MILLISECONDS));
-    for (int j = 0; j < 1000; j++) {
-      wh.add(200);
-    }
-    // [1][2][3][4][5][6][7][8][200][10][100]
-    //                           ^
-    // quantiles are computed based on [10][100][1][2][3][4][5][6][7][8]
-    // and removing old ones           [10][100][.][.][.][.][.][.][.][.]
-    // all the histograms between 100 and 200 are old and shouldn't matter in the computation of
-    // quantiles.
-    assertEquals(10L, wh.getQuantile(0.25), 1.0);
-    assertEquals(100L, wh.getQuantile(0.75), 1.0);
-
-    clock.advance(Amount.of(100L / slices, Time.MILLISECONDS));
-    // [1][2][3][4][5][6][7][8][200][10][100]
-    //                               ^
-    // quantiles are computed based on [100][1][2][3][4][5][6][7][8][200]
-    // and removing old ones           [100][.][.][.][.][.][.][.][.][200]
-
-    assertEquals(100L, wh.getQuantile(0.25), 1.0);
-    assertEquals(200L, wh.getQuantile(0.75), 1.0);
-
-    // advance a lot in time, everything should be "forgotten"
-    clock.advance(Amount.of(500L, Time.MILLISECONDS));
-    assertEquals(0L, wh.getQuantile(0.5), 1.0);
-  }
-
-  @Test
-  public void testWinHistogramMemory() {
-    ImmutableList.Builder<Amount<Long, Data>> builder = ImmutableList.builder();
-    builder.add(Amount.of(8L, Data.KB));
-    builder.add(Amount.of(12L, Data.KB));
-    builder.add(Amount.of(16L, Data.KB));
-    builder.add(Amount.of(20L, Data.KB));
-    builder.add(Amount.of(24L, Data.KB));
-    builder.add(Amount.of(32L, Data.KB));
-    builder.add(Amount.of(64L, Data.KB));
-    builder.add(Amount.of(256L, Data.KB));
-    builder.add(Amount.of(1L, Data.MB));
-    builder.add(Amount.of(16L, Data.MB));
-    builder.add(Amount.of(32L, Data.MB));
-    List<Amount<Long, Data>> sizes = builder.build();
-
-    // large estimation of the memory used outside of buffers
-    long fixSize = Amount.of(4, Data.KB).as(Data.BYTES);
-
-    for (Amount<Long, Data> maxSize: sizes) {
-      WindowedApproxHistogram hist = new WindowedApproxHistogram(
-          Amount.of(60L, Time.SECONDS), 6, maxSize);
-      hist.add(1L);
-      hist.getQuantile(0.5);
-      long size = ObjectSizeCalculator.getObjectSize(hist);
-      // reverting CI JVM seems to have different memory consumption than mine
-      //assertTrue(size < fixSize + maxSize.as(Data.BYTES));
-    }
-  }
-
-  @Test
-  public void testWinHistogramAccuracy() {
-    FakeClock ticker = new FakeClock();
-    Amount<Long, Time> window = Amount.of(100L, Time.MILLISECONDS);
-    int slices = 10;
-    Amount<Long, Time> sliceDuration = Amount.of(
-        window.as(Time.NANOSECONDS) / slices, Time.NANOSECONDS);
-    WindowedHistogram<?> wh = createFullHistogram(window, slices, ticker);
-    RealHistogram rh = fillHistogram(new RealHistogram(), sliceDuration, slices, new FakeClock());
-
-    assertEquals(wh.getQuantile(0.5), rh.getQuantile(0.5));
-    assertEquals(wh.getQuantile(0.75), rh.getQuantile(0.75));
-    assertEquals(wh.getQuantile(0.9), rh.getQuantile(0.9));
-    assertEquals(wh.getQuantile(0.99), rh.getQuantile(0.99));
-  }
-
-  /**
-   * @return a WindowedHistogram with different value in each underlying Histogram
-   */
-  private WindowedHistogram<?> createFullHistogram(
-      Amount<Long, Time> duration, int slices, FakeClock clock) {
-    long sliceDuration = duration.as(Time.NANOSECONDS) / slices;
-    WindowedApproxHistogram wh = new WindowedApproxHistogram(duration, slices,
-        DEFAULT_MAX_MEMORY, clock);
-    clock.advance(Amount.of(1L, Time.NANOSECONDS));
-
-    return fillHistogram(wh, Amount.of(sliceDuration, Time.NANOSECONDS), slices, clock);
-  }
-
-  private <H extends Histogram> H fillHistogram(H h,
-      Amount<Long, Time> sliceDuration, int slices, FakeClock clock) {
-    for (int i = 1; i <= slices; i++) {
-      for (int j = 0; j < 1000; j++) {
-        h.add(i);
-      }
-      clock.advance(sliceDuration);
-    }
-    return h;
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/stats/WindowedStatsTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/stats/WindowedStatsTest.java b/commons/src/test/java/org/apache/aurora/common/stats/WindowedStatsTest.java
deleted file mode 100644
index c143174..0000000
--- a/commons/src/test/java/org/apache/aurora/common/stats/WindowedStatsTest.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.stats;
-
-import org.junit.Test;
-
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-
-import org.apache.aurora.common.util.testing.FakeClock;
-
-import static org.junit.Assert.assertEquals;
-
-public class WindowedStatsTest {
-  private Amount<Long, Time> window = Amount.of(1L, Time.MINUTES);
-  private int slices = 3;
-  private long sliceDuration = window.as(Time.NANOSECONDS) / slices;
-
-  @Test
-  public void testEmptyStats() {
-    FakeClock clock = new FakeClock();
-    WindowedStatistics ws = new WindowedStatistics(window, slices, clock);
-
-    assertEmpty(ws);
-  }
-
-  @Test
-  public void testStatsCorrectness() {
-    FakeClock clock = new FakeClock();
-    Statistics reference = new Statistics();
-    WindowedStatistics ws = new WindowedStatistics(window, slices, clock);
-
-    for (int i=0; i<1000; i++) {
-      reference.accumulate(i);
-      ws.accumulate(i);
-    }
-    clock.advance(Amount.of(1 + sliceDuration, Time.NANOSECONDS));
-    ws.refresh();
-
-    assertEquals(reference.max(), ws.max());
-    assertEquals(reference.min(), ws.min());
-    assertEquals(reference.populationSize(), ws.populationSize());
-    assertEquals(reference.sum(), ws.sum());
-    assertEquals(reference.range(), ws.range());
-    assertEquals(reference.mean(), ws.mean(), 0.01);
-    assertEquals(reference.variance(), ws.variance(), 0.01);
-    assertEquals(reference.standardDeviation(), ws.standardDeviation(), 0.01);
-
-    for (int i=0; i<1000; i++) {
-      long x = i + 500;
-      reference.accumulate(x);
-      ws.accumulate(x);
-    }
-    clock.advance(Amount.of(sliceDuration, Time.NANOSECONDS));
-    ws.refresh();
-
-    assertEquals(reference.max(), ws.max());
-    assertEquals(reference.min(), ws.min());
-    assertEquals(reference.populationSize(), ws.populationSize());
-    assertEquals(reference.sum(), ws.sum());
-    assertEquals(reference.range(), ws.range());
-    assertEquals(reference.mean(), ws.mean(), 0.01);
-    assertEquals(reference.variance(), ws.variance(), 0.01);
-    assertEquals(reference.standardDeviation(), ws.standardDeviation(), 0.01);
-
-    for (int i=0; i<1000; i++) {
-      long x = i * i;
-      reference.accumulate(x);
-      ws.accumulate(x);
-    }
-    clock.advance(Amount.of(sliceDuration, Time.NANOSECONDS));
-    ws.refresh();
-
-    assertEquals(reference.max(), ws.max());
-    assertEquals(reference.min(), ws.min());
-    assertEquals(reference.populationSize(), ws.populationSize());
-    assertEquals(reference.sum(), ws.sum());
-    assertEquals(reference.range(), ws.range());
-    assertEquals(reference.mean(), ws.mean(), 0.01);
-    assertEquals(reference.variance(), ws.variance(), 0.01);
-    assertEquals(reference.standardDeviation(), ws.standardDeviation(), 0.01);
-  }
-
-  @Test
-  public void testWindowStats() {
-    FakeClock clock = new FakeClock();
-    WindowedStatistics ws = new WindowedStatistics(window, slices, clock);
-    ws.accumulate(1L);
-    assertEmpty(ws);
-
-    clock.advance(Amount.of(1 + sliceDuration, Time.NANOSECONDS));
-    ws.refresh();
-
-    assertEquals(1L, ws.max());
-    assertEquals(1L, ws.min());
-    assertEquals(1L, ws.populationSize());
-    assertEquals(1L, ws.sum());
-    assertEquals(1.0, ws.mean(), 0.01);
-    assertEquals(0.0, ws.standardDeviation(), 0.01);
-
-    clock.advance(Amount.of(slices * sliceDuration, Time.NANOSECONDS));
-    ws.refresh();
-    assertEmpty(ws);
-  }
-
-  @Test
-  public void testCleaningOfExpiredWindows() {
-    FakeClock clock = new FakeClock();
-    WindowedStatistics ws = new WindowedStatistics(window, slices, clock);
-
-    long n = 1000L;
-    for (int i=0; i<n; i++) {
-      ws.accumulate(i);
-    }
-    assertEmpty(ws);
-
-    clock.advance(Amount.of(1 + sliceDuration, Time.NANOSECONDS));
-    ws.refresh();
-    assertEquals(n, ws.populationSize()); // this window is not empty
-
-    clock.advance(Amount.of(100 * sliceDuration, Time.NANOSECONDS));
-    ws.refresh();
-    assertEmpty(ws); // this window has been cleaned
-  }
-
-  @Test
-  public void testAddNewValueToFullWS() {
-    FakeClock clock = new FakeClock();
-    WindowedStatistics ws = new WindowedStatistics(window, slices, clock);
-
-    // AAAAA
-    //      BBBBB
-    //           CCCCC
-    //                DDDDD
-    //                |    |    |    |
-    //---------------------------------> t
-    //                t=0  t=1  t=2  t=3
-
-    // t=0 fill {D}
-    long n = 1000L;
-    for (int i=0; i<n; i++) {
-      ws.accumulate(i);
-    }
-    // read {A,B,C}, which should be empty
-    assertEmpty(ws);
-
-    clock.advance(Amount.of(1 + sliceDuration, Time.NANOSECONDS));
-    ws.refresh();
-    // t=1, read {B,C,D} which shouldn't be empty
-
-    assertEquals(n - 1L, ws.max());
-    assertEquals(0L, ws.min());
-    assertEquals(n, ws.populationSize());
-    assertEquals(n * (n - 1) / 2, ws.sum());
-    assertEquals((n - 1) / 2.0, ws.mean(), 0.01);
-
-    clock.advance(Amount.of(1 + sliceDuration, Time.NANOSECONDS));
-    ws.refresh();
-    // t=2, read {C,D,A} which shouldn't be empty as well
-
-    assertEquals(n - 1L, ws.max());
-    assertEquals(0L, ws.min());
-    assertEquals(n, ws.populationSize());
-    assertEquals(n * (n - 1) / 2, ws.sum());
-    assertEquals((n - 1) / 2.0, ws.mean(), 0.01);
-
-    clock.advance(Amount.of(1 + sliceDuration, Time.NANOSECONDS));
-    ws.refresh();
-    // t=3, read {D,A,B} which shouldn't be empty as well
-
-    assertEquals(n - 1L, ws.max());
-    assertEquals(0L, ws.min());
-    assertEquals(n, ws.populationSize());
-    assertEquals(n * (n - 1) / 2, ws.sum());
-    assertEquals((n - 1) / 2.0, ws.mean(), 0.01);
-
-    clock.advance(Amount.of(1 + sliceDuration, Time.NANOSECONDS));
-    ws.refresh();
-    // t=4, read {A,B,C} which must be empty (cleaned by the Windowed class)
-    assertEmpty(ws);
-  }
-
-  private void assertEmpty(WindowedStatistics ws) {
-    assertEquals(Long.MIN_VALUE, ws.max());
-    assertEquals(Long.MAX_VALUE, ws.min());
-    assertEquals(0L, ws.populationSize());
-    assertEquals(0L, ws.sum());
-    assertEquals(0.0, ws.mean(), 0.01);
-    assertEquals(0.0, ws.standardDeviation(), 0.01);
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/stats/WindowedTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/stats/WindowedTest.java b/commons/src/test/java/org/apache/aurora/common/stats/WindowedTest.java
deleted file mode 100644
index d0f46dd..0000000
--- a/commons/src/test/java/org/apache/aurora/common/stats/WindowedTest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.stats;
-
-import com.google.common.base.Function;
-import com.google.common.base.Supplier;
-
-import org.junit.Test;
-
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-import org.apache.aurora.common.util.Clock;
-import org.apache.aurora.common.util.testing.FakeClock;
-
-import junit.framework.Assert;
-
-/**
- * Test the Windowed abstract class by making a very simple implementation.
- */
-public class WindowedTest {
-
-  private class WindowedBox extends Windowed<Integer[]> {
-    WindowedBox(Amount<Long, Time > window, int slices, Clock clock) {
-      super(Integer[].class, window, slices,
-          new Supplier<Integer[]>() {
-            @Override public Integer[] get() {
-              Integer[] box = new Integer[1];
-              box[0] = 0;
-              return box;
-            }
-          },
-          new Function<Integer[], Integer[]>() {
-            @Override public Integer[] apply(Integer[] xs) {
-              xs[0] = 0;
-              return xs;
-            }
-          }, clock);
-    }
-
-    void increment() {
-      getCurrent()[0] += 1;
-    }
-
-    int sum() {
-      int s = 0;
-      for (Integer[] box : getTenured()) {
-        s += box[0];
-      }
-      return s;
-    }
-  }
-
-  @Test
-  public void testWindowed() {
-    Amount<Long, Time > window = Amount.of(1L, Time.MINUTES);
-    int slices = 3;
-    Amount<Long, Time > delta = Amount.of(
-        Amount.of(1L, Time.MINUTES).as(Time.NANOSECONDS) / 3, Time.NANOSECONDS);
-    FakeClock clock = new FakeClock();
-    WindowedBox win = new WindowedBox(window, slices, clock);
-    // [0][0][0][0]
-    clock.advance(Amount.of(1L, Time.NANOSECONDS));
-
-    win.increment();
-    // [0][0][0][1]
-    Assert.assertEquals(0, win.sum());
-
-    clock.advance(delta);
-    win.increment();
-    win.increment();
-    Assert.assertEquals(1, win.sum());
-    // [0][0][1][2]
-
-    clock.advance(delta);
-    win.increment();
-    win.increment();
-    win.increment();
-    Assert.assertEquals(3, win.sum());
-    // [0][1][2][3]
-
-    clock.advance(delta);
-    win.increment();
-    win.increment();
-    win.increment();
-    win.increment();
-    Assert.assertEquals(6, win.sum());
-    // [1][2][3][4]
-
-    clock.advance(delta);
-    win.increment();
-    win.increment();
-    win.increment();
-    win.increment();
-    win.increment();
-    Assert.assertEquals(9, win.sum());
-    // [2][3][4][5]
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/testing/TearDownRegistryTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/testing/TearDownRegistryTest.java b/commons/src/test/java/org/apache/aurora/common/testing/TearDownRegistryTest.java
deleted file mode 100644
index a9157ec..0000000
--- a/commons/src/test/java/org/apache/aurora/common/testing/TearDownRegistryTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.testing;
-
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import com.google.common.testing.junit4.TearDownTestCase;
-
-import org.junit.Test;
-
-import org.apache.aurora.common.base.Command;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-/**
- * @author John Sirois
- */
-public class TearDownRegistryTest extends TearDownTestCase {
-
-  @Test
-  public void testTearDown() {
-    TearDownRegistry tearDownRegistry = new TearDownRegistry(this);
-    final AtomicBoolean actionExecuted = new AtomicBoolean(false);
-    tearDownRegistry.addAction(new Command() {
-      @Override public void execute() {
-        actionExecuted.set(true);
-      }
-    });
-
-    assertFalse(actionExecuted.get());
-    tearDown();
-    assertTrue(actionExecuted.get());
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/thrift/ThriftConnectionFactoryTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/thrift/ThriftConnectionFactoryTest.java b/commons/src/test/java/org/apache/aurora/common/thrift/ThriftConnectionFactoryTest.java
deleted file mode 100644
index 7876264..0000000
--- a/commons/src/test/java/org/apache/aurora/common/thrift/ThriftConnectionFactoryTest.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.thrift;
-
-import static org.hamcrest.CoreMatchers.allOf;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.CoreMatchers.sameInstance;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.io.IOException;
-import java.net.InetSocketAddress;
-
-import org.apache.thrift.transport.TTransport;
-import org.apache.thrift.transport.TTransportException;
-import org.hamcrest.Matcher;
-import org.junit.Test;
-
-import org.apache.aurora.common.net.pool.Connection;
-import org.apache.aurora.common.net.pool.ObjectPool;
-import org.apache.aurora.common.thrift.testing.MockTSocket;
-
-/**
- * @author John Sirois
- */
-public class ThriftConnectionFactoryTest {
-
-  @Test
-  public void testPreconditions() {
-    try {
-      new ThriftConnectionFactory(null, 1, 1);
-      fail("a non-null host should be required");
-    } catch (NullPointerException e) {
-      // expected
-    }
-
-    try {
-      new ThriftConnectionFactory(" ", 1, 1);
-      fail("a non-blank host should be required");
-    } catch (IllegalArgumentException e) {
-      // expected
-    }
-
-    try {
-      new ThriftConnectionFactory("localhost", 0, 1);
-      fail("a valid concrete remote port should be required");
-    } catch (IllegalArgumentException e) {
-      // expected
-    }
-
-    try {
-      new ThriftConnectionFactory("localhost", 65536, 1);
-      fail("a valid port should be required");
-    } catch (IllegalArgumentException e) {
-      // expected
-    }
-
-    try {
-      new ThriftConnectionFactory("localhost", 65535, 0);
-      fail("a non-zero value for maxConnections should be required");
-    } catch (IllegalArgumentException e) {
-      // expected
-    }
-  }
-
-  @Test
-  public void testMaxConnections() throws TTransportException, IOException {
-    ThriftConnectionFactory thriftConnectionFactory = createConnectionFactory(2);
-
-    Connection<TTransport, InetSocketAddress> connection1 =
-        thriftConnectionFactory.create(ObjectPool.NO_TIMEOUT);
-    assertOpenConnection(connection1);
-
-    Connection<TTransport, InetSocketAddress> connection2 =
-        thriftConnectionFactory.create(ObjectPool.NO_TIMEOUT);
-    assertOpenConnection(connection2);
-    assertThat(connection1, not(sameInstance(connection2)));
-
-    assertNull("Should've reached maximum connections",
-        thriftConnectionFactory.create(ObjectPool.NO_TIMEOUT));
-
-    thriftConnectionFactory.destroy(connection1);
-    assertClosedConnection(connection1);
-
-    Connection<TTransport, InetSocketAddress> connection3 =
-        thriftConnectionFactory.create(ObjectPool.NO_TIMEOUT);
-    assertOpenConnection(connection3);
-    @SuppressWarnings("unchecked") // Needed because type information lost in vargs.
-    Matcher<Connection<TTransport, InetSocketAddress>> matcher =
-      allOf(not(sameInstance(connection1)), not(sameInstance(connection2)));
-    assertThat(connection3, matcher);
-  }
-
-  @Test(expected = IllegalArgumentException.class)
-  public void testInactiveConnectionReturn() {
-    createConnectionFactory(1).destroy(new TTransportConnection(new MockTSocket(),
-        InetSocketAddress.createUnresolved(MockTSocket.HOST, MockTSocket.PORT)));
-  }
-
-  @Test(expected = IllegalArgumentException.class)
-  public void testNullConnectionReturn() {
-    createConnectionFactory(1).destroy(null);
-  }
-
-  private void assertOpenConnection(Connection<TTransport, InetSocketAddress> connection) {
-    assertNotNull(connection);
-    assertTrue(connection.isValid());
-    assertTrue(connection.get().isOpen());
-  }
-
-  private void assertClosedConnection(Connection<TTransport, InetSocketAddress> connection) {
-    assertFalse(connection.isValid());
-    assertFalse(connection.get().isOpen());
-  }
-
-  private ThriftConnectionFactory createConnectionFactory(int maxConnections) {
-    return new ThriftConnectionFactory("foo", 1234, maxConnections) {
-      @Override TTransport createTransport(int timeoutMillis) throws TTransportException {
-        TTransport transport = new MockTSocket();
-        transport.open();
-        return transport;
-      }
-    };
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/thrift/ThriftFactoryTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/thrift/ThriftFactoryTest.java b/commons/src/test/java/org/apache/aurora/common/thrift/ThriftFactoryTest.java
deleted file mode 100644
index 802caa2..0000000
--- a/commons/src/test/java/org/apache/aurora/common/thrift/ThriftFactoryTest.java
+++ /dev/null
@@ -1,242 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.thrift;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicReference;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.common.testing.TearDown;
-import com.google.common.testing.junit4.TearDownTestCase;
-
-import org.apache.thrift.async.AsyncMethodCallback;
-import org.apache.thrift.async.TAsyncClient;
-import org.apache.thrift.async.TAsyncClientManager;
-import org.apache.thrift.protocol.TProtocol;
-import org.apache.thrift.protocol.TProtocolFactory;
-import org.apache.thrift.transport.TNonblockingTransport;
-import org.easymock.EasyMock;
-import org.easymock.IMocksControl;
-import org.junit.Before;
-import org.junit.Test;
-
-import org.apache.aurora.common.net.pool.DynamicHostSet;
-import org.apache.aurora.common.thrift.ThriftFactoryTest.GoodService.AsyncIface;
-import org.apache.aurora.common.thrift.ServiceInstance;
-
-/**
- * @author John Sirois
- */
-public class ThriftFactoryTest extends TearDownTestCase {
-
-  private static final Logger LOG = Logger.getLogger(ThriftFactoryTest.class.getName());
-  private IMocksControl control;
-
-  static class GoodService {
-    public interface Iface {
-      String doWork() throws TResourceExhaustedException;
-    }
-
-    public interface AsyncIface {
-      void doWork(AsyncMethodCallback<String> callback);
-    }
-
-    public static final String DONE = "done";
-
-    public static class Client implements Iface {
-      public Client(TProtocol protocol) {
-        assertNotNull(protocol);
-      }
-
-      @Override public String doWork() throws TResourceExhaustedException {
-        return DONE;
-      }
-    }
-
-    public static class AsyncClient extends TAsyncClient implements AsyncIface {
-      public AsyncClient(TProtocolFactory factory, TAsyncClientManager manager,
-          TNonblockingTransport transport) {
-        super(factory, manager, transport);
-        assertNotNull(factory);
-        assertNotNull(manager);
-        assertNotNull(transport);
-      }
-
-      @Override public void doWork(AsyncMethodCallback<String> callback) {
-        callback.onComplete(DONE);
-      }
-    }
-  }
-
-  static class BadService {
-    public interface Iface {
-      void doWork();
-    }
-    public interface AsyncIface {
-      void doWork(AsyncMethodCallback<Void> callback);
-    }
-
-    public static class Client implements Iface {
-      @Override public void doWork() {
-        throw new UnsupportedOperationException();
-      }
-    }
-  }
-
-  private ImmutableSet<InetSocketAddress> endpoints;
-
-  @Before
-  public void setUp() throws Exception {
-    control = EasyMock.createControl();
-    endpoints = ImmutableSet.of(new InetSocketAddress(5555));
-  }
-
-  @Test(expected = NullPointerException.class)
-  public void testNullServiceInterface() {
-    ThriftFactory.create(null);
-  }
-
-  @Test(expected = IllegalArgumentException.class)
-  public void testBadServiceInterface() {
-    ThriftFactory.create(GoodService.class);
-  }
-
-  @Test(expected = IllegalArgumentException.class)
-  public void testBadServiceImpl() throws ThriftFactory.ThriftFactoryException {
-    ThriftFactory.<BadService.Iface>create(BadService.Iface.class)
-        .build(endpoints);
-  }
-
-  @Test(expected = IllegalArgumentException.class)
-  public void testBadAsyncServiceImpl() throws ThriftFactory.ThriftFactoryException {
-    ThriftFactory.<BadService.AsyncIface>create(BadService.AsyncIface.class)
-        .useFramedTransport(true)
-        .buildAsync(endpoints);
-  }
-
-  @Test(expected = IllegalArgumentException.class)
-  public void testNoBackends() {
-    ThriftFactory.create(GoodService.Iface.class)
-        .build(ImmutableSet.<InetSocketAddress>of());
-  }
-
-  @Test
-  public void testCreate() throws Exception {
-    final AtomicReference<Socket> clientConnection = new AtomicReference<Socket>();
-    final CountDownLatch connected = new CountDownLatch(1);
-    final ServerSocket server = new ServerSocket(0);
-    Thread service = new Thread(new Runnable() {
-      @Override public void run() {
-        try {
-          clientConnection.set(server.accept());
-        } catch (IOException e) {
-          LOG.log(Level.WARNING, "Problem accepting a connection to thrift server", e);
-        } finally {
-          connected.countDown();
-        }
-      }
-    });
-    service.setDaemon(true);
-    service.start();
-
-    try {
-      final Thrift<GoodService.Iface> thrift = ThriftFactory.create(GoodService.Iface.class)
-          .withMaxConnectionsPerEndpoint(1)
-          .build(ImmutableSet.of(new InetSocketAddress(server.getLocalPort())));
-      addTearDown(new TearDown() {
-        @Override public void tearDown() {
-          thrift.close();
-        }
-      });
-
-      GoodService.Iface client = thrift.create();
-
-      assertEquals(GoodService.DONE, client.doWork());
-    } finally {
-      connected.await();
-      server.close();
-    }
-
-    Socket socket = clientConnection.get();
-    assertNotNull(socket);
-    socket.close();
-  }
-
-  @Test(expected = TResourceExhaustedException.class)
-  public void testCreateEmpty() throws Exception {
-    @SuppressWarnings("unchecked")
-    DynamicHostSet<ServiceInstance> emptyHostSet = control.createMock(DynamicHostSet.class);
-    final Thrift<GoodService.Iface> thrift = ThriftFactory.create(GoodService.Iface.class)
-        .withMaxConnectionsPerEndpoint(1)
-        .build(emptyHostSet);
-    addTearDown(new TearDown() {
-      @Override public void tearDown() {
-        thrift.close();
-      }
-    });
-    GoodService.Iface client = thrift.create();
-
-    // This should throw a TResourceExhaustedException
-    client.doWork();
-  }
-
-  @Test
-  public void testCreateAsync()
-      throws IOException, InterruptedException, ThriftFactory.ThriftFactoryException {
-    final String responseHolder[] = new String[] {null};
-    final CountDownLatch done = new CountDownLatch(1);
-    AsyncMethodCallback<String> callback = new AsyncMethodCallback<String>() {
-      @Override
-      public void onComplete(String response) {
-        responseHolder[0] = response;
-        done.countDown();
-      }
-
-      @Override
-      public void onError(Exception throwable) {
-        responseHolder[0] = throwable.toString();
-        done.countDown();
-      }
-    };
-
-    final Thrift<AsyncIface> thrift = ThriftFactory.create(GoodService.AsyncIface.class)
-        .withMaxConnectionsPerEndpoint(1)
-        .useFramedTransport(true)
-        .buildAsync(ImmutableSet.of(new InetSocketAddress(1234)));
-    addTearDown(new TearDown() {
-      @Override public void tearDown() {
-        thrift.close();
-      }
-    });
-    GoodService.AsyncIface client = thrift.builder()
-        .blocking()
-        .create();
-
-    client.doWork(callback);
-    assertTrue("wasn't called back in time, callback got " + responseHolder[0],
-        done.await(5000, TimeUnit.MILLISECONDS));
-    assertEquals(GoodService.DONE, responseHolder[0]);
-  }
-}


[02/21] aurora git commit: Remove unused classes from commons fork.

Posted by wf...@apache.org.
http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/thrift/ThriftTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/thrift/ThriftTest.java b/commons/src/test/java/org/apache/aurora/common/thrift/ThriftTest.java
deleted file mode 100644
index 4b96308..0000000
--- a/commons/src/test/java/org/apache/aurora/common/thrift/ThriftTest.java
+++ /dev/null
@@ -1,931 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.thrift;
-
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.util.concurrent.Callable;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.SynchronousQueue;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-import com.google.common.base.Function;
-
-import org.apache.thrift.TException;
-import org.apache.thrift.async.AsyncMethodCallback;
-import org.apache.thrift.transport.TTransport;
-import org.apache.thrift.transport.TTransportException;
-import org.easymock.Capture;
-import org.easymock.EasyMock;
-import org.easymock.IAnswer;
-import org.easymock.IExpectationSetters;
-import org.easymock.IMocksControl;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import org.apache.aurora.common.base.Command;
-import org.apache.aurora.common.net.loadbalancing.LoadBalancer;
-import org.apache.aurora.common.net.loadbalancing.RequestTracker;
-import org.apache.aurora.common.net.pool.Connection;
-import org.apache.aurora.common.net.pool.ObjectPool;
-import org.apache.aurora.common.net.pool.ResourceExhaustedException;
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-import org.apache.aurora.common.stats.Stat;
-import org.apache.aurora.common.stats.Stats;
-import org.apache.aurora.common.thrift.callers.RetryingCaller;
-import org.apache.aurora.common.thrift.testing.MockTSocket;
-import org.apache.aurora.common.util.concurrent.ForwardingExecutorService;
-
-import static org.easymock.EasyMock.and;
-import static org.easymock.EasyMock.anyLong;
-import static org.easymock.EasyMock.anyObject;
-import static org.easymock.EasyMock.capture;
-import static org.easymock.EasyMock.eq;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.expectLastCall;
-import static org.easymock.EasyMock.isA;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-/**
- * @author John Sirois
- */
-public class ThriftTest {
-
-  private static final Amount<Long, Time> ASYNC_CONNECT_TIMEOUT = Amount.of(1L, Time.SECONDS);
-
-  public static class NotFoundException extends Exception {}
-
-  public interface TestService {
-    int calculateMass(String profileName) throws NotFoundException, TException;
-  }
-
-  public interface TestServiceAsync {
-    void calculateMass(String profileName, AsyncMethodCallback callback) throws TException;
-  }
-
-  private IMocksControl control;
-  private ObjectPool<Connection<TTransport, InetSocketAddress>> connectionPool;
-  private Function<TTransport, TestService> clientFactory;
-  private Function<TTransport, TestServiceAsync> asyncClientFactory;
-  private RequestTracker<InetSocketAddress> requestTracker;
-
-  private AsyncMethodCallback<Integer> callback;
-
-  @SuppressWarnings("unchecked")
-  @Before
-  public void setUp() throws Exception {
-    control = EasyMock.createControl();
-
-    this.connectionPool = control.createMock(ObjectPool.class);
-    this.clientFactory = control.createMock(Function.class);
-    this.asyncClientFactory = control.createMock(Function.class);
-    this.requestTracker = control.createMock(LoadBalancer.class);
-
-    this.callback = control.createMock(AsyncMethodCallback.class);
-  }
-
-  @After
-  public void after() {
-    Stats.flush();
-  }
-
-  @Test
-  public void testDoCallNoDeadline() throws Exception {
-    TestService testService = expectServiceCall(false);
-    expect(testService.calculateMass("jake")).andReturn(42);
-    requestTracker.requestResult(
-        (InetSocketAddress) anyObject(), eq(RequestTracker.RequestResult.SUCCESS), anyLong());
-
-    Thrift<TestService> thrift = createThrift(expectUnusedExecutorService());
-
-    control.replay();
-
-    int userMass = thrift.builder().blocking().create().calculateMass("jake");
-
-    assertEquals(42, userMass);
-
-    assertRequestsTotal(thrift, 1);
-    assertErrorsTotal(thrift, 0);
-    assertReconnectsTotal(thrift, 0);
-    assertTimeoutsTotal(thrift, 0);
-
-    control.verify();
-  }
-
-  @Test
-  public void testDoCallAsync() throws Exception {
-    // Capture the callback that Thift has wrapped around our callback.
-    Capture<AsyncMethodCallback<Integer>> callbackCapture =
-        new Capture<AsyncMethodCallback<Integer>>();
-    expectAsyncServiceCall(false).calculateMass(eq("jake"), capture(callbackCapture));
-    requestTracker.requestResult(
-        (InetSocketAddress) anyObject(), eq(RequestTracker.RequestResult.SUCCESS), anyLong());
-
-    // Verifies that our callback was called.
-    callback.onComplete(42);
-
-    Thrift<TestServiceAsync> thrift = createAsyncThrift(expectUnusedExecutorService());
-
-    control.replay();
-
-    thrift.builder().withConnectTimeout(ASYNC_CONNECT_TIMEOUT).create()
-        .calculateMass("jake", callback);
-
-    // Mimicks the async response from the server.
-    callbackCapture.getValue().onComplete(42);
-
-    assertRequestsTotal(thrift, 1);
-    assertErrorsTotal(thrift, 0);
-    assertReconnectsTotal(thrift, 0);
-    assertTimeoutsTotal(thrift, 0);
-
-    control.verify();
-  }
-
-  @Test
-  public void testDoCallServiceException() throws Exception {
-    TestService testService = expectServiceCall(true);
-    NotFoundException notFoundException = new NotFoundException();
-    expect(testService.calculateMass("jake")).andThrow(notFoundException);
-    requestTracker.requestResult(
-        (InetSocketAddress) anyObject(), eq(RequestTracker.RequestResult.FAILED), anyLong());
-
-    Thrift<TestService> thrift = createThrift(expectUnusedExecutorService());
-
-    control.replay();
-
-    try {
-      thrift.builder().blocking().create().calculateMass("jake");
-      fail("Expected service custom exception to bubble unmodified");
-    } catch (NotFoundException e) {
-      assertSame(notFoundException, e);
-    }
-
-    assertRequestsTotal(thrift, 1);
-    assertErrorsTotal(thrift, 1);
-    assertReconnectsTotal(thrift, 1);
-    assertTimeoutsTotal(thrift, 0);
-
-    control.verify();
-  }
-
-  @Test
-  public void testDoCallAsyncServiceException() throws Exception {
-    NotFoundException notFoundException = new NotFoundException();
-
-    // Capture the callback that Thift has wrapped around our callback.
-    Capture<AsyncMethodCallback<Integer>> callbackCapture =
-        new Capture<AsyncMethodCallback<Integer>>();
-    expectAsyncServiceCall(true).calculateMass(eq("jake"), capture(callbackCapture));
-    requestTracker.requestResult(
-        (InetSocketAddress) anyObject(), eq(RequestTracker.RequestResult.FAILED), anyLong());
-
-    // Verifies that our callback was called.
-    callback.onError(notFoundException);
-
-    Thrift<TestServiceAsync> thrift = createAsyncThrift(expectUnusedExecutorService());
-
-    control.replay();
-
-    thrift.builder().withConnectTimeout(ASYNC_CONNECT_TIMEOUT).create()
-        .calculateMass("jake", callback);
-
-    // Mimicks the async response from the server.
-    callbackCapture.getValue().onError(notFoundException);
-
-    assertRequestsTotal(thrift, 1);
-    assertErrorsTotal(thrift, 1);
-    assertReconnectsTotal(thrift, 1);
-    assertTimeoutsTotal(thrift, 0);
-
-    control.verify();
-  }
-
-  @Test
-  public void testDoCallThriftException() throws Exception {
-    Capture<TTransport> transportCapture = new Capture<TTransport>();
-    TestService testService = expectThriftError(transportCapture);
-    TTransportException tException = new TTransportException();
-    expect(testService.calculateMass("jake")).andThrow(tException);
-    requestTracker.requestResult(
-        (InetSocketAddress) anyObject(), eq(RequestTracker.RequestResult.FAILED), anyLong());
-
-    Thrift<TestService> thrift = createThrift(expectUnusedExecutorService());
-
-    control.replay();
-
-    try {
-      thrift.builder().blocking().create().calculateMass("jake");
-      fail("Expected thrift exception to bubble unmodified");
-    } catch (TException e) {
-      assertSame(tException, e);
-    }
-
-    assertRequestsTotal(thrift, 1);
-    assertErrorsTotal(thrift, 1);
-    assertReconnectsTotal(thrift, 1);
-    assertTimeoutsTotal(thrift, 0);
-
-    assertTrue(transportCapture.hasCaptured());
-    assertFalse("Expected the transport to be forcibly closed when a thrift error is encountered",
-        transportCapture.getValue().isOpen());
-
-    control.verify();
-  }
-
-  @Test
-  public void doCallAsyncThriftException() throws Exception {
-    TTransportException tException = new TTransportException();
-
-    expectAsyncServiceCall(true).calculateMass(eq("jake"), (AsyncMethodCallback) anyObject());
-    expectLastCall().andThrow(tException);
-    requestTracker.requestResult(
-        (InetSocketAddress) anyObject(), eq(RequestTracker.RequestResult.FAILED), anyLong());
-
-    Thrift<TestServiceAsync> thrift = createAsyncThrift(expectUnusedExecutorService());
-
-    callback.onError(tException);
-
-    control.replay();
-
-    thrift.builder().withConnectTimeout(ASYNC_CONNECT_TIMEOUT).create()
-        .calculateMass("jake", callback);
-
-    assertRequestsTotal(thrift, 1);
-    assertErrorsTotal(thrift, 1);
-    assertReconnectsTotal(thrift, 1);
-    assertTimeoutsTotal(thrift, 0);
-
-    control.verify();
-  }
-
-  @Test(expected = IllegalArgumentException.class)
-  public void testDisallowsAsyncWithDeadline() {
-    Config config = Config.builder()
-        .withRequestTimeout(Amount.of(1L, Time.SECONDS))
-        .create();
-
-    new Thrift<TestServiceAsync>(config, connectionPool, requestTracker,
-      "foo", TestServiceAsync.class, asyncClientFactory, true, false).create();
-  }
-
-  @Test
-  public void testDoCallDeadlineMet() throws Exception {
-    TestService testService = expectServiceCall(false);
-    expect(testService.calculateMass("jake")).andReturn(42);
-    requestTracker.requestResult(
-        (InetSocketAddress) anyObject(), eq(RequestTracker.RequestResult.SUCCESS), anyLong());
-
-    ExecutorService executorService = Executors.newSingleThreadExecutor();
-    Thrift<TestService> thrift = createThrift(executorService);
-
-    control.replay();
-
-    int userMass = thrift.builder().withRequestTimeout(Amount.of(1L, Time.DAYS)).create()
-        .calculateMass("jake");
-
-    assertEquals(42, userMass);
-
-    assertRequestsTotal(thrift, 1);
-    assertErrorsTotal(thrift, 0);
-    assertReconnectsTotal(thrift, 0);
-    assertTimeoutsTotal(thrift, 0);
-
-    control.verify();
-  }
-
-  @Test
-  @Ignore("Flaky: https://trac.twitter.com/twttr/ticket/11474")
-  public void testDoCallDeadlineExpired() throws Exception {
-    TestService testService = expectServiceCall(true);
-
-    // Setup a way to verify the callable was cancelled by Thrift when timeout elapsed
-    final CountDownLatch remoteCallComplete = new CountDownLatch(1);
-    final CountDownLatch remoteCallStarted = new CountDownLatch(1);
-    final Command verifyCancelled = control.createMock(Command.class);
-    verifyCancelled.execute();
-    final Object block = new Object();
-    expect(testService.calculateMass("jake")).andAnswer(new IAnswer<Integer>() {
-      @Override public Integer answer() throws TException {
-        try {
-          synchronized (block) {
-            remoteCallStarted.countDown();
-            block.wait();
-          }
-          fail("Expected late work to be cancelled and interrupted");
-        } catch (InterruptedException e) {
-          verifyCancelled.execute();
-        } finally {
-          remoteCallComplete.countDown();
-        }
-        throw new TTransportException();
-      }
-    });
-    requestTracker.requestResult(
-        (InetSocketAddress) anyObject(), eq(RequestTracker.RequestResult.TIMEOUT), anyLong());
-
-    ExecutorService executorService =
-        new ForwardingExecutorService<ExecutorService>(Executors.newSingleThreadExecutor()) {
-          @Override public <T> Future<T> submit(Callable<T> task) {
-            Future<T> future = super.submit(task);
-
-            // make sure the task is started so we can verify it gets cancelled
-            try {
-              remoteCallStarted.await();
-            } catch (InterruptedException e) {
-              throw new RuntimeException(e);
-            }
-
-            return future;
-          }
-        };
-    Thrift<TestService> thrift = createThrift(executorService);
-
-    control.replay();
-
-    try {
-      thrift.builder().withRequestTimeout(Amount.of(1L, Time.NANOSECONDS)).create()
-          .calculateMass("jake");
-      fail("Expected a timeout");
-    } catch (TTimeoutException e) {
-      // expected
-    } finally {
-      remoteCallComplete.await();
-    }
-
-    assertRequestsTotal(thrift, 0);
-    assertErrorsTotal(thrift, 0);
-    assertReconnectsTotal(thrift, 0);
-    assertTimeoutsTotal(thrift, 1);
-
-    control.verify();
-  }
-
-  @Test
-  public void testRetriesNoProblems() throws Exception {
-    expect(expectServiceCall(false).calculateMass("jake")).andReturn(42);
-    requestTracker.requestResult(
-        (InetSocketAddress) anyObject(), eq(RequestTracker.RequestResult.SUCCESS), anyLong());
-
-    Thrift<TestService> thrift = createThrift(expectUnusedExecutorService());
-
-    control.replay();
-
-    TestService testService = thrift.builder().blocking().withRetries(1).create();
-
-    assertEquals(42, testService.calculateMass("jake"));
-
-    assertRequestsTotal(thrift, 1);
-    assertErrorsTotal(thrift, 0);
-    assertReconnectsTotal(thrift, 0);
-    assertTimeoutsTotal(thrift, 0);
-
-    control.verify();
-  }
-
-  @Test
-  public void testAsyncRetriesNoProblems() throws Exception {
-    // Capture the callback that Thift has wrapped around our callback.
-    Capture<AsyncMethodCallback<Integer>> callbackCapture =
-        new Capture<AsyncMethodCallback<Integer>>();
-    expectAsyncServiceCall(false).calculateMass(eq("jake"), capture(callbackCapture));
-    requestTracker.requestResult(
-        (InetSocketAddress) anyObject(), eq(RequestTracker.RequestResult.SUCCESS), anyLong());
-
-    // Verifies that our callback was called.
-    callback.onComplete(42);
-
-    Thrift<TestServiceAsync> thrift = createAsyncThrift(expectUnusedExecutorService());
-
-    control.replay();
-
-    thrift.builder().withRetries(1).withConnectTimeout(ASYNC_CONNECT_TIMEOUT).create()
-        .calculateMass("jake", callback);
-
-    // Mimicks the async response from the server.
-    callbackCapture.getValue().onComplete(42);
-
-    assertRequestsTotal(thrift, 1);
-    assertErrorsTotal(thrift, 0);
-    assertReconnectsTotal(thrift, 0);
-    assertTimeoutsTotal(thrift, 0);
-
-    control.verify();
-  }
-
-  @Test
-  public void testRetriesRecover() throws Exception {
-    // 1st call
-    expect(expectServiceCall(true).calculateMass("jake")).andThrow(new TTransportException());
-    requestTracker.requestResult(
-        (InetSocketAddress) anyObject(), eq(RequestTracker.RequestResult.FAILED), anyLong());
-
-    // 1st retry recovers
-    expect(expectServiceCall(false).calculateMass("jake")).andReturn(42);
-    requestTracker.requestResult(
-        (InetSocketAddress) anyObject(), eq(RequestTracker.RequestResult.SUCCESS), anyLong());
-
-    Thrift<TestService> thrift = createThrift(expectUnusedExecutorService());
-
-    control.replay();
-
-    TestService testService = thrift.builder().blocking().withRetries(1).create();
-
-    assertEquals(42, testService.calculateMass("jake"));
-
-    assertRequestsTotal(thrift, 1);
-    assertErrorsTotal(thrift, 0);
-    assertReconnectsTotal(thrift, 0);
-    assertTimeoutsTotal(thrift, 0);
-
-    control.verify();
-  }
-
-  @Test
-  public void testAsyncRetriesRecover() throws Exception {
-    // Capture the callback that Thift has wrapped around our callback.
-    Capture<AsyncMethodCallback<Integer>> callbackCapture =
-        new Capture<AsyncMethodCallback<Integer>>();
-
-    // 1st call
-    expectAsyncServiceCall(true).calculateMass(eq("jake"), capture(callbackCapture));
-    expectLastCall().andThrow(new TTransportException());
-    requestTracker.requestResult(
-        (InetSocketAddress) anyObject(), eq(RequestTracker.RequestResult.FAILED), anyLong());
-
-    // 1st retry recovers
-    expectAsyncServiceRetry(false).calculateMass(eq("jake"), capture(callbackCapture));
-    requestTracker.requestResult(
-        (InetSocketAddress) anyObject(), eq(RequestTracker.RequestResult.SUCCESS), anyLong());
-
-    // Verifies that our callback was called.
-    callback.onComplete(42);
-
-    Thrift<TestServiceAsync> thrift = createAsyncThrift(expectUnusedExecutorService());
-
-    control.replay();
-
-    thrift.builder().withRetries(1).withConnectTimeout(ASYNC_CONNECT_TIMEOUT).create()
-        .calculateMass("jake", callback);
-
-    // Mimicks the async response from the server.
-    callbackCapture.getValue().onComplete(42);
-
-    assertRequestsTotal(thrift, 1);
-    assertErrorsTotal(thrift, 0);
-    assertReconnectsTotal(thrift, 0);
-    assertTimeoutsTotal(thrift, 0);
-
-    control.verify();
-  }
-
-  @Test
-  public void testRetriesFailure() throws Exception {
-    // 1st call
-    expect(expectServiceCall(true).calculateMass("jake")).andThrow(new TTransportException());
-    requestTracker.requestResult(
-        (InetSocketAddress) anyObject(), eq(RequestTracker.RequestResult.FAILED), anyLong());
-
-    // 1st retry
-    expect(expectServiceCall(true).calculateMass("jake")).andThrow(new TTransportException());
-    requestTracker.requestResult(
-        (InetSocketAddress) anyObject(), eq(RequestTracker.RequestResult.FAILED), anyLong());
-
-    // 2nd retry
-    TTransportException finalRetryException = new TTransportException();
-    expect(expectServiceCall(true).calculateMass("jake")).andThrow(finalRetryException);
-    requestTracker.requestResult(
-        (InetSocketAddress) anyObject(), eq(RequestTracker.RequestResult.FAILED), anyLong());
-
-    Thrift<TestService> thrift = createThrift(expectUnusedExecutorService());
-
-    control.replay();
-
-    TestService testService = thrift.builder().blocking().withRetries(2).create();
-
-    try {
-      testService.calculateMass("jake");
-      fail("Expected an exception to be thrown since all retires failed");
-    } catch (TException e) {
-      assertSame(finalRetryException, e);
-    }
-
-    assertRequestsTotal(thrift, 1);
-    assertErrorsTotal(thrift, 1);
-    assertReconnectsTotal(thrift, 1);
-    assertTimeoutsTotal(thrift, 0);
-
-    control.verify();
-  }
-
-  @Test
-  public void testAsyncRetriesFailure() throws Exception {
-    // 1st call
-    Capture<AsyncMethodCallback<Integer>> callbackCapture1 =
-        new Capture<AsyncMethodCallback<Integer>>();
-    expectAsyncServiceCall(true).calculateMass(eq("jake"), capture(callbackCapture1));
-    requestTracker.requestResult(
-        (InetSocketAddress) anyObject(), eq(RequestTracker.RequestResult.FAILED), anyLong());
-
-    // 1st retry
-    Capture<AsyncMethodCallback<Integer>> callbackCapture2 =
-        new Capture<AsyncMethodCallback<Integer>>();
-    expectAsyncServiceRetry(true).calculateMass(eq("jake"), capture(callbackCapture2));
-    requestTracker.requestResult(
-        (InetSocketAddress) anyObject(), eq(RequestTracker.RequestResult.FAILED), anyLong());
-
-    // 2nd retry
-    Capture<AsyncMethodCallback<Integer>> callbackCapture3 =
-        new Capture<AsyncMethodCallback<Integer>>();
-    expectAsyncServiceRetry(true).calculateMass(eq("jake"), capture(callbackCapture3));
-    requestTracker.requestResult(
-        (InetSocketAddress) anyObject(), eq(RequestTracker.RequestResult.FAILED), anyLong());
-
-    // Verifies that our callback was called.
-    TTransportException returnedException = new TTransportException();
-    callback.onError(returnedException);
-
-    Thrift<TestServiceAsync> thrift = createAsyncThrift(expectUnusedExecutorService());
-
-    control.replay();
-
-    thrift.builder().withRetries(2).withConnectTimeout(ASYNC_CONNECT_TIMEOUT).create()
-        .calculateMass("jake", callback);
-
-    callbackCapture1.getValue().onError(new TTransportException());
-    callbackCapture2.getValue().onError(new IOException());
-    callbackCapture3.getValue().onError(returnedException);
-
-    assertRequestsTotal(thrift, 1);
-    assertErrorsTotal(thrift, 1);
-    assertReconnectsTotal(thrift, 1);
-    assertTimeoutsTotal(thrift, 0);
-
-    control.verify();
-  }
-
-  @Test
-  public void testRetrySelection() throws Exception {
-    expect(expectServiceCall(true).calculateMass("jake")).andThrow(new NotFoundException());
-    requestTracker.requestResult(
-        (InetSocketAddress) anyObject(), eq(RequestTracker.RequestResult.FAILED), anyLong());
-
-    // verify subclasses pass the retry filter
-    class HopelesslyLost extends NotFoundException {}
-    expect(expectServiceCall(true).calculateMass("jake")).andThrow(new HopelesslyLost());
-    requestTracker.requestResult(
-        (InetSocketAddress) anyObject(), eq(RequestTracker.RequestResult.FAILED), anyLong());
-
-    TTransportException nonRetryableException = new TTransportException();
-    expect(expectServiceCall(true).calculateMass("jake")).andThrow(nonRetryableException);
-    requestTracker.requestResult(
-        (InetSocketAddress) anyObject(), eq(RequestTracker.RequestResult.FAILED), anyLong());
-
-    Thrift<TestService> thrift = createThrift(expectUnusedExecutorService());
-
-    control.replay();
-
-    TestService testService =
-        thrift.builder().blocking().withRetries(2).retryOn(NotFoundException.class).create();
-
-    try {
-      testService.calculateMass("jake");
-      fail("Expected n exception to be thrown since all retires failed");
-    } catch (TException e) {
-      assertSame(nonRetryableException, e);
-    }
-
-    assertRequestsTotal(thrift, 1);
-    assertErrorsTotal(thrift, 1);
-    assertReconnectsTotal(thrift, 1);
-    assertTimeoutsTotal(thrift, 0);
-
-    control.verify();
-  }
-
-  @Test
-  public void testAsyncRetrySelection() throws Exception {
-    // verify subclasses pass the retry filter
-    class HopelesslyLost extends NotFoundException {}
-    Capture<AsyncMethodCallback<Integer>> callbackCapture1 =
-        new Capture<AsyncMethodCallback<Integer>>();
-    expectAsyncServiceCall(true).calculateMass(eq("jake"), capture(callbackCapture1));
-    requestTracker.requestResult(
-        (InetSocketAddress) anyObject(), eq(RequestTracker.RequestResult.FAILED), anyLong());
-
-    Capture<AsyncMethodCallback<Integer>> callbackCapture2 =
-        new Capture<AsyncMethodCallback<Integer>>();
-    expectAsyncServiceRetry(true).calculateMass(eq("jake"), capture(callbackCapture2));
-    requestTracker.requestResult(
-        (InetSocketAddress) anyObject(), eq(RequestTracker.RequestResult.FAILED), anyLong());
-
-    // Verifies that our callback was called.
-    TTransportException nonRetryableException = new TTransportException();
-    callback.onError(nonRetryableException);
-
-    Thrift<TestServiceAsync> thrift = createAsyncThrift(expectUnusedExecutorService());
-
-    control.replay();
-
-    TestServiceAsync testService = thrift.builder()
-        .withRetries(2)
-        .retryOn(NotFoundException.class)
-        .withConnectTimeout(ASYNC_CONNECT_TIMEOUT).create();
-
-    testService.calculateMass("jake", callback);
-    callbackCapture1.getValue().onError(new HopelesslyLost());
-    callbackCapture2.getValue().onError(nonRetryableException);
-
-    assertRequestsTotal(thrift, 1);
-    assertErrorsTotal(thrift, 1);
-    assertReconnectsTotal(thrift, 1);
-    assertTimeoutsTotal(thrift, 0);
-
-    control.verify();
-  }
-
-  @Test
-  public void testResourceExhausted() throws Exception {
-    expectConnectionPoolResourceExhausted(Config.DEFAULT_CONNECT_TIMEOUT);
-    Thrift<TestService> thrift = createThrift(expectUnusedExecutorService());
-
-    control.replay();
-
-    TestService testService = thrift.builder().blocking().create();
-
-    try {
-      testService.calculateMass("jake");
-      fail("Expected a TResourceExhaustedException.");
-    } catch (TResourceExhaustedException e) {
-      // Expected
-    }
-
-    control.verify();
-  }
-
-  @Test
-  public void testAsyncResourceExhausted() throws Exception {
-    expectConnectionPoolResourceExhausted(ASYNC_CONNECT_TIMEOUT);
-    Thrift<TestServiceAsync> thrift = createAsyncThrift(expectUnusedExecutorService());
-
-    callback.onError(and(anyObject(), isA(TResourceExhaustedException.class)));
-
-    control.replay();
-
-    TestServiceAsync testService = thrift.builder().withConnectTimeout(ASYNC_CONNECT_TIMEOUT)
-        .create();
-
-    testService.calculateMass("jake", callback);
-
-    control.verify();
-  }
-
-  @Test
-  public void testAsyncDoesNotRetryResourceExhausted() throws Exception {
-    expect(connectionPool.get(ASYNC_CONNECT_TIMEOUT)).andThrow(
-        new ResourceExhaustedException("first"));
-
-    Thrift<TestServiceAsync> thrift = createAsyncThrift(expectUnusedExecutorService());
-
-    callback.onError(and(anyObject(), isA(TResourceExhaustedException.class)));
-
-    control.replay();
-
-    thrift.builder().withRetries(1).withConnectTimeout(ASYNC_CONNECT_TIMEOUT).create()
-        .calculateMass("jake", callback);
-
-    control.verify();
-  }
-
-  @Test
-  public void testConnectionPoolTimeout() throws Exception {
-    expectConnectionPoolTimeout(Config.DEFAULT_CONNECT_TIMEOUT);
-    Thrift<TestService> thrift = createThrift(expectUnusedExecutorService());
-
-    control.replay();
-
-    TestService testService =
-        thrift.builder().blocking().create();
-
-    try {
-      testService.calculateMass("jake");
-      fail("Expected a TTimeoutException.");
-    } catch (TTimeoutException e) {
-      // Expected
-    }
-
-    control.verify();
-  }
-
-  @Test
-  public void testDoCallDeadlineNoThreads() throws Exception {
-    control.replay();
-
-    ExecutorService executorService =
-        new ThreadPoolExecutor(1, 1, 0, TimeUnit.MILLISECONDS, new SynchronousQueue<Runnable>());
-
-    Thrift<TestService> thrift = createThrift(executorService);
-
-    final TestService service =
-          thrift.builder().noRetries().withRequestTimeout(Amount.of(1L, Time.SECONDS)).create();
-
-    final CountDownLatch remoteCallComplete = new CountDownLatch(1);
-    final CountDownLatch remoteCallStarted = new CountDownLatch(1);
-
-    Future<Integer> result = executorService.submit(new Callable<Integer>() {
-      @Override public Integer call() throws Exception {
-        remoteCallStarted.countDown();
-        remoteCallComplete.await();
-        return service.calculateMass("jake");
-      }
-    });
-
-    remoteCallStarted.await();
-    try {
-      service.calculateMass("jake");
-      fail("Expected no available threads to trigger resource exhausted");
-    } catch (TResourceExhaustedException e) {
-      // expected
-    } finally {
-      remoteCallComplete.countDown();
-    }
-
-    try {
-      result.get();
-      fail("Expected no available threads to trigger resource exhausted");
-    } catch (ExecutionException e) {
-      assertEquals(TResourceExhaustedException.class, e.getCause().getClass());
-    }
-
-    control.verify();
-  }
-
-  private ExecutorService expectUnusedExecutorService() {
-    return control.createMock(ExecutorService.class);
-  }
-
-  private static final String STAT_REQUESTS = "requests_events";
-  private static final String STAT_ERRORS = "errors";
-  private static final String STAT_RECONNECTS = "reconnects";
-  private static final String STAT_TIMEOUTS = "timeouts";
-
-  private void assertRequestsTotal(Thrift<?> thrift, int total) {
-    assertRequestStatValue(STAT_REQUESTS, total);
-  }
-
-  private void assertErrorsTotal(Thrift<?> thrift, int total) {
-    assertRequestStatValue(STAT_ERRORS, total);
-  }
-
-  private void assertReconnectsTotal(Thrift<?> thrift, int total) {
-    assertRequestStatValue(STAT_RECONNECTS, total);
-  }
-
-  private void assertTimeoutsTotal(Thrift<?> thrift, int total) {
-    assertRequestStatValue(STAT_TIMEOUTS, total);
-  }
-
-  private void assertRequestStatValue(String statName, long expectedValue) {
-
-    Stat<Long> var = Stats.getVariable("foo_calculateMass_" + statName);
-
-    assertNotNull(var);
-    assertEquals(expectedValue, (long) var.read());
-  }
-
-  private Thrift<TestService> createThrift(ExecutorService executorService) {
-    return new Thrift<TestService>(executorService, connectionPool, requestTracker, "foo",
-        TestService.class, clientFactory, false, false);
-  }
-
-  private Thrift<TestServiceAsync> createAsyncThrift(ExecutorService executorService) {
-    return new Thrift<TestServiceAsync>(executorService, connectionPool, requestTracker, "foo",
-        TestServiceAsync.class, asyncClientFactory, true, false);
-  }
-
-  private TestService expectServiceCall(boolean withFailure)
-      throws ResourceExhaustedException, TimeoutException {
-    Connection<TTransport, InetSocketAddress> connection = expectConnectionPoolGet();
-    return expectServiceCall(connection, withFailure);
-  }
-
-  private TestServiceAsync expectAsyncServiceCall(boolean withFailure)
-      throws ResourceExhaustedException, TimeoutException {
-    return expectAsyncServiceCall(expectConnectionPoolGet(ASYNC_CONNECT_TIMEOUT), withFailure);
-  }
-
-  private TestServiceAsync expectAsyncServiceRetry(boolean withFailure)
-      throws ResourceExhaustedException, TimeoutException {
-    return expectAsyncServiceCall(
-        expectConnectionPoolGet(RetryingCaller.NONBLOCKING_TIMEOUT), withFailure);
-  }
-
-  private TestService expectThriftError(Capture<TTransport> transportCapture)
-      throws ResourceExhaustedException, TimeoutException {
-    Connection<TTransport, InetSocketAddress> connection = expectConnectionPoolGet();
-    return expectServiceCall(connection, transportCapture, true);
-  }
-
-  private Connection<TTransport, InetSocketAddress> expectConnectionPoolGet()
-      throws ResourceExhaustedException, TimeoutException {
-    Connection<TTransport, InetSocketAddress> connection = createConnection();
-    expect(connectionPool.get(Config.DEFAULT_CONNECT_TIMEOUT)).andReturn(connection);
-    return connection;
-  }
-
-  private Connection<TTransport, InetSocketAddress> expectConnectionPoolGet(
-      Amount<Long, Time> timeout) throws ResourceExhaustedException, TimeoutException {
-    Connection<TTransport, InetSocketAddress> connection = createConnection();
-    expect(connectionPool.get(timeout)).andReturn(connection);
-    return connection;
-  }
-
-  private void expectConnectionPoolResourceExhausted(Amount<Long, Time> timeout)
-      throws ResourceExhaustedException, TimeoutException {
-    expect(connectionPool.get(timeout)).andThrow(new ResourceExhaustedException(""));
-  }
-
-  private void expectConnectionPoolTimeout(Amount<Long, Time> timeout)
-      throws ResourceExhaustedException, TimeoutException {
-    expect(connectionPool.get(timeout)).andThrow(new TimeoutException());
-  }
-
-  private Connection<TTransport, InetSocketAddress> createConnection() {
-    return new TTransportConnection(new MockTSocket(),
-        InetSocketAddress.createUnresolved(MockTSocket.HOST, MockTSocket.PORT));
-  }
-
-  private TestService expectServiceCall(Connection<TTransport, InetSocketAddress> connection,
-      boolean withFailure) {
-    return expectServiceCall(connection, null, withFailure);
-  }
-
-  private TestServiceAsync expectAsyncServiceCall(
-      Connection<TTransport, InetSocketAddress> connection, boolean withFailure) {
-    return expectAsyncServiceCall(connection, null, withFailure);
-  }
-
-  private TestService expectServiceCall(Connection<TTransport, InetSocketAddress> connection,
-      Capture<TTransport> transportCapture, boolean withFailure) {
-
-    TestService testService = control.createMock(TestService.class);
-    if (connection != null) {
-      IExpectationSetters<TestService> expectApply = transportCapture == null
-          ? expect(clientFactory.apply(EasyMock.isA(TTransport.class)))
-          : expect(clientFactory.apply(EasyMock.capture(transportCapture)));
-      expectApply.andReturn(testService);
-
-      if (withFailure) {
-        connectionPool.remove(connection);
-      } else {
-        connectionPool.release(connection);
-      }
-    }
-    return testService;
-  }
-
-  private TestServiceAsync expectAsyncServiceCall(
-      Connection<TTransport, InetSocketAddress> connection,
-      Capture<TTransport> transportCapture, boolean withFailure) {
-
-    TestServiceAsync testService = control.createMock(TestServiceAsync.class);
-    if (connection != null) {
-      IExpectationSetters<TestServiceAsync> expectApply = transportCapture == null
-          ? expect(asyncClientFactory.apply(EasyMock.isA(TTransport.class)))
-          : expect(asyncClientFactory.apply(EasyMock.capture(transportCapture)));
-      expectApply.andReturn(testService);
-
-      if (withFailure) {
-        connectionPool.remove(connection);
-      } else {
-        connectionPool.release(connection);
-      }
-    }
-    return testService;
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/thrift/callers/AbstractCallerTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/thrift/callers/AbstractCallerTest.java b/commons/src/test/java/org/apache/aurora/common/thrift/callers/AbstractCallerTest.java
deleted file mode 100644
index e66a9da..0000000
--- a/commons/src/test/java/org/apache/aurora/common/thrift/callers/AbstractCallerTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.thrift.callers;
-
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-import org.apache.aurora.common.testing.easymock.EasyMockTest;
-import org.junit.Before;
-
-import java.lang.reflect.Method;
-
-import static org.easymock.EasyMock.expect;
-
-/**
- * Test framework for testing callers.
- *
- * @author William Farner
- */
-public abstract class AbstractCallerTest extends EasyMockTest {
-  protected final Amount<Long, Time> CONNECT_TIMEOUT = Amount.of(1L, Time.HOURS);
-
-  protected Caller caller;
-
-  protected Method methodA;
-  protected Object[] argsA;
-
-  @Before
-  public final void callerSetUp() throws Exception {
-    caller = createMock(Caller.class);
-    methodA = Object.class.getMethod("toString");
-    argsA = new Object[] {};
-  }
-
-  protected String call(Caller caller) throws Throwable {
-    return (String) caller.call(methodA, argsA, null, CONNECT_TIMEOUT);
-  }
-
-  protected void expectCall(String returnValue) throws Throwable {
-    expect(caller.call(methodA, argsA, null, CONNECT_TIMEOUT)).andReturn(returnValue);
-  }
-
-  protected void expectCall(Throwable thrown) throws Throwable {
-    expect(caller.call(methodA, argsA, null, CONNECT_TIMEOUT)).andThrow(thrown);
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/thrift/callers/DeadlineCallerTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/thrift/callers/DeadlineCallerTest.java b/commons/src/test/java/org/apache/aurora/common/thrift/callers/DeadlineCallerTest.java
deleted file mode 100644
index 6441bd0..0000000
--- a/commons/src/test/java/org/apache/aurora/common/thrift/callers/DeadlineCallerTest.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.thrift.callers;
-
-import com.google.common.testing.TearDown;
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-import org.apache.aurora.common.thrift.TTimeoutException;
-import org.apache.thrift.async.AsyncMethodCallback;
-import org.junit.Before;
-import org.junit.Test;
-
-import javax.annotation.Nullable;
-import java.lang.reflect.Method;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
-
-/**
- * TODO(William Farner): Test async.
- *
- * @author William Farner
- */
-public class DeadlineCallerTest extends AbstractCallerTest {
-
-  private static final Amount<Long, Time> DEADLINE = Amount.of(100L, Time.MILLISECONDS);
-
-  private ExecutorService executorService;
-
-  private DeadlineCaller makeDeadline(final boolean shouldTimeOut) {
-    final CountDownLatch cancelled = new CountDownLatch(1);
-    if (shouldTimeOut) {
-      addTearDown(new TearDown() {
-        @Override public void tearDown() throws Exception {
-          // This will block forever if cancellation does not occur and interrupt the ~indefinite
-          // sleep.
-          cancelled.await();
-        }
-      });
-    }
-
-    Caller sleepyCaller = new CallerDecorator(caller, false) {
-      @Override public Object call(Method method, Object[] args,
-          @Nullable AsyncMethodCallback callback,
-          @Nullable Amount<Long, Time> connectTimeoutOverride) throws Throwable {
-
-        if (shouldTimeOut) {
-          try {
-            Thread.sleep(Long.MAX_VALUE);
-            fail("Expected late work to be cancelled and interrupted");
-          } catch (InterruptedException e) {
-            cancelled.countDown();
-          }
-        }
-
-        return caller.call(method, args, callback, connectTimeoutOverride);
-      }
-    };
-
-    return new DeadlineCaller(sleepyCaller, false, executorService, DEADLINE);
-  }
-
-  @Before
-  public void setUp() {
-    executorService = Executors.newSingleThreadExecutor();
-  }
-
-  @Test
-  public void testSuccess() throws Throwable {
-    DeadlineCaller deadline = makeDeadline(false);
-    expectCall("foo");
-
-    control.replay();
-
-    assertThat(call(deadline), is("foo"));
-  }
-
-  @Test
-  public void testException() throws Throwable {
-    DeadlineCaller deadline = makeDeadline(false);
-    Throwable exception = new IllegalArgumentException();
-    expectCall(exception);
-
-    control.replay();
-
-    try {
-      call(deadline);
-      fail();
-    } catch (Throwable t) {
-      assertThat(t, is(exception));
-    }
-  }
-
-  @Test(expected = TTimeoutException.class)
-  public void testExceedsDeadline() throws Throwable {
-    DeadlineCaller deadline = makeDeadline(true);
-
-    // No call expected, since we time out before it can be made.
-
-    control.replay();
-
-    call(deadline);
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/thrift/callers/RetryingCallerTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/thrift/callers/RetryingCallerTest.java b/commons/src/test/java/org/apache/aurora/common/thrift/callers/RetryingCallerTest.java
deleted file mode 100644
index afe4dc9..0000000
--- a/commons/src/test/java/org/apache/aurora/common/thrift/callers/RetryingCallerTest.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.thrift.callers;
-
-import java.lang.reflect.Method;
-import java.util.concurrent.atomic.AtomicLong;
-
-import com.google.common.cache.CacheBuilder;
-import com.google.common.cache.CacheLoader;
-import com.google.common.cache.LoadingCache;
-import com.google.common.collect.ImmutableSet;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import org.apache.aurora.common.stats.StatsProvider;
-
-import static org.easymock.EasyMock.expect;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
-
-/**
- * TODO(William Farner): Test async.
- *
- * @author William Farner
- */
-public class RetryingCallerTest extends AbstractCallerTest {
-
-  private static final int NUM_RETRIES = 2;
-
-  private static final ImmutableSet<Class<? extends Exception>> NO_RETRYABLE =
-      ImmutableSet.of();
-  private static final ImmutableSet<Class<? extends Exception>> RETRYABLE =
-      ImmutableSet.<Class<? extends Exception>>of(IllegalArgumentException.class);
-
-  private StatsProvider statsProvider;
-
-  @Before
-  public void mySetUp() {
-    statsProvider = createMock(StatsProvider.class);
-  }
-
-  @Test
-  public void testSuccess() throws Throwable {
-    expectCall("foo");
-
-    control.replay();
-
-    RetryingCaller retry = makeRetry(false, NO_RETRYABLE);
-    assertThat(call(retry), is("foo"));
-    assertThat(memoizeGetCounter.get(methodA).get(), is(0L));
-  }
-
-  @Test
-  public void testException() throws Throwable {
-    Throwable exception = nonRetryable();
-    expectCall(exception);
-
-    control.replay();
-
-    RetryingCaller retry = makeRetry(false, NO_RETRYABLE);
-    try {
-      call(retry);
-      fail();
-    } catch (Throwable t) {
-      assertThat(t, is(exception));
-    }
-    assertThat(memoizeGetCounter.get(methodA).get(), is(0L));
-  }
-
-  @Test
-  public void testRetriesSuccess() throws Throwable {
-    expectCall(retryable());
-    expectCall(retryable());
-    expectCall("foo");
-
-    control.replay();
-
-    RetryingCaller retry = makeRetry(false, RETRYABLE);
-    assertThat(call(retry), is("foo"));
-    assertThat(memoizeGetCounter.get(methodA).get(), is((long) NUM_RETRIES));
-  }
-
-  @Test
-  public void testRetryLimit() throws Throwable {
-    expectCall(retryable());
-    expectCall(retryable());
-    Throwable exception = retryable();
-    expectCall(exception);
-
-    control.replay();
-
-    RetryingCaller retry = makeRetry(false, RETRYABLE);
-    try {
-      call(retry);
-      fail();
-    } catch (Throwable t) {
-      assertThat(t, is(exception));
-    }
-    assertThat(memoizeGetCounter.get(methodA).get(), is(2L));
-  }
-
-  private Throwable retryable() {
-    return new IllegalArgumentException();
-  }
-
-  private Throwable nonRetryable() {
-    return new NullPointerException();
-  }
-
-  private LoadingCache<Method, AtomicLong> memoizeGetCounter = CacheBuilder.newBuilder().build(
-      new CacheLoader<Method, AtomicLong>() {
-        @Override public AtomicLong load(Method method) {
-          AtomicLong atomicLong = new AtomicLong();
-          expect(statsProvider.makeCounter("test_" + method.getName() + "_retries"))
-              .andReturn(atomicLong);
-          return atomicLong;
-        }
-      });
-
-  @Override
-  protected void expectCall(String returnValue) throws Throwable {
-    super.expectCall(returnValue);
-    memoizeGetCounter.get(methodA);
-  }
-
-  @Override
-  protected void expectCall(Throwable thrown) throws Throwable {
-    super.expectCall(thrown);
-    memoizeGetCounter.get(methodA);
-  }
-
-  private RetryingCaller makeRetry(boolean async,
-      ImmutableSet<Class<? extends Exception>> retryableExceptions) {
-    return new RetryingCaller(caller, async, statsProvider, "test", NUM_RETRIES,
-        retryableExceptions, false);
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/util/LowResClockTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/util/LowResClockTest.java b/commons/src/test/java/org/apache/aurora/common/util/LowResClockTest.java
deleted file mode 100644
index f564235..0000000
--- a/commons/src/test/java/org/apache/aurora/common/util/LowResClockTest.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.util;
-
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ScheduledFuture;
-import java.util.concurrent.SynchronousQueue;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.apache.aurora.common.util.testing.FakeClock;
-import org.easymock.Capture;
-import org.easymock.IAnswer;
-import org.junit.Test;
-
-import org.apache.aurora.common.base.Command;
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-
-import static org.easymock.EasyMock.anyBoolean;
-import static org.easymock.EasyMock.anyLong;
-import static org.easymock.EasyMock.capture;
-import static org.easymock.EasyMock.captureLong;
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.eq;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.expectLastCall;
-import static org.easymock.EasyMock.replay;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-public class LowResClockTest {
-
-  /**
-   * A FakeClock that overrides the {@link FakeClock#advance(Amount) advance} method to allow a
-   * co-operating thread to execute a synchronous action via {@link #doOnAdvance(Command)}.
-   */
-  static class WaitingFakeClock extends FakeClock {
-    private final SynchronousQueue<CountDownLatch> signalQueue =
-        new SynchronousQueue<CountDownLatch>();
-
-    @Override
-    public void advance(Amount<Long, Time> period) {
-      super.advance(period);
-      CountDownLatch signal = new CountDownLatch(1);
-      try {
-        signalQueue.put(signal);
-      } catch (InterruptedException e) {
-        throw new RuntimeException(e);
-      }
-      try {
-        signal.await();
-      } catch (InterruptedException e) {
-        // ignore
-      }
-    }
-
-    void doOnAdvance(Command action) throws InterruptedException {
-      CountDownLatch signal = signalQueue.take();
-      action.execute();
-      signal.countDown();
-    }
-  }
-
-  static class Tick implements Command {
-    private final Clock clock;
-    private final long period;
-    private final Runnable advancer;
-    private long time;
-
-    Tick(Clock clock, long startTime, long period, Runnable advancer) {
-      this.clock = clock;
-      time = startTime;
-      this.period = period;
-      this.advancer = advancer;
-    }
-
-    @Override
-    public void execute() {
-      if (clock.nowMillis() >= time + period) {
-        advancer.run();
-        time = clock.nowMillis();
-      }
-    }
-  }
-
-  @Test
-  public void testLowResClock() {
-    final WaitingFakeClock clock = new WaitingFakeClock();
-    final long start = clock.nowMillis();
-
-    ScheduledExecutorService mockExecutor = createMock(ScheduledExecutorService.class);
-    final Capture<Runnable> runnable = new Capture<Runnable>();
-    final Capture<Long> period = new Capture<Long>();
-    mockExecutor.scheduleAtFixedRate(capture(runnable), anyLong(), captureLong(period),
-        eq(TimeUnit.MILLISECONDS));
-
-    expectLastCall().andAnswer(new IAnswer<ScheduledFuture<?>>() {
-      public ScheduledFuture<?> answer() {
-        final Thread ticker = new Thread() {
-          @Override
-          public void run() {
-            Tick tick = new Tick(clock, start, period.getValue(), runnable.getValue());
-            try {
-              while (true) {
-                clock.doOnAdvance(tick);
-              }
-            } catch (InterruptedException e) {
-              /* terminate */
-            }
-          }
-        };
-        ticker.setDaemon(true);
-        ticker.start();
-        final ScheduledFuture<?> future = createMock(ScheduledFuture.class);
-        final AtomicBoolean stopped = new AtomicBoolean(false);
-        expect(future.isCancelled()).andAnswer(new IAnswer<Boolean>() {
-          @Override
-          public Boolean answer() throws Throwable {
-            return stopped.get();
-          }
-        }).anyTimes();
-        expect(future.cancel(anyBoolean())).andAnswer(new IAnswer<Boolean>() {
-          @Override
-          public Boolean answer() throws Throwable {
-            ticker.interrupt();
-            stopped.set(true);
-            return true;
-          }
-        });
-        replay(future);
-        return future;
-      }
-    });
-    replay(mockExecutor);
-
-    LowResClock lowRes = new LowResClock(Amount.of(1L, Time.SECONDS), mockExecutor, clock);
-
-    long t = lowRes.nowMillis();
-    clock.advance(Amount.of(100L, Time.MILLISECONDS));
-    assertEquals(t, lowRes.nowMillis());
-
-    clock.advance(Amount.of(900L, Time.MILLISECONDS));
-    assertEquals(t + 1000, lowRes.nowMillis());
-
-    clock.advance(Amount.of(100L, Time.MILLISECONDS));
-    assertEquals(t + 1000, lowRes.nowMillis());
-
-    lowRes.close();
-    try {
-      lowRes.nowMillis();
-      fail("Closed clock should throw exception!");
-    } catch (IllegalStateException e) {
-      /* expected */
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/util/QueueDrainerTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/util/QueueDrainerTest.java b/commons/src/test/java/org/apache/aurora/common/util/QueueDrainerTest.java
deleted file mode 100644
index 66082b8..0000000
--- a/commons/src/test/java/org/apache/aurora/common/util/QueueDrainerTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.util;
-
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.Executor;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import org.apache.aurora.common.testing.easymock.EasyMockTest;
-
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-
-/**
- * @author Srinivasan Rajagopal
- */
-public class QueueDrainerTest extends EasyMockTest {
-  private Executor taskExecutor;
-  private BlockingQueue<RetryingRunnable> blockingQueue;
-  private QueueDrainer queueDrainer;
-
-  @Before
-  public void setUp() {
-    taskExecutor = createMock(Executor.class);
-    blockingQueue = createMock(new Clazz<BlockingQueue<RetryingRunnable>>() { });
-    queueDrainer = new QueueDrainer<RetryingRunnable>(taskExecutor, blockingQueue);
-  }
-
-  @Test
-  public void testDrainsQueue() throws Exception {
-    RetryingRunnable task = createMock(RetryingRunnable.class);
-    expect(blockingQueue.poll()).andReturn(task);
-    taskExecutor.execute(task);
-    control.replay();
-    replay();
-    queueDrainer.run();
-  }
-
-  @Test
-  public void testEmptyQueue() throws Exception {
-    expect(blockingQueue.poll()).andReturn(null);
-    control.replay();
-    replay();
-    queueDrainer.run();
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/util/RateLimitedCommandExecutorTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/util/RateLimitedCommandExecutorTest.java b/commons/src/test/java/org/apache/aurora/common/util/RateLimitedCommandExecutorTest.java
deleted file mode 100644
index 245e07d..0000000
--- a/commons/src/test/java/org/apache/aurora/common/util/RateLimitedCommandExecutorTest.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.util;
-
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
-
-import org.easymock.Capture;
-import org.junit.Before;
-import org.junit.Test;
-
-import org.apache.aurora.common.base.Command;
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-import org.apache.aurora.common.testing.easymock.EasyMockTest;
-
-import static org.easymock.EasyMock.capture;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.anyObject;
-import static org.easymock.EasyMock.eq;
-import static org.easymock.EasyMock.expectLastCall;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-/**
- * @author Srinivasan Rajagopal
- */
-public class RateLimitedCommandExecutorTest extends EasyMockTest {
-  private ScheduledExecutorService taskExecutor;
-  private Amount<Long, Time> intervalBetweenRequests;
-  private RateLimitedCommandExecutor rateLimiter;
-  private Command command;
-  private BlockingQueue<RetryingRunnable<?>> queue;
-  private Runnable queueDrainer;
-
-  @Before
-  public void setUp() throws Exception {
-    command = createMock(Command.class);
-    taskExecutor = createMock(ScheduledExecutorService.class);
-    queue = createMock(new Clazz<BlockingQueue<RetryingRunnable<?>>>() {});
-    queueDrainer = createMock(Runnable.class);
-    intervalBetweenRequests = Amount.of(100L, Time.MILLISECONDS);
-  }
-
-  private RateLimitedCommandExecutor createLimiter() {
-    return new RateLimitedCommandExecutor(
-        taskExecutor,
-        intervalBetweenRequests,
-        queueDrainer,
-        queue);
-  }
-
-  @Test
-  public void testFixedRateClientDequeueIsInvoked() throws Exception {
-    Capture<Runnable> runnableCapture = createCapture();
-    expect(taskExecutor.scheduleWithFixedDelay(
-        capture(runnableCapture),
-        eq(0L),
-        eq((long) intervalBetweenRequests.as(Time.MILLISECONDS)),
-        eq(TimeUnit.MILLISECONDS))).andReturn(null);
-    control.replay();
-
-    rateLimiter = createLimiter();
-    assertTrue(runnableCapture.hasCaptured());
-    assertNotNull(runnableCapture.getValue());
-  }
-
-  @Test
-  public void testEnqueue() throws Exception {
-    expect(taskExecutor.scheduleWithFixedDelay((Runnable) anyObject(),
-        eq(0L),
-        eq((long) intervalBetweenRequests.as(Time.MILLISECONDS)),
-        eq(TimeUnit.MILLISECONDS))).andReturn(null);
-
-    Capture<RetryingRunnable> runnableTaskCapture = createCapture();
-    expect(queue.add(capture(runnableTaskCapture))).andReturn(true);
-    control.replay();
-
-    rateLimiter = createLimiter();
-    rateLimiter.execute("name", command, RuntimeException.class, 1, intervalBetweenRequests);
-    assertTrue(runnableTaskCapture.hasCaptured());
-  }
-
-  @Test
-  public void testDrainQueueCommandHandlesException() {
-    Capture<Runnable> runnableCapture = createCapture();
-    expect(taskExecutor.scheduleWithFixedDelay(
-        capture(runnableCapture),
-        eq(0L),
-        eq((long) intervalBetweenRequests.as(Time.MILLISECONDS)),
-        eq(TimeUnit.MILLISECONDS))).andReturn(null);
-    queueDrainer.run();
-    expectLastCall().andThrow(new RuntimeException());
-
-    control.replay();
-    rateLimiter = createLimiter();
-
-    //Execute the runnable to ensure the exception does not propagate
-    // and potentially kill threads in the executor service.
-    runnableCapture.getValue().run();
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/util/caching/CachingMethodProxyTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/util/caching/CachingMethodProxyTest.java b/commons/src/test/java/org/apache/aurora/common/util/caching/CachingMethodProxyTest.java
deleted file mode 100644
index 4c3b248..0000000
--- a/commons/src/test/java/org/apache/aurora/common/util/caching/CachingMethodProxyTest.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.util.caching;
-
-import com.google.common.base.Predicate;
-import org.easymock.IMocksControl;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.List;
-
-import static org.easymock.EasyMock.createControl;
-import static org.easymock.EasyMock.expect;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertThat;
-
-/**
- * @author William Farner
- */
-public class CachingMethodProxyTest {
-
-  private CachingMethodProxy<Math> proxyBuilder;
-  private Math uncachedMath;
-  private Math cachedMath;
-  private Cache<List, Integer> intCache;
-  private Predicate<Integer> intFilter;
-
-  private IMocksControl control;
-
-  @Before
-  @SuppressWarnings("unchecked")
-  public void setUp() {
-    control = createControl();
-    uncachedMath = control.createMock(Math.class);
-    intCache = control.createMock(Cache.class);
-    intFilter = control.createMock(Predicate.class);
-
-    proxyBuilder = CachingMethodProxy.proxyFor(uncachedMath, Math.class);
-    cachedMath = proxyBuilder.getCachingProxy();
-  }
-
-  @After
-  public void verifyControl() {
-    control.verify();
-  }
-
-  @Test
-  public void testCaches() throws Exception {
-    expectUncachedAdd(1, 2, true);
-    expectUncachedAdd(3, 4, true);
-    expect(intCache.get(Arrays.asList(1, 2))).andReturn(3);
-    expect(intCache.get(Arrays.asList(3, 4))).andReturn(7);
-
-    control.replay();
-
-    proxyBuilder.cache(cachedMath.sum(0, 0), intCache, intFilter)
-        .prepare();
-    assertThat(cachedMath.sum(1, 2), is(3));
-    assertThat(cachedMath.sum(3, 4), is(7));
-    assertThat(cachedMath.sum(1, 2), is(3));
-    assertThat(cachedMath.sum(3, 4), is(7));
-  }
-
-  @Test
-  public void testIgnoresUncachedMethod() throws Exception {
-    expect(uncachedMath.sub(2, 1)).andReturn(1);
-    expect(uncachedMath.sub(2, 1)).andReturn(1);
-
-    control.replay();
-
-    proxyBuilder.cache(cachedMath.sum(0, 0), intCache, intFilter)
-        .prepare();
-    assertThat(cachedMath.sub(2, 1), is(1));
-    assertThat(cachedMath.sub(2, 1), is(1));
-  }
-
-  @Test
-  public void testFilterValue() throws Exception {
-    expectUncachedAdd(1, 2, true);
-    expectUncachedAdd(3, 4, false);
-    expect(intCache.get(Arrays.asList(1, 2))).andReturn(3);
-
-    control.replay();
-
-    proxyBuilder.cache(cachedMath.sum(0, 0), intCache, intFilter)
-        .prepare();
-    assertThat(cachedMath.sum(1, 2), is(3));
-    assertThat(cachedMath.sum(3, 4), is(7));
-    assertThat(cachedMath.sum(1, 2), is(3));
-  }
-
-  @Test(expected = IllegalStateException.class)
-  public void testRequiresOneCache() throws Exception {
-    control.replay();
-
-    proxyBuilder.prepare();
-  }
-
-  @Test
-  public void testExceptionThrown() throws Exception {
-    List<Integer> args = Arrays.asList(1, 2);
-    expect(intCache.get(args)).andReturn(null);
-
-    Math.AddException thrown = new Math.AddException();
-    expect(uncachedMath.sum(1, 2)).andThrow(thrown);
-
-    control.replay();
-
-    proxyBuilder.cache(cachedMath.sum(0, 0), intCache, intFilter)
-            .prepare();
-    try {
-      cachedMath.sum(1, 2);
-    } catch (Math.AddException e) {
-      assertSame(e, thrown);
-    }
-  }
-
-  /* TODO(William Farner): Re-enable once the TODO for checking return value/cache value types is done.
-  @Test(expected = IllegalArgumentException.class)
-  public void testCacheValueAndMethodReturnTypeMismatch() throws Exception {
-    control.replay();
-
-    cachedMath.addDouble(0, 0);
-    proxyBuilder.cache(1, intCache, intFilter)
-        .prepare();
-  }
-  */
-
-  @Test(expected = IllegalStateException.class)
-  public void testRejectsCacheSetupAfterPrepare() throws Exception {
-    control.replay();
-
-    proxyBuilder.cache(cachedMath.sum(0, 0), intCache, intFilter)
-        .prepare();
-    proxyBuilder.cache(null, intCache, intFilter);
-  }
-
-  @Test
-  @SuppressWarnings("unchecked")
-  public void testIgnoresNullValues() throws Exception {
-    // Null return values should not even be considered for entry into the cache, and therefore
-    // should not be passed to the filter.
-
-    Cache<List, Math> crazyCache = control.createMock(Cache.class);
-    Predicate<Math> crazyFilter = control.createMock(Predicate.class);
-
-    expect(crazyCache.get(Arrays.asList(null, null))).andReturn(null);
-    expect(uncachedMath.crazyMath(null, null)).andReturn(null);
-
-    control.replay();
-
-    proxyBuilder.cache(cachedMath.crazyMath(null, null), crazyCache, crazyFilter)
-        .prepare();
-
-    cachedMath.crazyMath(null, null);
-  }
-
-  @Test(expected = IllegalArgumentException.class)
-  @SuppressWarnings("unchecked")
-  public void testRejectsVoidReturn() throws Exception {
-    Cache<List, Void> voidCache = control.createMock(Cache.class);
-    Predicate<Void> voidFilter = control.createMock(Predicate.class);
-
-    control.replay();
-
-    cachedMath.doSomething(null);
-    proxyBuilder.cache(null, voidCache, voidFilter);
-  }
-
-  @Test(expected = IllegalStateException.class)
-  @SuppressWarnings("unchecked")
-  public void testFailsNoCachedCall() throws Exception {
-    Cache<List, Void> voidCache = control.createMock(Cache.class);
-    Predicate<Void> voidFilter = control.createMock(Predicate.class);
-
-    control.replay();
-
-    // No method call was recorded on the proxy, so the builder doesn't know what to cache.
-    proxyBuilder.cache(null, voidCache, voidFilter);
-  }
-
-  @Test(expected = IllegalArgumentException.class)
-  @SuppressWarnings("unchecked")
-  public void testRejectsZeroArgMethods() throws Exception {
-    Cache<List, Math> mathCache = control.createMock(Cache.class);
-    Predicate<Math> mathFilter = control.createMock(Predicate.class);
-
-    control.replay();
-
-    proxyBuilder.cache(cachedMath.doNothing(), mathCache, mathFilter);
-  }
-
-  @Test
-  public void testAllowsSuperclassMethod() throws Exception {
-    SubMath subMath = control.createMock(SubMath.class);
-
-    List<Integer> args = Arrays.asList(1, 2);
-    expect(intCache.get(args)).andReturn(null);
-    expect(subMath.sum(1, 2)).andReturn(3);
-    expect(intFilter.apply(3)).andReturn(true);
-    intCache.put(args, 3);
-
-    control.replay();
-
-    Method add = SubMath.class.getMethod("sum", int.class, int.class);
-
-    CachingMethodProxy<SubMath> proxyBuilder = CachingMethodProxy.proxyFor(subMath, SubMath.class);
-    SubMath cached = proxyBuilder.getCachingProxy();
-    proxyBuilder.cache(cached.sum(0, 0), intCache, intFilter)
-        .prepare();
-
-    cached.sum(1, 2);
-  }
-
-  private void expectUncachedAdd(int a, int b, boolean addToCache) throws Math.AddException {
-    List<Integer> args = Arrays.asList(a, b);
-    expect(intCache.get(args)).andReturn(null);
-    expect(uncachedMath.sum(a, b)).andReturn(a + b);
-    expect(intFilter.apply(a + b)).andReturn(addToCache);
-    if (addToCache) intCache.put(args, a  + b);
-  }
-
-  private interface Math {
-    public int sum(int a, int b) throws AddException;
-
-    public double addDouble(double a, double b) throws AddException;
-
-    public int sub(int a, int b);
-
-    public Math crazyMath(Math a, Math b);
-
-    public Math doNothing();
-
-    public void doSomething(Math a);
-
-    class AddException extends Exception {}
-  }
-
-  private interface SubMath extends Math {
-    public int otherSum(int a, int b);
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/util/caching/LRUCacheTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/util/caching/LRUCacheTest.java b/commons/src/test/java/org/apache/aurora/common/util/caching/LRUCacheTest.java
deleted file mode 100644
index e1a51d2..0000000
--- a/commons/src/test/java/org/apache/aurora/common/util/caching/LRUCacheTest.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.util.caching;
-
-import com.google.common.collect.Lists;
-import org.apache.aurora.common.base.Closure;
-import org.apache.aurora.common.collections.Pair;
-import org.junit.Test;
-
-import java.util.Arrays;
-import java.util.List;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
-
-/**
- * Tests the LRUCache class.
- *
- * @author William Farner
- */
-public class LRUCacheTest {
-
-  @Test
-  public void testEvicts() {
-    int cacheSize = 10;
-    int inserts = 100;
-    LRUCache<Integer, Integer> cache = LRUCache.<Integer, Integer>builder()
-        .maxSize(cacheSize)
-        .build();
-    for (int i = 0; i < inserts; i++) {
-      cache.put(i, i);
-      assertThat(cache.size(), is(Math.min(i + 1, cacheSize)));
-    }
-  }
-
-  @Test
-  public void testEvictsLRU() {
-    int cacheSize = 10;
-
-    final List<Integer> evictedKeys = Lists.newLinkedList();
-
-    Closure<Pair<Integer, Integer>> listener = new Closure<Pair<Integer, Integer>>() {
-        @Override public void execute(Pair<Integer, Integer> evicted) {
-          evictedKeys.add(evicted.getFirst());
-        }
-    };
-
-    LRUCache<Integer, Integer> cache = LRUCache.<Integer, Integer>builder()
-        .maxSize(cacheSize)
-        .evictionListener(listener)
-        .build();
-
-    for (int i = 0; i < cacheSize; i++) {
-      cache.put(i, i);
-    }
-
-    // Access all elements except '3'.
-    for (int access : Arrays.asList(0, 7, 2, 8, 4, 6, 9, 1, 5)) {
-      assertNotNull(cache.get(access));
-    }
-
-    assertThat(evictedKeys.isEmpty(), is(true));
-
-    // This should trigger the eviction.
-    cache.put(cacheSize + 1, cacheSize + 1);
-
-    assertThat(evictedKeys, is(Arrays.asList(3)));
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/zookeeper/CompoundServerSetTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/zookeeper/CompoundServerSetTest.java b/commons/src/test/java/org/apache/aurora/common/zookeeper/CompoundServerSetTest.java
deleted file mode 100644
index a06a814..0000000
--- a/commons/src/test/java/org/apache/aurora/common/zookeeper/CompoundServerSetTest.java
+++ /dev/null
@@ -1,233 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.zookeeper;
-
-import java.net.InetSocketAddress;
-import java.util.Map;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-
-import org.easymock.Capture;
-import org.easymock.EasyMock;
-import org.easymock.IAnswer;
-import org.junit.Before;
-import org.junit.Test;
-
-import org.apache.aurora.common.base.Command;
-import org.apache.aurora.common.net.pool.DynamicHostSet.HostChangeMonitor;
-import org.apache.aurora.common.net.pool.DynamicHostSet.MonitorException;
-import org.apache.aurora.common.testing.easymock.EasyMockTest;
-import org.apache.aurora.common.thrift.ServiceInstance;
-
-import static org.easymock.EasyMock.createControl;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.expectLastCall;
-import static org.easymock.EasyMock.getCurrentArguments;
-
-public class CompoundServerSetTest extends EasyMockTest {
-  private static final Map<String, InetSocketAddress> AUX_PORTS = ImmutableMap.of();
-  private static final InetSocketAddress END_POINT =
-      InetSocketAddress.createUnresolved("foo", 12345);
-
-  private ServerSet.EndpointStatus mockStatus1;
-  private ServerSet.EndpointStatus mockStatus2;
-  private ServerSet.EndpointStatus mockStatus3;
-  private HostChangeMonitor<ServiceInstance> compoundMonitor;
-
-  private ServerSet serverSet1;
-  private ServerSet serverSet2;
-  private ServerSet serverSet3;
-  private Command stop1;
-  private Command stop2;
-  private Command stop3;
-  private CompoundServerSet compoundServerSet;
-
-  private ServiceInstance instance1;
-  private ServiceInstance instance2;
-  private ServiceInstance instance3;
-
-  private void triggerChange(ServiceInstance... hostChanges) {
-    compoundMonitor.onChange(ImmutableSet.copyOf(hostChanges));
-  }
-
-  private void triggerChange(
-      Capture<HostChangeMonitor<ServiceInstance>> capture,
-      ServiceInstance... hostChanges) {
-
-    capture.getValue().onChange(ImmutableSet.copyOf(hostChanges));
-  }
-
-  @Before
-  public void setUpMocks() throws Exception {
-    control = createControl();
-    compoundMonitor = createMock(new Clazz<HostChangeMonitor<ServiceInstance>>() { });
-
-    mockStatus1 = createMock(ServerSet.EndpointStatus.class);
-    mockStatus2 = createMock(ServerSet.EndpointStatus.class);
-    mockStatus3 = createMock(ServerSet.EndpointStatus.class);
-
-    serverSet1 = createMock(ServerSet.class);
-    serverSet2 = createMock(ServerSet.class);
-    serverSet3 = createMock(ServerSet.class);
-
-    stop1 = createMock(Command.class);
-    stop2 = createMock(Command.class);
-    stop3 = createMock(Command.class);
-
-    instance1 = createMock(ServiceInstance.class);
-    instance2 = createMock(ServiceInstance.class);
-    instance3 = createMock(ServiceInstance.class);
-
-    compoundServerSet = new CompoundServerSet(ImmutableList.of(serverSet1, serverSet2, serverSet3));
-  }
-
-  @Test
-  public void testJoin() throws Exception {
-    expect(serverSet1.join(END_POINT, AUX_PORTS, 0)).andReturn(mockStatus1);
-    expect(serverSet2.join(END_POINT, AUX_PORTS, 0)).andReturn(mockStatus2);
-    expect(serverSet3.join(END_POINT, AUX_PORTS, 0)).andReturn(mockStatus3);
-
-    mockStatus1.leave();
-    mockStatus2.leave();
-    mockStatus3.leave();
-
-    control.replay();
-
-    compoundServerSet.join(END_POINT, AUX_PORTS, 0).leave();
-  }
-
-  @Test(expected = Group.JoinException.class)
-  public void testJoinFailure() throws Exception {
-    // Throw exception for the first serverSet join.
-    expect(serverSet1.join(END_POINT, AUX_PORTS))
-        .andThrow(new Group.JoinException("Group join exception", null));
-
-    control.replay();
-    compoundServerSet.join(END_POINT, AUX_PORTS);
-  }
-
-  @Test(expected = ServerSet.UpdateException.class)
-  public void testStatusUpdateFailure() throws Exception {
-    expect(serverSet1.join(END_POINT, AUX_PORTS)).andReturn(mockStatus1);
-    expect(serverSet2.join(END_POINT, AUX_PORTS)).andReturn(mockStatus2);
-    expect(serverSet3.join(END_POINT, AUX_PORTS)).andReturn(mockStatus3);
-
-    mockStatus1.leave();
-    mockStatus2.leave();
-    expectLastCall().andThrow(new ServerSet.UpdateException("Update exception"));
-    mockStatus3.leave();
-
-    control.replay();
-
-    compoundServerSet.join(END_POINT, AUX_PORTS).leave();
-  }
-
-  @Test
-  public void testMonitor() throws Exception {
-    Capture<HostChangeMonitor<ServiceInstance>> set1Capture = createCapture();
-    Capture<HostChangeMonitor<ServiceInstance>> set2Capture = createCapture();
-    Capture<HostChangeMonitor<ServiceInstance>> set3Capture = createCapture();
-
-    expect(serverSet1.watch(
-        EasyMock.<HostChangeMonitor<ServiceInstance>>capture(set1Capture)))
-        .andReturn(stop1);
-    expect(serverSet2.watch(
-        EasyMock.<HostChangeMonitor<ServiceInstance>>capture(set2Capture)))
-        .andReturn(stop2);
-    expect(serverSet3.watch(
-        EasyMock.<HostChangeMonitor<ServiceInstance>>capture(set3Capture)))
-        .andReturn(stop3);
-
-    triggerChange(instance1);
-    triggerChange(instance1, instance2);
-    triggerChange(instance1, instance2, instance3);
-    triggerChange(instance1, instance3);
-    triggerChange(instance1, instance2, instance3);
-    triggerChange(instance3);
-    triggerChange();
-
-    control.replay();
-    compoundServerSet.watch(compoundMonitor);
-
-    // No new instances.
-    triggerChange(set1Capture);
-    triggerChange(set2Capture);
-    triggerChange(set3Capture);
-    // Add one instance from each serverset
-    triggerChange(set1Capture, instance1);
-    triggerChange(set2Capture, instance2);
-    triggerChange(set3Capture, instance3);
-    // Remove instance2
-    triggerChange(set2Capture);
-    // instance1 in both serverset1 and serverset2
-    triggerChange(set2Capture, instance1, instance2);
-    // Remove instances from serversets.
-    triggerChange(set1Capture);
-    triggerChange(set2Capture);
-    triggerChange(set3Capture);
-  }
-
-  @Test(expected = MonitorException.class)
-  public void testMonitorFailure() throws Exception {
-    serverSet1.watch(EasyMock.<HostChangeMonitor<ServiceInstance>>anyObject());
-    expectLastCall().andThrow(new MonitorException("Monitor exception", null));
-
-    control.replay();
-    compoundServerSet.watch(compoundMonitor);
-  }
-
-  @Test
-  public void testInitialChange() throws Exception {
-    // Ensures that a synchronous change notification during the call to monitor() is properly
-    // reported.
-    serverSet1.watch(EasyMock.<HostChangeMonitor<ServiceInstance>>anyObject());
-    expectLastCall().andAnswer(new IAnswer<Command>() {
-      @Override public Command answer() {
-        @SuppressWarnings("unchecked")
-        HostChangeMonitor<ServiceInstance> monitor =
-            (HostChangeMonitor<ServiceInstance>) getCurrentArguments()[0];
-        monitor.onChange(ImmutableSet.of(instance1, instance2));
-        return stop1;
-      }
-    });
-    compoundMonitor.onChange(ImmutableSet.of(instance1, instance2));
-    expect(serverSet2.watch(EasyMock.<HostChangeMonitor<ServiceInstance>>anyObject()))
-        .andReturn(stop2);
-    expect(serverSet3.watch(EasyMock.<HostChangeMonitor<ServiceInstance>>anyObject()))
-        .andReturn(stop3);
-
-    control.replay();
-
-    compoundServerSet.watch(compoundMonitor);
-  }
-
-  @Test
-  public void testStopMonitoring() throws Exception {
-    expect(serverSet1.watch(EasyMock.<HostChangeMonitor<ServiceInstance>>anyObject()))
-        .andReturn(stop1);
-    expect(serverSet2.watch(EasyMock.<HostChangeMonitor<ServiceInstance>>anyObject()))
-        .andReturn(stop2);
-    expect(serverSet3.watch(EasyMock.<HostChangeMonitor<ServiceInstance>>anyObject()))
-        .andReturn(stop3);
-
-    stop1.execute();
-    stop2.execute();
-    stop3.execute();
-
-    control.replay();
-    compoundServerSet.watch(compoundMonitor).execute();
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/test/java/org/apache/aurora/common/zookeeper/DistributedLockTest.java
----------------------------------------------------------------------
diff --git a/commons/src/test/java/org/apache/aurora/common/zookeeper/DistributedLockTest.java b/commons/src/test/java/org/apache/aurora/common/zookeeper/DistributedLockTest.java
deleted file mode 100644
index 00a6648..0000000
--- a/commons/src/test/java/org/apache/aurora/common/zookeeper/DistributedLockTest.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.zookeeper;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import org.apache.aurora.common.zookeeper.testing.BaseZooKeeperTest;
-
-/**
- * @author Florian Leibert
- */
-public class DistributedLockTest extends BaseZooKeeperTest {
-  private static final String LOCK_PATH = "/test/lock";
-
-  private ZooKeeperClient zkClient;
-
-  @Before
-  public void mySetUp() throws Exception {
-    zkClient = createZkClient();
-
-  }
-
-  @Test
-  public void testFailDoubleLock() {
-    DistributedLock lock = new DistributedLockImpl(zkClient, LOCK_PATH);
-    lock.lock();
-    try {
-      lock.lock();
-      fail("Exception expected!");
-    } catch (DistributedLockImpl.LockingException e) {
-      // expected
-    } finally {
-      lock.unlock();
-    }
-  }
-
-  @Test
-  public void testFailUnlock() {
-    DistributedLock lock = new DistributedLockImpl(zkClient, LOCK_PATH);
-    try {
-      lock.unlock();
-      fail("Expected exception while trying to unlock!");
-    } catch (DistributedLockImpl.LockingException e) {
-      // success
-    }
-  }
-
-  @Test
-  public void testTwoLocks() {
-    DistributedLock lock1 = new DistributedLockImpl(zkClient, LOCK_PATH);
-    DistributedLock lock2 = new DistributedLockImpl(zkClient, LOCK_PATH);
-    lock1.lock();
-    List<String> children = expectZkNodes(LOCK_PATH);
-    assertEquals("One child == lock held!", children.size(), 1);
-    lock1.unlock();
-    // check no locks held/empty children
-    children = expectZkNodes(LOCK_PATH);
-    assertEquals("No children, no lock held!", children.size(), 0);
-    lock2.lock();
-    children = expectZkNodes(LOCK_PATH);
-    assertEquals("One child == lock held!", children.size(), 1);
-    lock2.unlock();
-  }
-
-  @Test
-  public void testTwoLocksFailFast() {
-    DistributedLock lock1 = new DistributedLockImpl(zkClient, LOCK_PATH);
-    DistributedLock lock2 = new DistributedLockImpl(zkClient, LOCK_PATH);
-    lock1.lock();
-    boolean acquired = lock2.tryLock(10, TimeUnit.MILLISECONDS);
-    assertFalse("Couldn't acquire lock because it's currently held", acquired);
-    lock1.unlock();
-    lock2.unlock();
-  }
-
-  @Test
-  @Ignore("pending: <http://jira.local.twitter.com/browse/RESEARCH-49>")
-  public void testMultiConcurrentLocking() throws Exception {
-    //TODO(Florian Leibert): this is a bit janky, so let's replace it.
-    for (int i = 0; i < 50; i++) {
-      testConcurrentLocking();
-    }
-    mySetUp();
-  }
-
-  @Test
-  public void testConcurrentLocking() throws Exception {
-    ZooKeeperClient zk1 = createZkClient();
-    ZooKeeperClient zk2 = createZkClient();
-    ZooKeeperClient zk3 = createZkClient();
-
-    final DistributedLock lock1 = new DistributedLockImpl(zk1, LOCK_PATH);
-    final DistributedLock lock2 = new DistributedLockImpl(zk2, LOCK_PATH);
-    final DistributedLock lock3 = new DistributedLockImpl(zk3, LOCK_PATH);
-    Callable<Object> t1 = new Callable<Object>() {
-      @Override
-      public Object call() throws InterruptedException {
-        lock1.lock();
-        try {
-          Thread.sleep(50);
-        } finally {
-          lock1.unlock();
-        }
-        return new Object();
-      }
-    };
-
-    Callable<Object> t2 = new Callable<Object>() {
-      @Override
-      public Object call() throws InterruptedException {
-        lock2.lock();
-        try {
-          Thread.sleep(50);
-        } finally {
-          lock2.unlock();
-        }
-        return new Object();
-      }
-    };
-
-    Callable<Object> t3 = new Callable<Object>() {
-      @Override
-      public Object call() throws InterruptedException {
-        lock3.lock();
-        try {
-          Thread.sleep(50);
-        } finally {
-          lock3.unlock();
-        }
-        return new Object();
-      }
-    };
-
-    //TODO(Florian Leibert): remove this executors stuff and use a latch instead.
-    ExecutorService ex = Executors.newCachedThreadPool();
-    @SuppressWarnings("unchecked") List<Callable<Object>> tlist = Arrays.asList(t1, t2, t3);
-    ex.invokeAll(tlist);
-    assertTrue("No Children left!", expectZkNodes(LOCK_PATH).size() == 0);
-  }
-
-  protected List<String> expectZkNodes(String path) {
-    try {
-      List<String> children = zkClient.get().getChildren(path, null);
-      return children;
-    } catch (Exception e) {
-      throw new RuntimeException(e);
-    }
-  }
-}


[15/21] aurora git commit: Remove unused classes from commons fork.

Posted by wf...@apache.org.
http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/thrift/TTransportConnection.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/thrift/TTransportConnection.java b/commons/src/main/java/org/apache/aurora/common/thrift/TTransportConnection.java
deleted file mode 100644
index 5e5df6d..0000000
--- a/commons/src/main/java/org/apache/aurora/common/thrift/TTransportConnection.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.thrift;
-
-import com.google.common.base.Preconditions;
-import org.apache.aurora.common.net.pool.Connection;
-import org.apache.aurora.common.net.pool.ConnectionPool;
-import org.apache.thrift.transport.TTransport;
-
-import java.net.InetSocketAddress;
-
-/**
- * A {@link ConnectionPool} compatible thrift connection that can work with any valid thrift
- * transport.
- *
- * @author John Sirois
- */
-public class TTransportConnection implements Connection<TTransport, InetSocketAddress> {
-
-  private final TTransport transport;
-  private final InetSocketAddress endpoint;
-
-  public TTransportConnection(TTransport transport, InetSocketAddress endpoint) {
-    this.transport = Preconditions.checkNotNull(transport);
-    this.endpoint = Preconditions.checkNotNull(endpoint);
-  }
-
-  /**
-   * Returns {@code true} if the underlying transport is still open.  To invalidate a transport it
-   * should be closed.
-   *
-   * <p>TODO(John Sirois): it seems like an improper soc to have validity testing here and not also an
-   * invalidation method - correct or accept
-   */
-  @Override
-  public boolean isValid() {
-    return transport.isOpen();
-  }
-
-  @Override
-  public TTransport get() {
-    return transport;
-  }
-
-  @Override
-  public void close() {
-    transport.close();
-  }
-
-  @Override
-  public InetSocketAddress getEndpoint() {
-    return endpoint;
-  }
-
-  @Override
-  public String toString() {
-    return endpoint.toString();
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/thrift/Thrift.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/thrift/Thrift.java b/commons/src/main/java/org/apache/aurora/common/thrift/Thrift.java
deleted file mode 100644
index b36b46e..0000000
--- a/commons/src/main/java/org/apache/aurora/common/thrift/Thrift.java
+++ /dev/null
@@ -1,390 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.thrift;
-
-import java.io.IOException;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.net.InetSocketAddress;
-import java.util.List;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.RejectedExecutionException;
-
-import com.google.common.base.Function;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Lists;
-import com.google.common.util.concurrent.ThreadFactoryBuilder;
-
-import org.apache.aurora.common.thrift.callers.DebugCaller;
-import org.apache.thrift.async.AsyncMethodCallback;
-import org.apache.thrift.transport.TTransport;
-import org.apache.thrift.transport.TTransportException;
-
-import org.apache.aurora.common.base.MorePreconditions;
-import org.apache.aurora.common.net.loadbalancing.RequestTracker;
-import org.apache.aurora.common.net.pool.Connection;
-import org.apache.aurora.common.net.pool.ObjectPool;
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-import org.apache.aurora.common.stats.StatsProvider;
-import org.apache.aurora.common.thrift.callers.Caller;
-import org.apache.aurora.common.thrift.callers.DeadlineCaller;
-import org.apache.aurora.common.thrift.callers.RetryingCaller;
-import org.apache.aurora.common.thrift.callers.StatTrackingCaller;
-import org.apache.aurora.common.thrift.callers.ThriftCaller;
-
-/**
- * A generic thrift client that handles reconnection in the case of protocol errors, automatic
- * retries, call deadlines and call statistics tracking.  This class aims for behavior compatible
- * with the <a href="http://github.com/fauna/thrift_client">generic ruby thrift client</a>.
- *
- * <p>In order to enforce call deadlines for synchronous clients, this class uses an
- * {@link java.util.concurrent.ExecutorService}.  If a custom executor is supplied, it should throw
- * a subclass of {@link RejectedExecutionException} to signal thread resource exhaustion, in which
- * case the client will fail fast and propagate the event as a {@link TResourceExhaustedException}.
- *
- * TODO(William Farner): Before open sourcing, look into changing the current model of wrapped proxies
- *    to use a single proxy and wrapped functions for decorators.
- *
- * @author John Sirois
- */
-public class Thrift<T> {
-
-  /**
-   * The default thrift call configuration used if none is specified.
-   *
-   * Specifies the following settings:
-   * <ul>
-   * <li>global call timeout: 1 second
-   * <li>call retries: 0
-   * <li>retryable exceptions: TTransportException (network exceptions including socket timeouts)
-   * <li>wait for connections: true
-   * <li>debug: false
-   * </ul>
-   */
-  public static final Config DEFAULT_CONFIG = Config.builder()
-      .withRequestTimeout(Amount.of(1L, Time.SECONDS))
-      .noRetries()
-      .retryOn(TTransportException.class) // if maxRetries is set non-zero
-      .create();
-
-  /**
-   * The default thrift call configuration used for an async client if none is specified.
-   *
-   * Specifies the following settings:
-   * <ul>
-   * <li>global call timeout: none
-   * <li>call retries: 0
-   * <li>retryable exceptions: IOException, TTransportException
-   *    (network exceptions but not timeouts)
-   * <li>wait for connections: true
-   * <li>debug: false
-   * </ul>
-   */
-  @SuppressWarnings("unchecked")
-  public static final Config DEFAULT_ASYNC_CONFIG = Config.builder(DEFAULT_CONFIG)
-      .withRequestTimeout(Amount.of(0L, Time.SECONDS))
-      .noRetries()
-      .retryOn(ImmutableSet.<Class<? extends Exception>>builder()
-          .add(IOException.class)
-          .add(TTransportException.class).build()) // if maxRetries is set non-zero
-      .create();
-
-  private final Config defaultConfig;
-  private final ExecutorService executorService;
-  private final ObjectPool<Connection<TTransport, InetSocketAddress>> connectionPool;
-  private final RequestTracker<InetSocketAddress> requestTracker;
-  private final String serviceName;
-  private final Class<T> serviceInterface;
-  private final Function<TTransport, T> clientFactory;
-  private final boolean async;
-  private final boolean withSsl;
-
-  /**
-   * Constructs an instance with the {@link #DEFAULT_CONFIG}, cached thread pool
-   * {@link ExecutorService}, and synchronous calls.
-   *
-   * @see #Thrift(Config, ExecutorService, ObjectPool, RequestTracker , String, Class, Function,
-   *     boolean, boolean)
-   */
-  public Thrift(ObjectPool<Connection<TTransport, InetSocketAddress>> connectionPool,
-      RequestTracker<InetSocketAddress> requestTracker,
-      String serviceName, Class<T> serviceInterface, Function<TTransport, T> clientFactory) {
-
-    this(DEFAULT_CONFIG, connectionPool, requestTracker, serviceName, serviceInterface,
-        clientFactory, false, false);
-  }
-
-  /**
-   * Constructs an instance with the {@link #DEFAULT_CONFIG} and cached thread pool
-   * {@link ExecutorService}.
-   *
-   * @see #Thrift(Config, ExecutorService, ObjectPool, RequestTracker , String, Class, Function,
-   *    boolean, boolean)
-   */
-  public Thrift(ObjectPool<Connection<TTransport, InetSocketAddress>> connectionPool,
-      RequestTracker<InetSocketAddress> requestTracker,
-      String serviceName, Class<T> serviceInterface, Function<TTransport, T> clientFactory,
-      boolean async) {
-
-    this(getConfig(async), connectionPool, requestTracker, serviceName,
-        serviceInterface, clientFactory, async, false);
-  }
-
-  /**
-   * Constructs an instance with the {@link #DEFAULT_CONFIG} and cached thread pool
-   * {@link ExecutorService}.
-   *
-   * @see #Thrift(Config, ExecutorService, ObjectPool, RequestTracker , String, Class, Function,
-   *    boolean, boolean)
-   */
-  public Thrift(ObjectPool<Connection<TTransport, InetSocketAddress>> connectionPool,
-      RequestTracker<InetSocketAddress> requestTracker,
-      String serviceName, Class<T> serviceInterface, Function<TTransport, T> clientFactory,
-      boolean async, boolean ssl) {
-
-    this(getConfig(async), connectionPool, requestTracker, serviceName,
-        serviceInterface, clientFactory, async, ssl);
-  }
-
-  /**
-   * Constructs an instance with a cached thread pool {@link ExecutorService}.
-   *
-   * @see #Thrift(Config, ExecutorService, ObjectPool, RequestTracker , String, Class, Function,
-   *    boolean, boolean)
-   */
-  public Thrift(Config config, ObjectPool<Connection<TTransport, InetSocketAddress>> connectionPool,
-      RequestTracker<InetSocketAddress> requestTracker,
-      String serviceName, Class<T> serviceInterface, Function<TTransport, T> clientFactory,
-      boolean async, boolean ssl) {
-
-    this(config,
-        Executors.newCachedThreadPool(
-            new ThreadFactoryBuilder()
-                .setDaemon(true)
-                .setNameFormat("Thrift["+ serviceName +"][%d]")
-                .build()),
-        connectionPool, requestTracker, serviceName, serviceInterface, clientFactory, async, ssl);
-  }
-
-  /**
-   * Constructs an instance with the {@link #DEFAULT_CONFIG}.
-   *
-   * @see #Thrift(Config, ExecutorService, ObjectPool, RequestTracker , String, Class, Function,
-   *    boolean, boolean)
-   */
-  public Thrift(ExecutorService executorService,
-      ObjectPool<Connection<TTransport, InetSocketAddress>> connectionPool,
-      RequestTracker<InetSocketAddress> requestTracker,
-      String serviceName, Class<T> serviceInterface, Function<TTransport, T> clientFactory,
-      boolean async, boolean ssl) {
-
-    this(getConfig(async), executorService, connectionPool, requestTracker, serviceName,
-        serviceInterface, clientFactory, async, ssl);
-  }
-
-  private static Config getConfig(boolean async) {
-    return async ? DEFAULT_ASYNC_CONFIG : DEFAULT_CONFIG;
-  }
-
-  /**
-   * Constructs a new Thrift factory for creating clients that make calls to a particular thrift
-   * service.
-   *
-   * <p>Note that the combination of {@code config} and {@code connectionPool} need to be chosen
-   * with care depending on usage of the generated thrift clients.  In particular, if configured
-   * to not wait for connections, the {@code connectionPool} ought to be warmed up with a set of
-   * connections or else be actively building connections in the background.
-   *
-   * <p>TODO(John Sirois): consider adding an method to ObjectPool that would allow Thrift to handle
-   * this case by pro-actively warming the pool.
-   *
-   * @param config the default configuration to use for all thrift calls; also the configuration all
-   *     {@link ClientBuilder}s start with
-   * @param executorService for invoking calls with a specified deadline
-   * @param connectionPool the source for thrift connections
-   * @param serviceName a /vars friendly name identifying the service clients will connect to
-   * @param serviceInterface the thrift compiler generate interface class for the remote service
-   *     (Iface)
-   * @param clientFactory a function that can generate a concrete thrift client for the given
-   *     {@code serviceInterface}
-   * @param async enable asynchronous API
-   * @param ssl enable TLS handshaking for Thrift calls
-   */
-  public Thrift(Config config, ExecutorService executorService,
-      ObjectPool<Connection<TTransport, InetSocketAddress>> connectionPool,
-      RequestTracker<InetSocketAddress> requestTracker, String serviceName,
-      Class<T> serviceInterface, Function<TTransport, T> clientFactory, boolean async, boolean ssl) {
-
-    defaultConfig = Preconditions.checkNotNull(config);
-    this.executorService = Preconditions.checkNotNull(executorService);
-    this.connectionPool = Preconditions.checkNotNull(connectionPool);
-    this.requestTracker = Preconditions.checkNotNull(requestTracker);
-    this.serviceName = MorePreconditions.checkNotBlank(serviceName);
-    this.serviceInterface = checkServiceInterface(serviceInterface);
-    this.clientFactory = Preconditions.checkNotNull(clientFactory);
-    this.async = async;
-    this.withSsl = ssl;
-  }
-
-  static <I> Class<I> checkServiceInterface(Class<I> serviceInterface) {
-    Preconditions.checkNotNull(serviceInterface);
-    Preconditions.checkArgument(serviceInterface.isInterface(),
-        "%s must be a thrift service interface", serviceInterface);
-    return serviceInterface;
-  }
-
-  /**
-   * Closes any open connections and prepares this thrift client for graceful shutdown.  Any thrift
-   * client proxies returned from {@link #create()} will become invalid.
-   */
-  public void close() {
-    connectionPool.close();
-    executorService.shutdown();
-  }
-
-  /**
-   * A builder class that allows modifications of call behavior to be made for a given Thrift
-   * client.  Note that in the case of conflicting configuration calls, the last call wins.  So,
-   * for example, the following sequence would result in all calls being subject to a 5 second
-   * global deadline:
-   * <code>
-   *   builder.blocking().withDeadline(5, TimeUnit.SECONDS).create()
-   * </code>
-   *
-   * @see Config
-   */
-  public final class ClientBuilder extends Config.AbstractBuilder<ClientBuilder> {
-    private ClientBuilder(Config template) {
-      super(template);
-    }
-
-    @Override
-    protected ClientBuilder getThis() {
-      return this;
-    }
-
-    /**
-     * Creates a new client using the built up configuration changes.
-     */
-    public T create() {
-      return createClient(getConfig());
-    }
-  }
-
-  /**
-   * Creates a new thrift client builder that inherits this Thrift instance's default configuration.
-   * This is useful for customizing a client for a particular thrift call that makes sense to treat
-   * differently from the rest of the calls to a given service.
-   */
-  public ClientBuilder builder() {
-    return builder(defaultConfig);
-  }
-
-  /**
-   * Creates a new thrift client builder that inherits the given configuration.
-   * This is useful for customizing a client for a particular thrift call that makes sense to treat
-   * differently from the rest of the calls to a given service.
-   */
-  public ClientBuilder builder(Config config) {
-    Preconditions.checkNotNull(config);
-    return new ClientBuilder(config);
-  }
-
-  /**
-   * Creates a new client using the default configuration specified for this Thrift instance.
-   */
-  public T create() {
-    return createClient(defaultConfig);
-  }
-
-  private T createClient(Config config) {
-    StatsProvider statsProvider = config.getStatsProvider();
-
-    // lease/call/[invalidate]/release
-    boolean debug = config.isDebug();
-
-    Caller decorated = new ThriftCaller<T>(connectionPool, requestTracker, clientFactory,
-        config.getConnectTimeout(), debug);
-
-    // [retry]
-    if (config.getMaxRetries() > 0) {
-      decorated = new RetryingCaller(decorated, async, statsProvider, serviceName,
-          config.getMaxRetries(), config.getRetryableExceptions(), debug);
-    }
-
-    // [deadline]
-    if (config.getRequestTimeout().getValue() > 0) {
-      Preconditions.checkArgument(!async,
-          "Request deadlines may not be used with an asynchronous client.");
-
-      decorated = new DeadlineCaller(decorated, async, executorService, config.getRequestTimeout());
-    }
-
-    // [debug]
-    if (debug) {
-      decorated = new DebugCaller(decorated, async);
-    }
-
-    // stats
-    if (config.enableStats()) {
-      decorated = new StatTrackingCaller(decorated, async, statsProvider, serviceName);
-    }
-
-    final Caller caller = decorated;
-
-    final InvocationHandler invocationHandler = new InvocationHandler() {
-      @Override
-      public Object invoke(Object o, Method method, Object[] args) throws Throwable {
-        AsyncMethodCallback callback = null;
-        if (args != null && async) {
-          List<Object> argsList = Lists.newArrayList(args);
-          callback = extractCallback(argsList);
-          args = argsList.toArray();
-        }
-
-        return caller.call(method, args, callback, null);
-      }
-    };
-
-    @SuppressWarnings("unchecked")
-    T instance = (T) Proxy.newProxyInstance(serviceInterface.getClassLoader(),
-        new Class<?>[] {serviceInterface}, invocationHandler);
-    return instance;
-  }
-
-  /**
-   * Verifies that the final argument in a list of objects is a fully-formed
-   * {@link AsyncMethodCallback} and extracts it, removing it from the argument list.
-   *
-   * @param args Argument list to remove the callback from.
-   * @return The callback extracted from {@code args}.
-   */
-  private static AsyncMethodCallback extractCallback(List<Object> args) {
-    // TODO(William Farner): Check all interface methods when building the Thrift client
-    //    and verify that last arguments are all callbacks...this saves us from checking
-    //    each time.
-
-    // Check that the last argument is a callback.
-    Preconditions.checkArgument(args.size() > 0);
-    Object lastArg = args.get(args.size() - 1);
-    Preconditions.checkArgument(lastArg instanceof AsyncMethodCallback,
-        "Last argument of an async thrift call is expected to be of type AsyncMethodCallback.");
-
-    return (AsyncMethodCallback) args.remove(args.size() - 1);
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/thrift/ThriftConnectionFactory.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/thrift/ThriftConnectionFactory.java b/commons/src/main/java/org/apache/aurora/common/thrift/ThriftConnectionFactory.java
deleted file mode 100644
index 8c302d3..0000000
--- a/commons/src/main/java/org/apache/aurora/common/thrift/ThriftConnectionFactory.java
+++ /dev/null
@@ -1,366 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.thrift;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
-import org.apache.aurora.common.base.Closure;
-import org.apache.aurora.common.base.Closures;
-import org.apache.aurora.common.base.MorePreconditions;
-import org.apache.aurora.common.net.pool.Connection;
-import org.apache.aurora.common.net.pool.ConnectionFactory;
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-import org.apache.thrift.transport.TFramedTransport;
-import org.apache.thrift.transport.TNonblockingSocket;
-import org.apache.thrift.transport.TSocket;
-import org.apache.thrift.transport.TTransport;
-import org.apache.thrift.transport.TTransportException;
-
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-
-import javax.net.ssl.SSLSocket;
-import javax.net.ssl.SSLSocketFactory;
-
-/**
- * A connection factory for thrift transport connections to a given host.  This connection factory
- * is lazy and will only create a configured maximum number of active connections - where a
- * {@link ConnectionFactory#create(Amount) created} connection that has
- * not been {@link #destroy destroyed} is considered active.
- *
- * @author John Sirois
- */
-public class ThriftConnectionFactory
-    implements ConnectionFactory<Connection<TTransport, InetSocketAddress>> {
-
-  public enum TransportType {
-    BLOCKING, FRAMED, NONBLOCKING;
-
-    /**
-     * Async clients implicitly use a framed transport, requiring the server they connect to to do
-     * the same. This prevents specifying a nonblocking client without a framed transport, since
-     * that is not compatible with thrift and would simply cause the client to blow up when making a
-     * request. Instead, you must explicitly say useFramedTransport(true) for any buildAsync().
-     */
-    public static TransportType get(boolean framedTransport, boolean nonblocking) {
-      if (nonblocking) {
-        Preconditions.checkArgument(framedTransport,
-            "nonblocking client requires a server running framed transport");
-        return NONBLOCKING;
-      }
-
-      return framedTransport ? FRAMED : BLOCKING;
-    }
-  }
-
-  private static InetSocketAddress asEndpoint(String host, int port) {
-    MorePreconditions.checkNotBlank(host);
-    Preconditions.checkArgument(port > 0);
-    return InetSocketAddress.createUnresolved(host, port);
-  }
-
-  private InetSocketAddress endpoint;
-  private final int maxConnections;
-  private final TransportType transportType;
-  private final Amount<Long, Time> socketTimeout;
-  private final Closure<Connection<TTransport, InetSocketAddress>> postCreateCallback;
-  private boolean sslTransport = false;
-
-  private final Set<Connection<TTransport, InetSocketAddress>> activeConnections =
-      Sets.newSetFromMap(
-          Maps.<Connection<TTransport, InetSocketAddress>, Boolean>newIdentityHashMap());
-  private volatile int lastActiveConnectionsSize = 0;
-
-  private final Lock activeConnectionsWriteLock = new ReentrantLock(true);
-
-  /**
-   * Creates a thrift connection factory with a plain socket (non-framed transport).
-   * This is the same as calling {@link #ThriftConnectionFactory(String, int, int, boolean)} with
-   * {@code framedTransport} set to {@code false}.
-   *
-   * @param host Host to connect to.
-   * @param port Port to connect on.
-   * @param maxConnections Maximum number of connections for this host:port.
-   */
-  public ThriftConnectionFactory(String host, int port, int maxConnections) {
-    this(host, port, maxConnections, TransportType.BLOCKING);
-  }
-
-  /**
-   * Creates a thrift connection factory.
-   * If {@code framedTransport} is set to {@code true}, {@link TFramedTransport} will be used,
-   * otherwise a raw {@link TSocket} will be used.
-   *
-   * @param host Host to connect to.
-   * @param port Port to connect on.
-   * @param maxConnections Maximum number of connections for this host:port.
-   * @param framedTransport Whether to use framed or blocking transport.
-   */
-  public ThriftConnectionFactory(String host, int port, int maxConnections,
-      boolean framedTransport) {
-
-    this(asEndpoint(host, port), maxConnections, TransportType.get(framedTransport, false));
-  }
-
-  /**
-   * Creates a thrift connection factory.
-   * If {@code framedTransport} is set to {@code true}, {@link TFramedTransport} will be used,
-   * otherwise a raw {@link TSocket} will be used.
-   *
-   * @param endpoint Endpoint to connect to.
-   * @param maxConnections Maximum number of connections for this host:port.
-   * @param framedTransport Whether to use framed or blocking transport.
-   */
-  public ThriftConnectionFactory(InetSocketAddress endpoint, int maxConnections,
-      boolean framedTransport) {
-
-    this(endpoint, maxConnections, TransportType.get(framedTransport, false));
-  }
-
-  /**
-   * Creates a thrift connection factory.
-   * If {@code framedTransport} is set to {@code true}, {@link TFramedTransport} will be used,
-   * otherwise a raw {@link TSocket} will be used.
-   * If {@code nonblocking} is set to {@code true}, {@link TNonblockingSocket} will be used,
-   * otherwise a raw {@link TSocket} will be used.
-   * Timeouts are ignored when nonblocking transport is used.
-   *
-   * @param host Host to connect to.
-   * @param port Port to connect on.
-   * @param maxConnections Maximum number of connections for this host:port.
-   * @param transportType Whether to use normal blocking, framed blocking, or non-blocking
-   *    (implicitly framed) transport.
-   */
-  public ThriftConnectionFactory(String host, int port, int maxConnections,
-      TransportType transportType) {
-    this(host, port, maxConnections, transportType, null);
-  }
-
-  /**
-   * Creates a thrift connection factory.
-   * If {@code framedTransport} is set to {@code true}, {@link TFramedTransport} will be used,
-   * otherwise a raw {@link TSocket} will be used.
-   * If {@code nonblocking} is set to {@code true}, {@link TNonblockingSocket} will be used,
-   * otherwise a raw {@link TSocket} will be used.
-   * Timeouts are ignored when nonblocking transport is used.
-   *
-   * @param host Host to connect to.
-   * @param port Port to connect on.
-   * @param maxConnections Maximum number of connections for this host:port.
-   * @param transportType Whether to use normal blocking, framed blocking, or non-blocking
-   *          (implicitly framed) transport.
-   * @param socketTimeout timeout on thrift i/o operations, or null to default to connectTimeout o
-   *          the blocking client.
-   */
-  public ThriftConnectionFactory(String host, int port, int maxConnections,
-      TransportType transportType, Amount<Long, Time> socketTimeout) {
-    this(asEndpoint(host, port), maxConnections, transportType, socketTimeout);
-  }
-
-  public ThriftConnectionFactory(InetSocketAddress endpoint, int maxConnections,
-      TransportType transportType) {
-    this(endpoint, maxConnections, transportType, null);
-  }
-
-  /**
-   * Creates a thrift connection factory.
-   * If {@code framedTransport} is set to {@code true}, {@link TFramedTransport} will be used,
-   * otherwise a raw {@link TSocket} will be used.
-   * If {@code nonblocking} is set to {@code true}, {@link TNonblockingSocket} will be used,
-   * otherwise a raw {@link TSocket} will be used.
-   * Timeouts are ignored when nonblocking transport is used.
-   *
-   * @param endpoint Endpoint to connect to.
-   * @param maxConnections Maximum number of connections for this host:port.
-   * @param transportType Whether to use normal blocking, framed blocking, or non-blocking
-   *          (implicitly framed) transport.
-   * @param socketTimeout timeout on thrift i/o operations, or null to default to connectTimeout o
-   *          the blocking client.
-   */
-  public ThriftConnectionFactory(InetSocketAddress endpoint, int maxConnections,
-      TransportType transportType, Amount<Long, Time> socketTimeout) {
-	  this(endpoint, maxConnections, transportType, socketTimeout,
-        Closures.<Connection<TTransport, InetSocketAddress>>noop(), false);
-  }
-
-  public ThriftConnectionFactory(InetSocketAddress endpoint, int maxConnections,
-      TransportType transportType, Amount<Long, Time> socketTimeout,
-	  Closure<Connection<TTransport, InetSocketAddress>> postCreateCallback,
-	  boolean sslTransport) {
-    Preconditions.checkArgument(maxConnections > 0, "maxConnections must be at least 1");
-    if (socketTimeout != null) {
-      Preconditions.checkArgument(socketTimeout.as(Time.MILLISECONDS) >= 0);
-    }
-
-    this.endpoint = Preconditions.checkNotNull(endpoint);
-    this.maxConnections = maxConnections;
-    this.transportType = transportType;
-    this.socketTimeout = socketTimeout;
-    this.postCreateCallback = Preconditions.checkNotNull(postCreateCallback);
-    this.sslTransport = sslTransport;
-  }
-
-  @Override
-  public boolean mightCreate() {
-    return lastActiveConnectionsSize < maxConnections;
-  }
-
-  /**
-   * FIXME:  shouldn't this throw TimeoutException instead of returning null
-   *         in the timeout cases as per the ConnectionFactory.create javadoc?
-   */
-  @Override
-  public Connection<TTransport, InetSocketAddress> create(Amount<Long, Time> timeout)
-      throws TTransportException, IOException {
-
-    Preconditions.checkNotNull(timeout);
-    if (timeout.getValue() == 0) {
-      return create();
-    }
-
-    try {
-      long timeRemainingNs = timeout.as(Time.NANOSECONDS);
-      long start = System.nanoTime();
-      if(activeConnectionsWriteLock.tryLock(timeRemainingNs, TimeUnit.NANOSECONDS)) {
-        try {
-          if (!willCreateSafe()) {
-            return null;
-          }
-
-          timeRemainingNs -= (System.nanoTime() - start);
-
-          return createConnection((int) TimeUnit.NANOSECONDS.toMillis(timeRemainingNs));
-        } finally {
-          activeConnectionsWriteLock.unlock();
-        }
-      } else {
-        return null;
-      }
-    } catch (InterruptedException e) {
-      return null;
-    }
-  }
-
-  private Connection<TTransport, InetSocketAddress> create()
-      throws TTransportException, IOException {
-    activeConnectionsWriteLock.lock();
-    try {
-      if (!willCreateSafe()) {
-        return null;
-      }
-
-      return createConnection(0);
-    } finally {
-      activeConnectionsWriteLock.unlock();
-    }
-  }
-
-  private Connection<TTransport, InetSocketAddress> createConnection(int timeoutMillis)
-      throws TTransportException, IOException {
-    TTransport transport = createTransport(timeoutMillis);
-    if (transport == null) {
-      return null;
-    }
-
-    Connection<TTransport, InetSocketAddress> connection =
-        new TTransportConnection(transport, endpoint);
-    postCreateCallback.execute(connection);
-    activeConnections.add(connection);
-    lastActiveConnectionsSize = activeConnections.size();
-    return connection;
-  }
-
-  private boolean willCreateSafe() {
-    return activeConnections.size() < maxConnections;
-  }
-
-  @VisibleForTesting
-  TTransport createTransport(int timeoutMillis) throws TTransportException, IOException {
-    TSocket socket = null;
-    if (transportType != TransportType.NONBLOCKING) {
-      // can't do a nonblocking create on a blocking transport
-      if (timeoutMillis <= 0) {
-        return null;
-      }
-
-      if (sslTransport) {
-        SSLSocketFactory factory = (SSLSocketFactory) SSLSocketFactory.getDefault();
-        SSLSocket ssl_socket = (SSLSocket) factory.createSocket(endpoint.getHostName(), endpoint.getPort());
-        ssl_socket.setSoTimeout(timeoutMillis);
-        return new TSocket(ssl_socket);
-      } else {
-        socket = new TSocket(endpoint.getHostName(), endpoint.getPort(), timeoutMillis);
-      }
-    }
-
-    try {
-      switch (transportType) {
-        case BLOCKING:
-          socket.open();
-          setSocketTimeout(socket);
-          return socket;
-        case FRAMED:
-          TFramedTransport transport = new TFramedTransport(socket);
-          transport.open();
-          setSocketTimeout(socket);
-          return transport;
-        case NONBLOCKING:
-          try {
-            return new TNonblockingSocket(endpoint.getHostName(), endpoint.getPort());
-          } catch (IOException e) {
-            throw new IOException("Failed to create non-blocking transport to " + endpoint, e);
-          }
-      }
-    } catch (TTransportException e) {
-      throw new TTransportException("Failed to create transport to " + endpoint, e);
-    }
-
-    throw new IllegalArgumentException("unknown transport type " + transportType);
-  }
-
-  private void setSocketTimeout(TSocket socket) {
-    if (socketTimeout != null) {
-      socket.setTimeout(socketTimeout.as(Time.MILLISECONDS).intValue());
-    }
-  }
-
-  @Override
-  public void destroy(Connection<TTransport, InetSocketAddress> connection) {
-    activeConnectionsWriteLock.lock();
-    try {
-      boolean wasActiveConnection = activeConnections.remove(connection);
-      Preconditions.checkArgument(wasActiveConnection,
-          "connection %s not created by this factory", connection);
-      lastActiveConnectionsSize = activeConnections.size();
-    } finally {
-      activeConnectionsWriteLock.unlock();
-    }
-
-    // We close the connection outside the critical section which means we may have more connections
-    // "active" (open) than maxConnections for a very short time
-    connection.close();
-  }
-
-  @Override
-  public String toString() {
-    return String.format("%s[%s]", getClass().getSimpleName(), endpoint);
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/thrift/ThriftException.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/thrift/ThriftException.java b/commons/src/main/java/org/apache/aurora/common/thrift/ThriftException.java
deleted file mode 100644
index 27e9f5e..0000000
--- a/commons/src/main/java/org/apache/aurora/common/thrift/ThriftException.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.thrift;
-
-/**
- * Exception class to wrap exceptions caught during thrift calls.
- */
-public class ThriftException extends Exception {
-  public ThriftException(String message) {
-    super(message);
-  }
-  public ThriftException(String message, Throwable t) {
-    super(message, t);
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/thrift/ThriftFactory.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/thrift/ThriftFactory.java b/commons/src/main/java/org/apache/aurora/common/thrift/ThriftFactory.java
deleted file mode 100644
index 75c58e2..0000000
--- a/commons/src/main/java/org/apache/aurora/common/thrift/ThriftFactory.java
+++ /dev/null
@@ -1,653 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.thrift;
-
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.net.InetSocketAddress;
-import java.util.Collection;
-import java.util.NoSuchElementException;
-import java.util.Set;
-import java.util.concurrent.RejectedExecutionException;
-import java.util.concurrent.RejectedExecutionHandler;
-import java.util.concurrent.SynchronousQueue;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-import java.util.logging.Logger;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Function;
-import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Predicate;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Iterables;
-import com.google.common.util.concurrent.ThreadFactoryBuilder;
-
-import org.apache.thrift.async.TAsyncClient;
-import org.apache.thrift.async.TAsyncClientManager;
-import org.apache.thrift.protocol.TBinaryProtocol;
-import org.apache.thrift.protocol.TProtocol;
-import org.apache.thrift.protocol.TProtocolFactory;
-import org.apache.thrift.transport.TNonblockingTransport;
-import org.apache.thrift.transport.TTransport;
-
-import org.apache.aurora.common.base.Closure;
-import org.apache.aurora.common.base.Closures;
-import org.apache.aurora.common.base.MorePreconditions;
-import org.apache.aurora.common.net.loadbalancing.LeastConnectedStrategy;
-import org.apache.aurora.common.net.loadbalancing.LoadBalancer;
-import org.apache.aurora.common.net.loadbalancing.LoadBalancerImpl;
-import org.apache.aurora.common.net.loadbalancing.LoadBalancingStrategy;
-import org.apache.aurora.common.net.loadbalancing.MarkDeadStrategyWithHostCheck;
-import org.apache.aurora.common.net.loadbalancing.TrafficMonitorAdapter;
-import org.apache.aurora.common.net.monitoring.TrafficMonitor;
-import org.apache.aurora.common.net.pool.Connection;
-import org.apache.aurora.common.net.pool.ConnectionPool;
-import org.apache.aurora.common.net.pool.DynamicHostSet;
-import org.apache.aurora.common.net.pool.DynamicPool;
-import org.apache.aurora.common.net.pool.MetaPool;
-import org.apache.aurora.common.net.pool.ObjectPool;
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-import org.apache.aurora.common.stats.Stats;
-import org.apache.aurora.common.stats.StatsProvider;
-import org.apache.aurora.common.thrift.ThriftConnectionFactory.TransportType;
-import org.apache.aurora.common.util.BackoffDecider;
-import org.apache.aurora.common.util.BackoffStrategy;
-import org.apache.aurora.common.util.TruncatedBinaryBackoff;
-import org.apache.aurora.common.util.concurrent.ForwardingExecutorService;
-
-/**
- * A utility that provides convenience methods to build common {@link Thrift}s.
- *
- * The thrift factory allows you to specify parameters that define how the client connects to
- * and communicates with servers, such as the transport type, connection settings, and load
- * balancing.  Request-level settings like sync/async and retries should be set on the
- * {@link Thrift} instance that this factory will create.
- *
- * The factory will attempt to provide reasonable defaults to allow the caller to minimize the
- * amount of necessary configuration.  Currently, the default behavior includes:
- *
- * <ul>
- *   <li> A test lease/release for each host will be performed every second
- *      {@link #withDeadConnectionRestoreInterval(Amount)}
- *   <li> At most 50 connections will be established to each host
- *      {@link #withMaxConnectionsPerEndpoint(int)}
- *   <li> Unframed transport {@link #useFramedTransport(boolean)}
- *   <li> A load balancing strategy that will mark hosts dead and prefer least-connected hosts.
- *      Hosts are marked dead if the most recent connection attempt was a failure or else based on
- *      the windowed error rate of attempted RPCs.  If the error rate for a connected host exceeds
- *      20% over the last second, the host will be disabled for 2 seconds ascending up to 10 seconds
- *      if the elevated error rate persists.
- *      {@link #withLoadBalancingStrategy(LoadBalancingStrategy)}
- *   <li> Statistics are reported through {@link Stats}
- *      {@link #withStatsProvider(StatsProvider)}
- *   <li> A service name matching the thrift interface name {@link #withServiceName(String)}
- * </ul>
- *
- * @author John Sirois
- */
-public class ThriftFactory<T> {
-  private static final Amount<Long,Time> DEFAULT_DEAD_TARGET_RESTORE_INTERVAL =
-      Amount.of(1L, Time.SECONDS);
-
-  private static final int DEFAULT_MAX_CONNECTIONS_PER_ENDPOINT = 50;
-
-  private Class<T> serviceInterface;
-  private Function<TTransport, T> clientFactory;
-  private int maxConnectionsPerEndpoint;
-  private Amount<Long,Time> connectionRestoreInterval;
-  private boolean framedTransport;
-  private LoadBalancingStrategy<InetSocketAddress> loadBalancingStrategy = null;
-  private final TrafficMonitor<InetSocketAddress> monitor;
-  private Amount<Long,Time> socketTimeout = null;
-  private Closure<Connection<TTransport, InetSocketAddress>> postCreateCallback = Closures.noop();
-  private StatsProvider statsProvider = Stats.STATS_PROVIDER;
-  private Optional<String> endpointName = Optional.absent();
-  private String serviceName;
-  private boolean sslTransport;
-
-  public static <T> ThriftFactory<T> create(Class<T> serviceInterface) {
-    return new ThriftFactory<T>(serviceInterface);
-  }
-
-  /**
-   * Creates a default factory that will use unframed blocking transport.
-   *
-   * @param serviceInterface The interface of the thrift service to make a client for.
-   */
-  private ThriftFactory(Class<T> serviceInterface) {
-    this.serviceInterface = Thrift.checkServiceInterface(serviceInterface);
-    this.maxConnectionsPerEndpoint = DEFAULT_MAX_CONNECTIONS_PER_ENDPOINT;
-    this.connectionRestoreInterval = DEFAULT_DEAD_TARGET_RESTORE_INTERVAL;
-    this.framedTransport = false;
-    this.monitor = new TrafficMonitor<InetSocketAddress>(serviceInterface.getName());
-    this.serviceName = serviceInterface.getEnclosingClass().getSimpleName();
-    this.sslTransport = false;
-  }
-
-  private void checkBaseState() {
-    Preconditions.checkArgument(maxConnectionsPerEndpoint > 0,
-        "Must allow at least 1 connection per endpoint; %s specified", maxConnectionsPerEndpoint);
-  }
-
-  public TrafficMonitor<InetSocketAddress> getMonitor() {
-    return monitor;
-  }
-
-  /**
-   * Creates the thrift client, and initializes connection pools.
-   *
-   * @param backends Backends to connect to.
-   * @return A new thrift client.
-   */
-  public Thrift<T> build(Set<InetSocketAddress> backends) {
-    checkBaseState();
-    MorePreconditions.checkNotBlank(backends);
-
-    ManagedThreadPool managedThreadPool = createManagedThreadpool(backends.size());
-    LoadBalancer<InetSocketAddress> loadBalancer = createLoadBalancer();
-    Function<TTransport, T> clientFactory = getClientFactory();
-
-    ObjectPool<Connection<TTransport, InetSocketAddress>> connectionPool =
-        createConnectionPool(backends, loadBalancer, managedThreadPool, false);
-
-    return new Thrift<T>(managedThreadPool, connectionPool, loadBalancer, serviceName,
-        serviceInterface, clientFactory, false, sslTransport);
-  }
-
-  /**
-   * Creates a synchronous thrift client that will communicate with a dynamic host set.
-   *
-   * @param hostSet The host set to use as a backend.
-   * @return A thrift client.
-   * @throws ThriftFactoryException If an error occurred while creating the client.
-   */
-  public Thrift<T> build(DynamicHostSet<ServiceInstance> hostSet) throws ThriftFactoryException {
-    checkBaseState();
-    Preconditions.checkNotNull(hostSet);
-
-    ManagedThreadPool managedThreadPool = createManagedThreadpool(1);
-    LoadBalancer<InetSocketAddress> loadBalancer = createLoadBalancer();
-    Function<TTransport, T> clientFactory = getClientFactory();
-
-    ObjectPool<Connection<TTransport, InetSocketAddress>> connectionPool =
-        createConnectionPool(hostSet, loadBalancer, managedThreadPool, false, endpointName);
-
-    return new Thrift<T>(managedThreadPool, connectionPool, loadBalancer, serviceName,
-        serviceInterface, clientFactory, false, sslTransport);
-  }
-
-  private ManagedThreadPool createManagedThreadpool(int initialEndpointCount) {
-    return new ManagedThreadPool(serviceName, initialEndpointCount, maxConnectionsPerEndpoint);
-  }
-
-  /**
-   * A finite thread pool that monitors backend choice events to dynamically resize.  This
-   * {@link java.util.concurrent.ExecutorService} implementation immediately rejects requests when
-   * there are no more available worked threads (requests are not queued).
-   */
-  private static class ManagedThreadPool extends ForwardingExecutorService<ThreadPoolExecutor>
-      implements Closure<Collection<InetSocketAddress>> {
-
-    private static final Logger LOG = Logger.getLogger(ManagedThreadPool.class.getName());
-
-    private static ThreadPoolExecutor createThreadPool(String serviceName, int initialSize) {
-      ThreadFactory threadFactory =
-          new ThreadFactoryBuilder()
-              .setNameFormat("Thrift[" +serviceName + "][%d]")
-              .setDaemon(true)
-              .build();
-      return new ThreadPoolExecutor(initialSize, initialSize, 0, TimeUnit.MILLISECONDS,
-          new SynchronousQueue<Runnable>(), threadFactory);
-    }
-
-    private final int maxConnectionsPerEndpoint;
-
-    public ManagedThreadPool(String serviceName, int initialEndpointCount,
-        int maxConnectionsPerEndpoint) {
-
-      super(createThreadPool(serviceName, initialEndpointCount * maxConnectionsPerEndpoint));
-      this.maxConnectionsPerEndpoint = maxConnectionsPerEndpoint;
-      setRejectedExecutionHandler(initialEndpointCount);
-    }
-
-    private void setRejectedExecutionHandler(int endpointCount) {
-      final String message =
-          String.format("All %d x %d connections in use", endpointCount, maxConnectionsPerEndpoint);
-      delegate.setRejectedExecutionHandler(new RejectedExecutionHandler() {
-        @Override public void rejectedExecution(Runnable runnable, ThreadPoolExecutor executor) {
-          throw new RejectedExecutionException(message);
-        }
-      });
-    }
-
-    @Override
-    public void execute(Collection<InetSocketAddress> chosenBackends) {
-      int previousPoolSize = delegate.getMaximumPoolSize();
-      /*
-       * In the case of no available backends, we need to make sure we pass in a positive pool
-       * size to our delegate.  In particular, java.util.concurrent.ThreadPoolExecutor does not
-       * accept zero as a valid core or max pool size.
-       */
-      int backendCount = Math.max(chosenBackends.size(), 1);
-      int newPoolSize = backendCount * maxConnectionsPerEndpoint;
-
-      if (previousPoolSize != newPoolSize) {
-        LOG.info(String.format("Re-sizing deadline thread pool from: %d to: %d",
-            previousPoolSize, newPoolSize));
-        if (previousPoolSize < newPoolSize) { // Don't cross the beams!
-          delegate.setMaximumPoolSize(newPoolSize);
-          delegate.setCorePoolSize(newPoolSize);
-        } else {
-          delegate.setCorePoolSize(newPoolSize);
-          delegate.setMaximumPoolSize(newPoolSize);
-        }
-        setRejectedExecutionHandler(backendCount);
-      }
-    }
-  }
-
-  /**
-   * Creates an asynchronous thrift client that will communicate with a fixed set of backends.
-   *
-   * @param backends Backends to connect to.
-   * @return A thrift client.
-   * @throws ThriftFactoryException If an error occurred while creating the client.
-   */
-  public Thrift<T> buildAsync(Set<InetSocketAddress> backends) throws ThriftFactoryException {
-    checkBaseState();
-    MorePreconditions.checkNotBlank(backends);
-
-    LoadBalancer<InetSocketAddress> loadBalancer = createLoadBalancer();
-    Closure<Collection<InetSocketAddress>> noop = Closures.noop();
-    Function<TTransport, T> asyncClientFactory = getAsyncClientFactory();
-
-    ObjectPool<Connection<TTransport, InetSocketAddress>> connectionPool =
-        createConnectionPool(backends, loadBalancer, noop, true);
-
-    return new Thrift<T>(connectionPool, loadBalancer,
-        serviceName, serviceInterface, asyncClientFactory, true);
-  }
-
-  /**
-   * Creates an asynchronous thrift client that will communicate with a dynamic host set.
-   *
-   * @param hostSet The host set to use as a backend.
-   * @return A thrift client.
-   * @throws ThriftFactoryException If an error occurred while creating the client.
-   */
-  public Thrift<T> buildAsync(DynamicHostSet<ServiceInstance> hostSet)
-      throws ThriftFactoryException {
-    checkBaseState();
-    Preconditions.checkNotNull(hostSet);
-
-    LoadBalancer<InetSocketAddress> loadBalancer = createLoadBalancer();
-    Closure<Collection<InetSocketAddress>> noop = Closures.noop();
-    Function<TTransport, T> asyncClientFactory = getAsyncClientFactory();
-
-    ObjectPool<Connection<TTransport, InetSocketAddress>> connectionPool =
-        createConnectionPool(hostSet, loadBalancer, noop, true, endpointName);
-
-    return new Thrift<T>(connectionPool, loadBalancer,
-        serviceName, serviceInterface, asyncClientFactory, true);
-  }
-
-  /**
-   * Prepare the client factory, which will create client class instances from transports.
-   *
-   * @return The client factory to use.
-   */
-  private Function<TTransport, T> getClientFactory() {
-    return clientFactory == null ? createClientFactory(serviceInterface) : clientFactory;
-  }
-
-  /**
-   * Prepare the async client factory, which will create client class instances from transports.
-   *
-   * @return The client factory to use.
-   * @throws ThriftFactoryException If there was a problem creating the factory.
-   */
-  private Function<TTransport, T> getAsyncClientFactory() throws ThriftFactoryException {
-    try {
-      return clientFactory == null ? createAsyncClientFactory(serviceInterface) : clientFactory;
-    } catch (IOException e) {
-      throw new ThriftFactoryException("Failed to create async client factory.", e);
-    }
-  }
-
-  private ObjectPool<Connection<TTransport, InetSocketAddress>> createConnectionPool(
-      Set<InetSocketAddress> backends, LoadBalancer<InetSocketAddress> loadBalancer,
-      Closure<Collection<InetSocketAddress>> onBackendsChosen, boolean nonblocking) {
-
-    ImmutableMap.Builder<InetSocketAddress, ObjectPool<Connection<TTransport, InetSocketAddress>>>
-        backendBuilder = ImmutableMap.builder();
-    for (InetSocketAddress backend : backends) {
-      backendBuilder.put(backend, createConnectionPool(backend, nonblocking));
-    }
-
-    return new MetaPool<TTransport, InetSocketAddress>(backendBuilder.build(),
-        loadBalancer, onBackendsChosen, connectionRestoreInterval);
-  }
-
-  private ObjectPool<Connection<TTransport, InetSocketAddress>> createConnectionPool(
-      DynamicHostSet<ServiceInstance> hostSet, LoadBalancer<InetSocketAddress> loadBalancer,
-      Closure<Collection<InetSocketAddress>> onBackendsChosen,
-      final boolean nonblocking, Optional<String> serviceEndpointName)
-          throws ThriftFactoryException {
-
-    Function<InetSocketAddress, ObjectPool<Connection<TTransport, InetSocketAddress>>>
-        endpointPoolFactory =
-      new Function<InetSocketAddress, ObjectPool<Connection<TTransport, InetSocketAddress>>>() {
-        @Override public ObjectPool<Connection<TTransport, InetSocketAddress>> apply(
-            InetSocketAddress endpoint) {
-          return createConnectionPool(endpoint, nonblocking);
-        }
-      };
-
-    try {
-      return new DynamicPool<ServiceInstance, TTransport, InetSocketAddress>(hostSet,
-          endpointPoolFactory, loadBalancer, onBackendsChosen, connectionRestoreInterval,
-          Util.getAddress(serviceEndpointName), Util.IS_ALIVE);
-    } catch (DynamicHostSet.MonitorException e) {
-      throw new ThriftFactoryException("Failed to monitor host set.", e);
-    }
-  }
-
-  private ObjectPool<Connection<TTransport, InetSocketAddress>> createConnectionPool(
-      InetSocketAddress backend, boolean nonblocking) {
-
-    ThriftConnectionFactory connectionFactory = new ThriftConnectionFactory(
-        backend, maxConnectionsPerEndpoint, TransportType.get(framedTransport, nonblocking),
-        socketTimeout, postCreateCallback, sslTransport);
-
-    return new ConnectionPool<Connection<TTransport, InetSocketAddress>>(connectionFactory,
-        statsProvider);
-  }
-
-  @VisibleForTesting
-  public ThriftFactory<T> withClientFactory(Function<TTransport, T> clientFactory) {
-    this.clientFactory = Preconditions.checkNotNull(clientFactory);
-
-    return this;
-  }
-
-  public ThriftFactory<T> withSslEnabled() {
-    this.sslTransport = true;
-    return this;
-  }
-
-  /**
-   * Specifies the maximum number of connections that should be made to any single endpoint.
-   *
-   * @param maxConnectionsPerEndpoint Maximum number of connections per endpoint.
-   * @return A reference to the factory.
-   */
-  public ThriftFactory<T> withMaxConnectionsPerEndpoint(int maxConnectionsPerEndpoint) {
-    Preconditions.checkArgument(maxConnectionsPerEndpoint > 0);
-    this.maxConnectionsPerEndpoint = maxConnectionsPerEndpoint;
-
-    return this;
-  }
-
-  /**
-   * Specifies the interval at which dead endpoint connections should be checked and revived.
-   *
-   * @param connectionRestoreInterval the time interval to check.
-   * @return A reference to the factory.
-   */
-  public ThriftFactory<T> withDeadConnectionRestoreInterval(
-      Amount<Long, Time> connectionRestoreInterval) {
-    Preconditions.checkNotNull(connectionRestoreInterval);
-    Preconditions.checkArgument(connectionRestoreInterval.getValue() >= 0,
-        "A negative interval is invalid: %s", connectionRestoreInterval);
-    this.connectionRestoreInterval = connectionRestoreInterval;
-
-    return this;
-  }
-
-  /**
-   * Instructs the factory whether framed transport should be used.
-   *
-   * @param framedTransport Whether to use framed transport.
-   * @return A reference to the factory.
-   */
-  public ThriftFactory<T> useFramedTransport(boolean framedTransport) {
-    this.framedTransport = framedTransport;
-
-    return this;
-  }
-
-  /**
-   * Specifies the load balancer to use when interacting with multiple backends.
-   *
-   * @param strategy Load balancing strategy.
-   * @return A reference to the factory.
-   */
-  public ThriftFactory<T> withLoadBalancingStrategy(
-      LoadBalancingStrategy<InetSocketAddress> strategy) {
-    this.loadBalancingStrategy = Preconditions.checkNotNull(strategy);
-
-    return this;
-  }
-
-  private LoadBalancer<InetSocketAddress> createLoadBalancer() {
-    if (loadBalancingStrategy == null) {
-      loadBalancingStrategy = createDefaultLoadBalancingStrategy();
-    }
-
-    return LoadBalancerImpl.create(TrafficMonitorAdapter.create(loadBalancingStrategy, monitor));
-  }
-
-  private LoadBalancingStrategy<InetSocketAddress> createDefaultLoadBalancingStrategy() {
-    Function<InetSocketAddress, BackoffDecider> backoffFactory =
-        new Function<InetSocketAddress, BackoffDecider>() {
-          @Override public BackoffDecider apply(InetSocketAddress socket) {
-            BackoffStrategy backoffStrategy = new TruncatedBinaryBackoff(
-                Amount.of(2L, Time.SECONDS), Amount.of(10L, Time.SECONDS));
-
-            return BackoffDecider.builder(socket.toString())
-                .withTolerateFailureRate(0.2)
-                .withRequestWindow(Amount.of(1L, Time.SECONDS))
-                .withSeedSize(5)
-                .withStrategy(backoffStrategy)
-                .withRecoveryType(BackoffDecider.RecoveryType.FULL_CAPACITY)
-                .withStatsProvider(statsProvider)
-                .build();
-          }
-    };
-
-    return new MarkDeadStrategyWithHostCheck<InetSocketAddress>(
-        new LeastConnectedStrategy<InetSocketAddress>(), backoffFactory);
-  }
-
-  /**
-   * Specifies the net read/write timeout to set via SO_TIMEOUT on the thrift blocking client
-   * or AsyncClient.setTimeout on the thrift async client.  Defaults to the connectTimeout on
-   * the blocking client if not set.
-   *
-   * @param socketTimeout timeout on thrift i/o operations
-   * @return A reference to the factory.
-   */
-  public ThriftFactory<T> withSocketTimeout(Amount<Long, Time> socketTimeout) {
-    this.socketTimeout = Preconditions.checkNotNull(socketTimeout);
-    Preconditions.checkArgument(socketTimeout.as(Time.MILLISECONDS) >= 0);
-
-    return this;
-  }
-
-  /**
-   * Specifies the callback to notify when a connection has been created.  The callback may
-   * be used to make thrift calls to the connection, but must not invalidate it.
-   * Defaults to a no-op closure.
-   *
-   * @param postCreateCallback function to setup new connections
-   * @return A reference to the factory.
-   */
-  public ThriftFactory<T> withPostCreateCallback(
-      Closure<Connection<TTransport, InetSocketAddress>> postCreateCallback) {
-    this.postCreateCallback = Preconditions.checkNotNull(postCreateCallback);
-
-    return this;
-  }
-
-  /**
-   * Registers a custom stats provider to use to track various client stats.
-   *
-   * @param statsProvider the {@code StatsProvider} to use
-   * @return A reference to the factory.
-   */
-  public ThriftFactory<T> withStatsProvider(StatsProvider statsProvider) {
-    this.statsProvider = Preconditions.checkNotNull(statsProvider);
-
-    return this;
-  }
-
-  /**
-   * Name to be passed to Thrift constructor, used in stats.
-   *
-   * @param serviceName string to use
-   * @return A reference to the factory.
-   */
-  public ThriftFactory<T> withServiceName(String serviceName) {
-    this.serviceName = MorePreconditions.checkNotBlank(serviceName);
-
-    return this;
-  }
-
-  /**
-   * Set the end-point to use from {@link ServiceInstance#getAdditionalEndpoints()}.
-   * If not set, the default behavior is to use {@link ServiceInstance#getServiceEndpoint()}.
-   *
-   * @param endpointName the (optional) name of the end-point, if unset - the
-   *     default/primary end-point is selected
-   * @return a reference to the factory for chaining
-   */
-  public ThriftFactory<T> withEndpointName(String endpointName) {
-    this.endpointName = Optional.of(endpointName);
-    return this;
-  }
-
-  private static <T> Function<TTransport, T> createClientFactory(Class<T> serviceInterface) {
-    final Constructor<? extends T> implementationConstructor =
-        findImplementationConstructor(serviceInterface);
-
-    return new Function<TTransport, T>() {
-      @Override public T apply(TTransport transport) {
-        try {
-          return implementationConstructor.newInstance(new TBinaryProtocol(transport));
-        } catch (InstantiationException e) {
-          throw new RuntimeException(e);
-        } catch (IllegalAccessException e) {
-          throw new RuntimeException(e);
-        } catch (InvocationTargetException e) {
-          throw new RuntimeException(e);
-        }
-      }
-    };
-  }
-
-  private <T> Function<TTransport, T> createAsyncClientFactory(
-      final Class<T> serviceInterface) throws IOException {
-
-    final TAsyncClientManager clientManager = new TAsyncClientManager();
-    Runtime.getRuntime().addShutdownHook(new Thread() {
-      @Override public void run() {
-        clientManager.stop();
-      }
-    });
-
-    final Constructor<? extends T> implementationConstructor =
-        findAsyncImplementationConstructor(serviceInterface);
-
-    return new Function<TTransport, T>() {
-      @Override public T apply(TTransport transport) {
-        Preconditions.checkNotNull(transport);
-        Preconditions.checkArgument(transport instanceof TNonblockingTransport,
-            "Invalid transport provided to client factory: " + transport.getClass());
-
-        try {
-          T client = implementationConstructor.newInstance(new TBinaryProtocol.Factory(),
-              clientManager, transport);
-
-          if (socketTimeout != null) {
-            ((TAsyncClient) client).setTimeout(socketTimeout.as(Time.MILLISECONDS));
-          }
-
-          return client;
-        } catch (InstantiationException e) {
-          throw new RuntimeException(e);
-        } catch (IllegalAccessException e) {
-          throw new RuntimeException(e);
-        } catch (InvocationTargetException e) {
-          throw new RuntimeException(e);
-        }
-      }
-    };
-  }
-
-  private static <T> Constructor<? extends T> findImplementationConstructor(
-      final Class<T> serviceInterface) {
-    Class<? extends T> implementationClass = findImplementationClass(serviceInterface);
-    try {
-      return implementationClass.getConstructor(TProtocol.class);
-    } catch (NoSuchMethodException e) {
-      throw new IllegalArgumentException("Failed to find a single argument TProtocol constructor "
-                                         + "in service client class: " + implementationClass);
-    }
-  }
-
-  private static <T> Constructor<? extends T> findAsyncImplementationConstructor(
-      final Class<T> serviceInterface) {
-    Class<? extends T> implementationClass = findImplementationClass(serviceInterface);
-    try {
-      return implementationClass.getConstructor(TProtocolFactory.class, TAsyncClientManager.class,
-          TNonblockingTransport.class);
-    } catch (NoSuchMethodException e) {
-      throw new IllegalArgumentException("Failed to find expected constructor "
-                                         + "in service client class: " + implementationClass);
-    }
-  }
-
-  @SuppressWarnings("unchecked")
-  private static <T> Class<? extends T> findImplementationClass(final Class<T> serviceInterface) {
-    try {
-      return (Class<? extends T>)
-          Iterables.find(ImmutableList.copyOf(serviceInterface.getEnclosingClass().getClasses()),
-              new Predicate<Class<?>>() {
-                @Override public boolean apply(Class<?> inner) {
-                  return !serviceInterface.equals(inner)
-                         && serviceInterface.isAssignableFrom(inner);
-                }
-              });
-    } catch (NoSuchElementException e) {
-      throw new IllegalArgumentException("Could not find a sibling enclosed implementation of "
-                                         + "service interface: " + serviceInterface);
-    }
-  }
-
-  public static class ThriftFactoryException extends Exception {
-    public ThriftFactoryException(String msg) {
-      super(msg);
-    }
-
-    public ThriftFactoryException(String msg, Throwable t) {
-      super(msg, t);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/thrift/callers/Caller.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/thrift/callers/Caller.java b/commons/src/main/java/org/apache/aurora/common/thrift/callers/Caller.java
deleted file mode 100644
index 0200c49..0000000
--- a/commons/src/main/java/org/apache/aurora/common/thrift/callers/Caller.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.thrift.callers;
-
-import com.google.common.base.Preconditions;
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-import org.apache.thrift.async.AsyncMethodCallback;
-
-import javax.annotation.Nullable;
-import java.lang.reflect.Method;
-
-/**
-* A caller that invokes a method on an object.
-*
-* @author William Farner
-*/
-public interface Caller {
-
-  /**
-   * Invokes a method on an object, using the given arguments.  The method call may be
-   * asynchronous, in which case {@code callback} will be non-null.
-   *
-   * @param method The method being invoked.
-   * @param args The arguments to call {@code method} with.
-   * @param callback The callback to use if the method is asynchronous.
-   * @param connectTimeoutOverride Optional override for the default connection timeout.
-   * @return The return value from invoking the method.
-   * @throws Throwable Exception, as prescribed by the method's contract.
-   */
-  public Object call(Method method, Object[] args, @Nullable AsyncMethodCallback callback,
-      @Nullable Amount<Long, Time> connectTimeoutOverride) throws Throwable;
-
-  /**
-   * Captures the result of a request, whether synchronous or asynchronous.  It should be expected
-   * that for every request made, exactly one of these methods will be called.
-   */
-  static interface ResultCapture {
-    /**
-     * Called when the request completed successfully.
-     */
-    void success();
-
-    /**
-     * Called when the request failed.
-     *
-     * @param t Throwable that was caught.  Must never be null.
-     * @return {@code true} if a wrapped callback should be notified of the failure,
-     *    {@code false} otherwise.
-     */
-    boolean fail(Throwable t);
-  }
-
-  /**
-   * A callback that adapts a {@link ResultCapture} with an {@link AsyncMethodCallback} while
-   * maintaining the AsyncMethodCallback interface.  The wrapped callback will handle invocation
-   * of the underlying callback based on the return values from the ResultCapture.
-   */
-  static class WrappedMethodCallback implements AsyncMethodCallback {
-    private final AsyncMethodCallback wrapped;
-    private final ResultCapture capture;
-
-    private boolean callbackTriggered = false;
-
-    public WrappedMethodCallback(AsyncMethodCallback wrapped, ResultCapture capture) {
-      this.wrapped = wrapped;
-      this.capture = capture;
-    }
-
-    private void callbackTriggered() {
-      Preconditions.checkState(!callbackTriggered, "Each callback may only be triggered once.");
-      callbackTriggered = true;
-    }
-
-    @Override @SuppressWarnings("unchecked") public void onComplete(Object o) {
-      capture.success();
-      wrapped.onComplete(o);
-      callbackTriggered();
-    }
-
-    @Override public void onError(Exception t) {
-      if (capture.fail(t)) {
-        wrapped.onError(t);
-        callbackTriggered();
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/thrift/callers/CallerDecorator.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/thrift/callers/CallerDecorator.java b/commons/src/main/java/org/apache/aurora/common/thrift/callers/CallerDecorator.java
deleted file mode 100644
index bd0a952..0000000
--- a/commons/src/main/java/org/apache/aurora/common/thrift/callers/CallerDecorator.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.thrift.callers;
-
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-import org.apache.thrift.async.AsyncMethodCallback;
-
-import javax.annotation.Nullable;
-import java.lang.reflect.Method;
-
-/**
-* A caller that decorates another caller.
-*
-* @author William Farner
-*/
-abstract class CallerDecorator implements Caller {
-  private final Caller decoratedCaller;
-  private final boolean async;
-
-  CallerDecorator(Caller decoratedCaller, boolean async) {
-    this.decoratedCaller = decoratedCaller;
-    this.async = async;
-  }
-
-  /**
-   * Convenience method for invoking the method and shunting the capture into the callback if
-   * the call is asynchronous.
-   *
-   * @param method The method being invoked.
-   * @param args The arguments to call {@code method} with.
-   * @param callback The callback to use if the method is asynchronous.
-   * @param capture The result capture to notify of the call result.
-   * @param connectTimeoutOverride Optional override for the default connection timeout.
-   * @return The return value from invoking the method.
-   * @throws Throwable Exception, as prescribed by the method's contract.
-   */
-  protected final Object invoke(Method method, Object[] args,
-      @Nullable AsyncMethodCallback callback, @Nullable final ResultCapture capture,
-      @Nullable Amount<Long, Time> connectTimeoutOverride) throws Throwable {
-
-    // Swap the wrapped callback out for ours.
-    if (callback != null) {
-      callback = new WrappedMethodCallback(callback, capture);
-    }
-
-    try {
-      Object result = decoratedCaller.call(method, args, callback, connectTimeoutOverride);
-      if (callback == null && capture != null) capture.success();
-
-      return result;
-    } catch (Exception t) {
-      // We allow this one to go to both sync and async captures.
-      if (callback != null) {
-        callback.onError(t);
-        return null;
-      } else {
-        if (capture != null) capture.fail(t);
-        throw t;
-      }
-    }
-  }
-
-  boolean isAsync() {
-    return async;
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/thrift/callers/DeadlineCaller.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/thrift/callers/DeadlineCaller.java b/commons/src/main/java/org/apache/aurora/common/thrift/callers/DeadlineCaller.java
deleted file mode 100644
index 75ed1ec..0000000
--- a/commons/src/main/java/org/apache/aurora/common/thrift/callers/DeadlineCaller.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.thrift.callers;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Future;
-import java.util.concurrent.RejectedExecutionException;
-import java.util.concurrent.TimeoutException;
-
-import javax.annotation.Nullable;
-
-import com.google.common.base.Throwables;
-
-import org.apache.aurora.common.thrift.TResourceExhaustedException;
-import org.apache.thrift.async.AsyncMethodCallback;
-
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-import org.apache.aurora.common.thrift.TTimeoutException;
-
-/**
- * A caller that imposes a time deadline on the underlying caller.  If the underlying calls fail
- * to meet the deadline {@link TTimeoutException} is thrown.  If the executor service rejects
- * execution of a task, {@link TResourceExhaustedException} is thrown.
- *
- * @author William Farner
- */
-public class DeadlineCaller extends CallerDecorator {
-  private final ExecutorService executorService;
-  private final Amount<Long, Time> timeout;
-
-  /**
-   * Creates a new deadline caller.
-   *
-   * @param decoratedCaller The caller to decorate with a deadline.
-   * @param async Whether the caller is asynchronous.
-   * @param executorService The executor service to use for performing calls.
-   * @param timeout The timeout by which the underlying call should complete in.
-   */
-  public DeadlineCaller(Caller decoratedCaller, boolean async, ExecutorService executorService,
-      Amount<Long, Time> timeout) {
-    super(decoratedCaller, async);
-
-    this.executorService = executorService;
-    this.timeout = timeout;
-  }
-
-  @Override
-  public Object call(final Method method, final Object[] args,
-      @Nullable final AsyncMethodCallback callback,
-      @Nullable final Amount<Long, Time> connectTimeoutOverride) throws Throwable {
-    try {
-      Future<Object> result = executorService.submit(new Callable<Object>() {
-        @Override public Object call() throws Exception {
-          try {
-            return invoke(method, args, callback, null, connectTimeoutOverride);
-          } catch (Throwable t) {
-            Throwables.propagateIfInstanceOf(t, Exception.class);
-            throw new RuntimeException(t);
-          }
-        }
-      });
-
-      try {
-        return result.get(timeout.getValue(), timeout.getUnit().getTimeUnit());
-      } catch (TimeoutException e) {
-        result.cancel(true);
-        throw new TTimeoutException(e);
-      } catch (ExecutionException e) {
-        throw e.getCause();
-      }
-    } catch (RejectedExecutionException e) {
-      throw new TResourceExhaustedException(e);
-    } catch (InvocationTargetException e) {
-      throw e.getCause();
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/thrift/callers/DebugCaller.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/thrift/callers/DebugCaller.java b/commons/src/main/java/org/apache/aurora/common/thrift/callers/DebugCaller.java
deleted file mode 100644
index aff4006..0000000
--- a/commons/src/main/java/org/apache/aurora/common/thrift/callers/DebugCaller.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.thrift.callers;
-
-import com.google.common.base.Joiner;
-
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-import org.apache.thrift.async.AsyncMethodCallback;
-
-import javax.annotation.Nullable;
-
-import java.lang.reflect.Method;
-import java.util.logging.Logger;
-
-/**
- * A caller that reports debugging information about calls.
- *
- * @author William Farner
- */
-public class DebugCaller extends CallerDecorator {
-  private static final Logger LOG = Logger.getLogger(DebugCaller.class.getName());
-  private static final Joiner ARG_JOINER = Joiner.on(", ");
-
-  /**
-   * Creates a new debug caller.
-   *
-   * @param decoratedCaller The caller to decorate with debug information.
-   * @param async Whether the caller is asynchronous.
-   */
-  public DebugCaller(Caller decoratedCaller, boolean async) {
-    super(decoratedCaller, async);
-  }
-
-  @Override
-  public Object call(final Method method, final Object[] args,
-      @Nullable AsyncMethodCallback callback, @Nullable Amount<Long, Time> connectTimeoutOverride)
-      throws Throwable {
-    ResultCapture capture = new ResultCapture() {
-      @Override public void success() {
-        // No-op.
-      }
-
-      @Override public boolean fail(Throwable t) {
-        StringBuilder message = new StringBuilder("Thrift call failed: ");
-        message.append(method.getName()).append("(");
-        ARG_JOINER.appendTo(message, args);
-        message.append(")");
-        LOG.warning(message.toString());
-
-        return true;
-      }
-    };
-
-    try {
-      return invoke(method, args, callback, capture, connectTimeoutOverride);
-    } catch (Throwable t) {
-      capture.fail(t);
-      throw t;
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/aurora/blob/356eeac9/commons/src/main/java/org/apache/aurora/common/thrift/callers/RetryingCaller.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/aurora/common/thrift/callers/RetryingCaller.java b/commons/src/main/java/org/apache/aurora/common/thrift/callers/RetryingCaller.java
deleted file mode 100644
index 84a0f4e..0000000
--- a/commons/src/main/java/org/apache/aurora/common/thrift/callers/RetryingCaller.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.aurora.common.thrift.callers;
-
-import java.lang.reflect.Method;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.logging.Logger;
-
-import javax.annotation.Nullable;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Function;
-import com.google.common.base.Joiner;
-import com.google.common.base.Predicate;
-import com.google.common.base.Throwables;
-import com.google.common.cache.CacheBuilder;
-import com.google.common.cache.CacheLoader;
-import com.google.common.cache.LoadingCache;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-
-import org.apache.aurora.common.thrift.TResourceExhaustedException;
-import org.apache.thrift.async.AsyncMethodCallback;
-
-import org.apache.aurora.common.quantity.Amount;
-import org.apache.aurora.common.quantity.Time;
-import org.apache.aurora.common.stats.StatsProvider;
-
-/**
-* A caller that will retry calls to the wrapped caller.
-*
-* @author William Farner
-*/
-public class RetryingCaller extends CallerDecorator {
-  private static final Logger LOG = Logger.getLogger(RetryingCaller.class.getName());
-
-  @VisibleForTesting
-  public static final Amount<Long, Time> NONBLOCKING_TIMEOUT = Amount.of(-1L, Time.MILLISECONDS);
-
-  private final StatsProvider statsProvider;
-  private final String serviceName;
-  private final int retries;
-  private final ImmutableSet<Class<? extends Exception>> retryableExceptions;
-  private final boolean debug;
-
-  /**
-   * Creates a new retrying caller. The retrying caller will attempt to call invoked methods on the
-   * underlying caller at most {@code retries} times.  A retry will be performed only when one of
-   * the {@code retryableExceptions} is caught.
-   *
-   * @param decoratedCall The caller to decorate with retries.
-   * @param async Whether the caller is asynchronous.
-   * @param statsProvider The stat provider to export retry statistics through.
-   * @param serviceName The service name that calls are being invoked on.
-   * @param retries The maximum number of retries to perform.
-   * @param retryableExceptions The exceptions that can be retried.
-   * @param debug Whether to include debugging information when retries are being performed.
-   */
-  public RetryingCaller(Caller decoratedCall, boolean async, StatsProvider statsProvider,
-      String serviceName, int retries, ImmutableSet<Class<? extends Exception>> retryableExceptions,
-      boolean debug) {
-    super(decoratedCall, async);
-    this.statsProvider = statsProvider;
-    this.serviceName = serviceName;
-    this.retries = retries;
-    this.retryableExceptions = retryableExceptions;
-    this.debug = debug;
-  }
-
-  private final LoadingCache<Method, AtomicLong> stats =
-      CacheBuilder.newBuilder().build(new CacheLoader<Method, AtomicLong>() {
-        @Override public AtomicLong load(Method method) {
-          // Thrift does not support overloads - so just the name disambiguates all calls.
-          return statsProvider.makeCounter(serviceName + "_" + method.getName() + "_retries");
-        }
-      });
-
-  @Override public Object call(final Method method, final Object[] args,
-      @Nullable final AsyncMethodCallback callback,
-      @Nullable final Amount<Long, Time> connectTimeoutOverride) throws Throwable {
-    final AtomicLong retryCounter = stats.get(method);
-    final AtomicInteger attempts = new AtomicInteger();
-    final List<Throwable> exceptions = Lists.newArrayList();
-
-    final ResultCapture capture = new ResultCapture() {
-      @Override public void success() {
-        // No-op.
-      }
-
-      @Override public boolean fail(Throwable t) {
-        if (!isRetryable(t)) {
-          if (debug) {
-            LOG.warning(String.format(
-                "Call failed with un-retryable exception of [%s]: %s, previous exceptions: %s",
-                t.getClass().getName(), t.getMessage(), combineStackTraces(exceptions)));
-          }
-
-          return true;
-        } else if (attempts.get() >= retries) {
-          exceptions.add(t);
-
-          if (debug) {
-            LOG.warning(String.format("Retried %d times, last error: %s, exceptions: %s",
-                attempts.get(), t, combineStackTraces(exceptions)));
-          }
-
-          return true;
-        } else {
-          exceptions.add(t);
-
-          if (isAsync() && attempts.incrementAndGet() <= retries) {
-            try {
-              retryCounter.incrementAndGet();
-              // override connect timeout in ThriftCaller to prevent blocking for a connection
-              // for async retries (since this is within the callback in the selector thread)
-              invoke(method, args, callback, this, NONBLOCKING_TIMEOUT);
-            } catch (Throwable throwable) {
-              return fail(throwable);
-            }
-          }
-
-          return false;
-        }
-      }
-    };
-
-    boolean continueLoop;
-    do {
-      try {
-        // If this is an async call, the looping will be handled within the capture.
-        return invoke(method, args, callback, capture, connectTimeoutOverride);
-      } catch (Throwable t) {
-        if (!isRetryable(t)) {
-          Throwable propagated = t;
-
-          if (!exceptions.isEmpty() && (t instanceof TResourceExhaustedException)) {
-            // If we've been trucking along through retries that have had remote call failures
-            // and we suddenly can't immediately get a connection on the next retry, throw the
-            // previous remote call failure - the idea here is that the remote call failure is
-            // more interesting than a transient inability to get an immediate connection.
-            propagated = exceptions.remove(exceptions.size() - 1);
-          }
-
-          if (isAsync()) {
-            callback.onError((Exception) propagated);
-          } else {
-            throw propagated;
-          }
-        }
-      }
-
-      continueLoop = !isAsync() && attempts.incrementAndGet() <= retries;
-      if (continueLoop) retryCounter.incrementAndGet();
-    } while (continueLoop);
-
-    Throwable lastRetriedException = Iterables.getLast(exceptions);
-    if (debug) {
-      if (!exceptions.isEmpty()) {
-        LOG.warning(
-            String.format("Retried %d times, last error: %s, previous exceptions: %s",
-                attempts.get(), lastRetriedException, combineStackTraces(exceptions)));
-      } else {
-        LOG.warning(
-            String.format("Retried 1 time, last error: %s", lastRetriedException));
-      }
-    }
-
-    if (!isAsync()) throw lastRetriedException;
-    return null;
-  }
-
-  private boolean isRetryable(Throwable throwable) {
-    return isRetryable.getUnchecked(throwable.getClass());
-  }
-
-  private final LoadingCache<Class<? extends Throwable>, Boolean> isRetryable =
-      CacheBuilder.newBuilder().build(new CacheLoader<Class<? extends Throwable>, Boolean>() {
-        @Override public Boolean load(Class<? extends Throwable> exceptionClass) {
-          return isRetryable(exceptionClass);
-        }
-      });
-
-  private boolean isRetryable(final Class<? extends Throwable> exceptionClass) {
-    if (retryableExceptions.contains(exceptionClass)) {
-      return true;
-    }
-    return Iterables.any(retryableExceptions, new Predicate<Class<? extends Exception>>() {
-      @Override public boolean apply(Class<? extends Exception> retryableExceptionClass) {
-        return retryableExceptionClass.isAssignableFrom(exceptionClass);
-      }
-    });
-  }
-
-  private static final Joiner STACK_TRACE_JOINER = Joiner.on('\n');
-
-  private static String combineStackTraces(List<Throwable> exceptions) {
-    if (exceptions.isEmpty()) {
-      return "none";
-    } else {
-      return STACK_TRACE_JOINER.join(Iterables.transform(exceptions,
-          new Function<Throwable, String>() {
-            private int index = 1;
-            @Override public String apply(Throwable exception) {
-              return String.format("[%d] %s",
-                  index++, Throwables.getStackTraceAsString(exception));
-            }
-          }));
-    }
-  }
-}