Skip to content
Snippets Groups Projects
Commit e2e959b9 authored by Lorenz Boguhn's avatar Lorenz Boguhn
Browse files

merge zookeeper

parents 647f5b71 bdeadef8
No related branches found
No related tags found
4 merge requests!159Re-implementation of Theodolite with Kotlin/Quarkus,!157Update Graal Image in CI pipeline,!83WIP: Re-implementation of Theodolite with Kotlin/Quarkus,!78Resolve "Implement Quarkus/Kotlin protype"
......@@ -6,9 +6,6 @@ import io.quarkus.runtime.annotations.QuarkusMain
object Main {
@JvmStatic
fun main(args: Array<String>) {
println("Running main method")
//Quarkus.run()
}
}
package theodolite
import org.apache.zookeeper.KeeperException
import org.apache.zookeeper.WatchedEvent
import org.apache.zookeeper.Watcher
import org.apache.zookeeper.ZooKeeper
class WorkloadGeneratorStateCleaner(ip: String) {
val path = "/workload-generation"
val sessionTimeout = 60
val retryTime = 3000L
lateinit var zookeeperClient: ZooKeeper
init {
try {
val watcher: Watcher = ZookeperWatcher() // defined below
zookeeperClient = ZooKeeper(ip, sessionTimeout, watcher)
} catch (e:Exception) {
System.out.println(e.toString())
}
}
fun deleteAll() {
var deleted = false
while (!deleted) {
//
try {
zookeeperClient.delete(path, -1)
} catch (ex: Exception) {
System.out.println(ex.toString())
}
try {
val clients = zookeeperClient.getChildren(path, true)
if (clients.isEmpty()){
break;
}
} catch (ex: Exception) {
when (ex) {
is KeeperException -> { deleted = true }
is InterruptedException -> {
System.out.println(ex.toString())
}
}
}
Thread.sleep(retryTime)
System.out.println("ZooKeeper reset was not successful. Retrying in 5s")
}
System.out.println("ZooKeeper reset was successful")
}
}
private class ZookeperWatcher : Watcher {
override fun process(event: WatchedEvent) {}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment