public void renewLock()

in spi/src/main/java/org/opensearch/jobscheduler/spi/utils/LockService.java [309:329]


    public void renewLock(final LockModel lock, ActionListener<LockModel> listener) {
        if (lock == null) {
            logger.debug("Lock is null. Nothing to renew.");
            listener.onResponse(null);
        } else {
            logger.debug("Renewing lock: {}. The lock was acquired or renewed on: {}, and the duration was {} sec.",
                    lock, lock.getLockTime(), lock.getLockDurationSeconds());
            final LockModel lockToRenew = new LockModel(lock, getNow(), lock.getLockDurationSeconds(), false);
            updateLock(lockToRenew, ActionListener.wrap(
                    renewedLock -> {
                        logger.debug("Renewed lock: {}. It is supposed to be valid for another {} sec from {}.",
                                renewedLock, renewedLock.getLockDurationSeconds(), renewedLock.getLockTime());
                        listener.onResponse(renewedLock);
                    },
                    exception -> {
                        logger.debug("Failed to renew lock: {}.", lock);
                        listener.onFailure(exception);
                    }
            ));
        }
    }