public final class LeaderElection extends Object implements org.apache.twill.common.Cancellable
Constructor and Description |
---|
LeaderElection(org.apache.twill.zookeeper.ZKClient zkClient,
String prefix,
ElectionHandler handler) |
Modifier and Type | Method and Description |
---|---|
com.google.common.util.concurrent.ListenableFuture<?> |
asyncCancel()
Withdraw from the leader election process asynchronously.
|
void |
cancel()
Withdraw from the leader election process.
|
public LeaderElection(org.apache.twill.zookeeper.ZKClient zkClient, String prefix, ElectionHandler handler)
public void cancel()
ElectionHandler.follower()
is returned if currently is a leader and the ZK node is removed.cancel
in interface org.apache.twill.common.Cancellable
public com.google.common.util.concurrent.ListenableFuture<?> asyncCancel()
ListenableFuture
that will be completed when cancelling is completed.Copyright © 2013-2016 Cask Data, Inc. Licensed under the Apache License, Version 2.0.