All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.obsidiandynamics.blackstrom.ledger.AppendCallback Maven / Gradle / Ivy

The newest version!
package com.obsidiandynamics.blackstrom.ledger;

import java.io.*;
import java.util.function.*;

import com.obsidiandynamics.blackstrom.model.*;

@FunctionalInterface
public interface AppendCallback {
  static AppendCallback errorLoggingAppendCallback(PrintStream stream) {
    return appendErrorHandler(x -> x.printStackTrace(stream));
  }
  
  static AppendCallback appendErrorHandler(Consumer errorHandler) {
    return (__id, error) -> { 
      if (error != null) errorHandler.accept(error);
    };
  }
  
  static AppendCallback nop() { return (__id, __error) -> {}; }
  
  void onAppend(MessageId messageId, Throwable error);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy