Class LockUtil


  • public class LockUtil
    extends Object
    Class HttpServerRequestUtil.
    Author:
    https://github.com/mcweba [Marc-Andre Weber]
    • Method Detail

      • acquireLock

        public static io.vertx.core.Future<Boolean> acquireLock​(Lock lockImpl,
                                                                String lock,
                                                                String token,
                                                                long lockExpiryMs,
                                                                org.slf4j.Logger log)
        Acquire a lock. Resolves always to Boolean.TRUE when no lock implementation is provided
        Parameters:
        lockImpl - the lock implementation
        lock - the lock
        token - the unique token
        lockExpiryMs - the expiry of the lock
        log - the logger
        Returns:
        A boolean Future whether the lock could has been acquired or not
      • releaseLock

        public void releaseLock​(Lock lockImpl,
                                String lock,
                                String token,
                                org.slf4j.Logger log)
        Release a lock.
        Parameters:
        lockImpl - the lock implementation
        lock - the lock
        token - the unique token
        log - the Logger
      • calcLockExpiry

        public static long calcLockExpiry​(long taskInterval)
        Calculate the lock expiry time. This is a simple helper to work with the lock expiry time.
        Parameters:
        taskInterval - the interval of the task
        Returns:
        the calculated lock expiry time