public void execute(String desc,Consumer<MongoClient> operation){
  while (true) {
    MongoClient primary=primaryConnectionSupplier.get();
    try {
      operation.accept(primary);
      return;
    }
 catch (    Throwable t) {
      errorHandler.accept(desc,t);
    }
  }
}

public void execute ( String desc , Consumer < MongoClient > operation ) { while ( true ) { MongoClient primary = primaryConnectionSupplier . get ( ) ; try { operation . accept ( primary ) ; return ; } catch ( Throwable t ) { errorHandler . accept ( desc , t ) ; } } }
execute the supplied operation using the primary , blocking until a primary is available . whenever the operation stops ( e . g . , if the primary is no longer primary ) , then restart the operation using the current primary .
