Module io.github.bucket4j.core
Class AbstractSelectForUpdateBasedProxyManager<K>
- java.lang.Object
-
- io.github.bucket4j.distributed.proxy.AbstractProxyManager<K>
-
- io.github.bucket4j.distributed.proxy.generic.select_for_update.AbstractSelectForUpdateBasedProxyManager<K>
-
- Type Parameters:
K- the generic type for unique identifiers that used to point to the bucket in external storage.
- All Implemented Interfaces:
ProxyManager<K>
public abstract class AbstractSelectForUpdateBasedProxyManager<K> extends AbstractProxyManager<K>
The base class for proxy managers that built on top of idea that underlining storage provide Compare-And-Swap functionality.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractSelectForUpdateBasedProxyManager(ClientSideConfig clientSideConfig)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract SelectForUpdateBasedTransactionallocateTransaction(K key, Optional<Long> timeoutNanos)protected voidapplyTimeout(PreparedStatement statement, Optional<Long> requestTimeoutNanos)<T> CommandResult<T>execute(K key, Request<T> request)<T> CompletableFuture<CommandResult<T>>executeAsync(K key, Request<T> request)booleanisAsyncModeSupported()Describes whether or not this manager supports asynchronous API.protected CompletableFuture<Void>removeAsync(Object key)-
Methods inherited from class io.github.bucket4j.distributed.proxy.AbstractProxyManager
asAsync, builder, getBackwardCompatibilityVersion, getClientSideConfig, getClientSideTime, getProxyConfiguration
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.github.bucket4j.distributed.proxy.ProxyManager
removeProxy, withMapper
-
-
-
-
Constructor Detail
-
AbstractSelectForUpdateBasedProxyManager
protected AbstractSelectForUpdateBasedProxyManager(ClientSideConfig clientSideConfig)
-
-
Method Detail
-
execute
public <T> CommandResult<T> execute(K key, Request<T> request)
- Specified by:
executein classAbstractProxyManager<K>
-
isAsyncModeSupported
public boolean isAsyncModeSupported()
Description copied from interface:ProxyManagerDescribes whether or not this manager supports asynchronous API. If this method returnsfalsethen any invocation ofProxyManager.asAsync()will throwUnsupportedOperationException.- Returns:
trueif this extension supports asynchronous API
-
executeAsync
public <T> CompletableFuture<CommandResult<T>> executeAsync(K key, Request<T> request)
- Specified by:
executeAsyncin classAbstractProxyManager<K>
-
removeAsync
protected CompletableFuture<Void> removeAsync(Object key)
- Specified by:
removeAsyncin classAbstractProxyManager<K>
-
allocateTransaction
protected abstract SelectForUpdateBasedTransaction allocateTransaction(K key, Optional<Long> timeoutNanos)
-
applyTimeout
protected void applyTimeout(PreparedStatement statement, Optional<Long> requestTimeoutNanos) throws SQLException
- Throws:
SQLException
-
-