Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package org.infinispan.client.hotrod.impl;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.infinispan.client.hotrod.impl.Util.await;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
import java.util.function.BiFunction;
import java.util.function.Function;
import org.infinispan.client.hotrod.MetadataValue;
import org.infinispan.client.hotrod.RemoteCache;
/**
* Purpose: keep all delegating and unsupported methods in one place -> readability.
*
* @author [email protected]
* @since 4.1
*/
public abstract class RemoteCacheSupport implements RemoteCache {
protected final long defaultLifespan;
protected final long defaultMaxIdleTime;
protected RemoteCacheSupport() {
this(0, 0);
}
protected RemoteCacheSupport(long defaultLifespan, long defaultMaxIdleTime) {
this.defaultLifespan = defaultLifespan;
this.defaultMaxIdleTime = defaultMaxIdleTime;
}
@Override
public final void putAll(Map extends K, ? extends V> map) {
putAll(map, defaultLifespan, MILLISECONDS, defaultMaxIdleTime, MILLISECONDS);
}
@Override
public final void putAll(Map extends K, ? extends V> map, long lifespan, TimeUnit unit) {
putAll(map, lifespan, unit, defaultMaxIdleTime, MILLISECONDS);
}
@Override
public final void putAll(Map extends K, ? extends V> map, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) {
await(putAllAsync(map, lifespan, lifespanUnit, maxIdleTime, maxIdleTimeUnit));
}
@Override
public final CompletableFuture putAllAsync(Map extends K, ? extends V> data) {
return putAllAsync(data, defaultLifespan, MILLISECONDS, defaultMaxIdleTime, MILLISECONDS);
}
@Override
public final CompletableFuture putAllAsync(Map extends K, ? extends V> data, long lifespan, TimeUnit unit) {
return putAllAsync(data, lifespan, unit, defaultMaxIdleTime, MILLISECONDS);
}
@Override
public abstract CompletableFuture putAllAsync(Map extends K, ? extends V> data, long lifespan,
TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit);
@Override
public final V putIfAbsent(K key, V value) {
return putIfAbsent(key, value, defaultLifespan, MILLISECONDS, defaultMaxIdleTime, MILLISECONDS);
}
@Override
public final V putIfAbsent(K key, V value, long lifespan, TimeUnit unit) {
return putIfAbsent(key, value, lifespan, unit, defaultMaxIdleTime, MILLISECONDS);
}
@Override
public final V putIfAbsent(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) {
return await(putIfAbsentAsync(key, value, lifespan, lifespanUnit, maxIdleTime, maxIdleTimeUnit));
}
@Override
public final CompletableFuture putIfAbsentAsync(K key, V value) {
return putIfAbsentAsync(key, value, defaultLifespan, MILLISECONDS, defaultMaxIdleTime, MILLISECONDS);
}
@Override
public final CompletableFuture putIfAbsentAsync(K key, V value, long lifespan, TimeUnit lifespanUnit) {
return putIfAbsentAsync(key, value, lifespan, lifespanUnit, defaultMaxIdleTime, MILLISECONDS);
}
@Override
public abstract CompletableFuture putIfAbsentAsync(K key, V value, long lifespan, TimeUnit lifespanUnit,
long maxIdle, TimeUnit maxIdleUnit);
@Override
public final boolean replace(K key, V oldValue, V newValue) {
return replace(key, oldValue, newValue, defaultLifespan, MILLISECONDS, defaultMaxIdleTime, MILLISECONDS);
}
@Override
public final boolean replace(K key, V oldValue, V value, long lifespan, TimeUnit unit) {
return replace(key, oldValue, value, lifespan, unit, defaultMaxIdleTime, MILLISECONDS);
}
@Override
public final boolean replace(K key, V oldValue, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) {
return await(replaceAsync(key, oldValue, value, lifespan, lifespanUnit, maxIdleTime, maxIdleTimeUnit));
}
@Override
public final CompletableFuture replaceAsync(K key, V oldValue, V newValue) {
return replaceAsync(key, oldValue, newValue, defaultLifespan, MILLISECONDS);
}
@Override
public final CompletableFuture replaceAsync(K key, V oldValue, V newValue, long lifespan, TimeUnit unit) {
return replaceAsync(key, oldValue, newValue, lifespan, unit, defaultMaxIdleTime, MILLISECONDS);
}
@Override
public abstract CompletableFuture replaceAsync(K key, V oldValue, V newValue, long lifespan, TimeUnit lifespanUnit,
long maxIdle, TimeUnit maxIdleUnit);
@Override
public final V replace(K key, V value) {
return replace(key, value, defaultLifespan, MILLISECONDS, defaultMaxIdleTime, MILLISECONDS);
}
@Override
public final V replace(K key, V value, long lifespan, TimeUnit unit) {
return replace(key, value, lifespan, unit, defaultMaxIdleTime, MILLISECONDS);
}
@Override
public final V replace(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) {
return await(replaceAsync(key, value, lifespan, lifespanUnit, maxIdleTime, maxIdleTimeUnit));
}
@Override
public final CompletableFuture replaceAsync(K key, V value) {
return replaceAsync(key, value, defaultLifespan, MILLISECONDS, defaultMaxIdleTime, MILLISECONDS);
}
@Override
public final CompletableFuture replaceAsync(K key, V value, long lifespan, TimeUnit unit) {
return replaceAsync(key, value, lifespan, unit, defaultMaxIdleTime, MILLISECONDS);
}
@Override
public abstract CompletableFuture replaceAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdle,
TimeUnit maxIdleUnit);
@Override
public final V get(Object key) {
return await(getAsync((K) key));
}
@Override
public abstract CompletableFuture getAsync(K key);
@Override
public final Map getAll(Set extends K> keys) {
return await(getAllAsync(keys));
}
@Override
public abstract CompletableFuture