private void cleanup(IOExceptionConsumer<WAL> cleanupWAL, IOExceptionRunnable finalCleanup)
    throws IOException {
    MultipleIOException.Builder builder = new MultipleIOException.Builder();
    for (Optional<WAL> wal : peerId2WAL.values()) {
      if (wal.isPresent()) {
        try {
          cleanupWAL.accept(wal.get());
        } catch (IOException e) {
          LOG.error("cleanup WAL failed", e);
          builder.add(e);
        }
      }
    }
    try {
      finalCleanup.run();
    } catch (IOException e) {
      LOG.error("cleanup WAL failed", e);
      builder.add(e);
    }
    if (!builder.isEmpty()) {
      throw builder.build();
    }
  }
Base class for a WAL Provider.
<p>
We will put some common logic here, especially for sync replication implementation, as it must do
some hacks before the normal wal creation operation.
<p>
All {@link WALProvider} implementations should extends this class instead of implement
{@link WALProvider} directly, except {@link DisabledWALProvider}.
hbase-server/src/main/java/org/apache/hadoop/hbase/wal/AbstractWALProvider.java