code: @InterfaceAudience.Public
      public void restart() {
  
          // stop replicator if necessary
          if (this.isRunning()) {
              final CountDownLatch stopped = new CountDownLatch(1);
              ChangeListener listener = new ChangeListener() {
                  @Override
                  public void changed(ChangeEvent event) {
                      if (event.getTransition() != null &&
                              event.getTransition().getDestination() == ReplicationState.STOPPED) {
                          stopped.countDown();
                      }
                  }
              };
              addChangeListener(listener);
  
              // tries to stop replicator
              stop();
  
              try {
                  // If need to wait more than 60 sec to stop, throws Exception
                  boolean ret = stopped.await(60, TimeUnit.SECONDS);
                  if (ret == false) {
                      throw new RuntimeException("Replicator is unable to stop.");
                  }
              } catch (InterruptedException e) {
                  throw new RuntimeException(e);
              } finally {
                  removeChangeListener(listener);
              }
          }
  
          // start replicator
          start();
      }
docs: Restarts the replication.  This blocks until the replication successfully stops.
  <p/>
  Alternatively, you can stop() the replication and create a brand new one and start() it.