+
+ @Override
+ public boolean anyVotingPeers() {
+ if(numVotingPeers < 0) {
+ numVotingPeers = 0;
+ for(PeerInfo info: getPeers()) {
+ if(info.isVoting()) {
+ numVotingPeers++;
+ }
+ }
+ }
+
+ return numVotingPeers > 0;
+ }
+
+ @Override
+ public RaftActorBehavior getCurrentBehavior() {
+ return currentBehavior;
+ }
+
+ void setCurrentBehavior(final RaftActorBehavior behavior) {
+ this.currentBehavior = Preconditions.checkNotNull(behavior);
+ }
+
+ void close() {
+ if (currentBehavior != null) {
+ try {
+ currentBehavior.close();
+ } catch (Exception e) {
+ LOG.debug("{}: Error closing behavior {}", getId(), currentBehavior.state());
+ }
+ }
+ }