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

io.mongock.driver.api.lock.guard.invoker.LockGuardInvokerImpl Maven / Gradle / Ivy

The newest version!
package io.mongock.driver.api.lock.guard.invoker;

import io.mongock.driver.api.lock.LockManager;

import java.util.function.Supplier;

public class LockGuardInvokerImpl implements LockGuardInvoker {

  private final LockManager lockManager;

  public LockGuardInvokerImpl(LockManager lockManager) {
    this.lockManager = lockManager;
  }

  @Override
  public  T invoke(Supplier supplier) {
    lockManager.ensureLockDefault();
    return supplier.get();
  }

  @Override
  public void invoke(VoidSupplier supplier) {
    lockManager.ensureLockDefault();
    supplier.execute();
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy