org.infinispan.util.concurrent.locks.PendingLockManager Maven / Gradle / Ivy
package org.infinispan.util.concurrent.locks;
import java.util.Collection;
import java.util.concurrent.TimeUnit;
import org.infinispan.context.impl.TxInvocationContext;
/**
* A manager that checks and waits for older topology transaction with conflicting keys.
*
* @author Pedro Ruivo
* @since 8.0
*/
public interface PendingLockManager {
/**
* Same as {@link #awaitPendingTransactionsForKey(TxInvocationContext, Object, long, TimeUnit)} but non-blocking.
*
* Multiple invocations with the same transaction returns the same {@link PendingLockPromise}. For cleanup purposes,
* {@link #awaitPendingTransactionsForKey(TxInvocationContext, Object, long, TimeUnit)} must be invoked
* afterwards.
*
* @param ctx the {@link TxInvocationContext}.
* @param key the key to check.
* @param time timeout.
* @param unit {@link TimeUnit} of {@code time}.
* @return a {@link PendingLockPromise}.
*/
PendingLockPromise checkPendingTransactionsForKey(TxInvocationContext> ctx, Object key, long time, TimeUnit unit);
/**
* Same as {@link #awaitPendingTransactionsForAllKeys(TxInvocationContext, Collection, long, TimeUnit)} but
* non-blocking.
*
* Multiple invocations with the same transaction returns the same {@link PendingLockPromise}. For cleanup purposes,
* {@link #awaitPendingTransactionsForAllKeys(TxInvocationContext, Collection, long, TimeUnit)} must be invoked
* afterwards.
*
* @param ctx the {@link TxInvocationContext}.
* @param keys the keys to check.
* @param time timeout.
* @param unit {@link TimeUnit} of {@code time}.
* @return a {@link PendingLockPromise}.
*/
PendingLockPromise checkPendingTransactionsForKeys(TxInvocationContext> ctx, Collection