public void reset(ClusterState toState){
  if (observingContext.getAndSet(null) != null) {
    clusterService.remove(clusterStateListener);
  }
  lastObservedState.set(new ObservedState(toState));
}

public void reset ( ClusterState toState ) { if ( observingContext . getAndSet ( null ) != null ) { clusterService . remove ( clusterStateListener ) ; } lastObservedState . set ( new ObservedState ( toState ) ) ; }
reset this observer to the give cluster state . any pending waits will be canceled .
