summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Marius Venstad <venstad@gmail.com>2019-02-07 16:21:54 +0100
committerJon Marius Venstad <venstad@gmail.com>2019-02-07 16:21:54 +0100
commit7d6cc76f9493f8d799ce7e06a6c4d2504a52e7d9 (patch)
tree6cbdcdfc798e7ae8c203e8800a9ae8334201102c
parent7dd4287830ec74a054e1251ae7b63b53481ae8af (diff)
Remove unused or pointless code
-rw-r--r--orchestrator/src/main/java/com/yahoo/vespa/orchestrator/status/ZookeeperStatusService.java20
-rw-r--r--orchestrator/src/test/java/com/yahoo/vespa/orchestrator/status/ZookeeperStatusServiceTest.java25
2 files changed, 4 insertions, 41 deletions
diff --git a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/status/ZookeeperStatusService.java b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/status/ZookeeperStatusService.java
index c56ff661bba..0d00ab7becd 100644
--- a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/status/ZookeeperStatusService.java
+++ b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/status/ZookeeperStatusService.java
@@ -9,7 +9,6 @@ import com.yahoo.vespa.curator.Curator;
import com.yahoo.vespa.curator.Lock;
import com.yahoo.vespa.orchestrator.OrchestratorContext;
import com.yahoo.vespa.orchestrator.OrchestratorUtil;
-import org.apache.curator.framework.recipes.locks.InterProcessSemaphoreMutex;
import org.apache.zookeeper.KeeperException.NoNodeException;
import org.apache.zookeeper.KeeperException.NodeExistsException;
import org.apache.zookeeper.data.Stat;
@@ -18,8 +17,6 @@ import javax.inject.Inject;
import java.time.Duration;
import java.util.HashSet;
import java.util.Set;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
import java.util.logging.Logger;
/**
@@ -107,19 +104,6 @@ public class ZookeeperStatusService implements StatusService {
}
}
- private InterProcessSemaphoreMutex acquireMutexOrThrow(long timeout, TimeUnit timeoutTimeUnit, String lockPath) throws Exception {
- InterProcessSemaphoreMutex mutex = new InterProcessSemaphoreMutex(curator.framework(), lockPath);
-
- log.log(LogLevel.DEBUG, "Waiting for lock on " + lockPath);
- boolean acquired = mutex.acquire(timeout, timeoutTimeUnit);
- if (!acquired) {
- log.log(LogLevel.DEBUG, "Timed out waiting for lock on " + lockPath);
- throw new TimeoutException("Timed out waiting for lock on " + lockPath);
- }
- log.log(LogLevel.DEBUG, "Successfully acquired lock on " + lockPath);
- return mutex;
- }
-
private void setHostStatus(ApplicationInstanceReference applicationInstanceReference,
HostName hostName,
HostStatus status) {
@@ -198,10 +182,6 @@ public class ZookeeperStatusService implements StatusService {
return applicationInstancePath(applicationInstanceReference) + "/hosts-allowed-down";
}
- private static String applicationInstanceLockPath(ApplicationInstanceReference applicationInstanceReference) {
- return applicationInstancePath(applicationInstanceReference) + "/lock";
- }
-
private static String applicationInstanceLock2Path(ApplicationInstanceReference applicationInstanceReference) {
return applicationInstancePath(applicationInstanceReference) + "/lock2";
}
diff --git a/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/status/ZookeeperStatusServiceTest.java b/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/status/ZookeeperStatusServiceTest.java
index d57b0106b5b..818a184024b 100644
--- a/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/status/ZookeeperStatusServiceTest.java
+++ b/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/status/ZookeeperStatusServiceTest.java
@@ -92,15 +92,15 @@ public class ZookeeperStatusServiceTest {
//shuffling to catch "clean database" failures for all cases.
for (HostStatus hostStatus: shuffledList(HostStatus.values())) {
- doTimes(2, () -> {
+ for (int i = 0; i < 2; i++) {
statusRegistry.setHostState(
TestIds.HOST_NAME1,
hostStatus);
assertThat(statusRegistry.getHostStatus(
- TestIds.HOST_NAME1),
- is(hostStatus));
- });
+ TestIds.HOST_NAME1),
+ is(hostStatus));
+ }
}
}
}
@@ -262,17 +262,6 @@ public class ZookeeperStatusServiceTest {
assertThat(suspendedApps, hasItem(TestIds.APPLICATION_INSTANCE_REFERENCE2));
}
- private static void assertSessionFailed(Runnable statusServiceOperations) {
- try {
- statusServiceOperations.run();
- fail("Expected session expired exception");
- } catch (RuntimeException e) {
- if (!(e.getCause() instanceof SessionFailedException)) {
- throw e;
- }
- }
- }
-
//TODO: move to vespajlib
private static <T> List<T> shuffledList(T[] values) {
//new ArrayList necessary to avoid "write through" behaviour
@@ -281,10 +270,4 @@ public class ZookeeperStatusServiceTest {
return list;
}
- //TODO: move to vespajlib
- private static void doTimes(int numberOfIterations, Runnable runnable) {
- for (int i = 0; i < numberOfIterations; i++) {
- runnable.run();
- }
- }
}