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

com.fitbur.failsafe.Failsafe Maven / Gradle / Ivy

The newest version!
package com.fitbur.failsafe;

import com.fitbur.failsafe.internal.util.Assert;

/**
 * Simple, sophisticated failure handling.
 * 
 * @author Jonathan Halterman
 */
public class Failsafe {
  /**
   * Creates and returns a new SyncFailsafe instance that will perform executions and retries synchronously according to
   * the {@code retryPolicy}.
   * 
   * @param  result type
   * @throws NullPointerException if {@code retryPolicy} is null
   */
  public static  SyncFailsafe with(RetryPolicy retryPolicy) {
    return new SyncFailsafe(Assert.notNull(retryPolicy, "retryPolicy"));
  }

  /**
   * Creates and returns a new SyncFailsafe instance that will perform executions and retries synchronously according to
   * the {@code circuitBreaker}.
   * 
   * @param  result type
   * @throws NullPointerException if {@code circuitBreaker} is null
   */
  public static  SyncFailsafe with(CircuitBreaker circuitBreaker) {
    return new SyncFailsafe(Assert.notNull(circuitBreaker, "circuitBreaker"));
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy