package org.folio.okapi.util;

import io.vertx.core.AsyncResult;
import io.vertx.core.Handler;
import io.vertx.core.Vertx;
import io.vertx.core.shareddata.Lock;
import io.vertx.core.shareddata.SharedData;

public class AsyncLock {

  private final boolean isCluster;
  private final SharedData shared;

  public AsyncLock(Vertx vertx) {
    shared = vertx.sharedData();
    isCluster = vertx.isClustered();
  }

  public void getLock(String name, Handler<AsyncResult<Lock>> resultHandler) {
    if (isCluster) {
      shared.getLock(name, resultHandler);
    } else {
      shared.getLocalLock(name, resultHandler);
    }
  }
}

@@ -480,24 +480,56 @@
 tHandler) %7B%0A
+    long longTime = 2000000000;%0A
     if (isCl
@@ -553,27 +553,48 @@
 ared.getLock
-(na
+WithTimeout(name, longTi
 me, resultHa
@@ -639,19 +639,40 @@
 ocalLock
-(na
+WithTimeout(name, longTi
 me, resu

Fix timer calls terminated for connection refused OKAPI-734 (#803)