use of com.hazelcast.map.impl.operation.MapOperation in project hazelcast by hazelcast.
the class MapProxySupport method evictInternal.
/**
* Evicts a key from a map.
*
* @param key the key to evict
* @return {@code true} if eviction was successful, {@code false} otherwise
*/
protected boolean evictInternal(Object key) {
Data keyData = toDataWithStrategy(key);
MapOperation operation = operationProvider.createEvictOperation(name, keyData, false);
return (Boolean) invokeOperation(keyData, operation);
}
use of com.hazelcast.map.impl.operation.MapOperation in project hazelcast by hazelcast.
the class MapProxySupport method setAsyncInternal.
protected InternalCompletableFuture<Data> setAsyncInternal(Object key, Data valueData, long ttl, TimeUnit timeunit, long maxIdle, TimeUnit maxIdleUnit) {
Data keyData = toDataWithStrategy(key);
int partitionId = partitionService.getPartitionId(keyData);
MapOperation operation = newSetOperation(keyData, valueData, ttl, timeunit, maxIdle, maxIdleUnit);
operation.setThreadId(getThreadId());
try {
final InvocationFuture<Data> result;
if (statisticsEnabled) {
long startTimeNanos = Timer.nanos();
result = operationService.invokeOnPartitionAsync(SERVICE_NAME, operation, partitionId);
result.whenCompleteAsync(new IncrementStatsExecutionCallback<>(operation, startTimeNanos), CALLER_RUNS);
} else {
result = operationService.invokeOnPartitionAsync(SERVICE_NAME, operation, partitionId);
}
return result;
} catch (Throwable t) {
throw rethrow(t);
}
}
use of com.hazelcast.map.impl.operation.MapOperation in project hazelcast by hazelcast.
the class MapProxySupport method setInternal.
// WARNING: when UpdateEvent is fired it does *NOT* contain the oldValue
// see this: https://github.com/hazelcast/hazelcast/pull/6088#issuecomment-136025968
protected void setInternal(Object key, Data valueData, long ttl, TimeUnit timeunit, long maxIdle, TimeUnit maxIdleUnit) {
Data keyData = toDataWithStrategy(key);
MapOperation operation = newSetOperation(keyData, valueData, ttl, timeunit, maxIdle, maxIdleUnit);
invokeOperation(keyData, operation);
}
use of com.hazelcast.map.impl.operation.MapOperation in project hazelcast by hazelcast.
the class MapProxySupport method containsKeyInternal.
protected boolean containsKeyInternal(Object key) {
Data keyData = toDataWithStrategy(key);
int partitionId = partitionService.getPartitionId(keyData);
MapOperation containsKeyOperation = operationProvider.createContainsKeyOperation(name, keyData);
containsKeyOperation.setThreadId(getThreadId());
containsKeyOperation.setServiceName(SERVICE_NAME);
try {
Future future = operationService.invokeOnPartition(SERVICE_NAME, containsKeyOperation, partitionId);
Object object = future.get();
incrementOtherOperationsStat();
return (Boolean) toObject(object);
} catch (Throwable t) {
throw rethrow(t);
}
}
use of com.hazelcast.map.impl.operation.MapOperation in project hazelcast by hazelcast.
the class MapProxySupport method setTtlInternal.
protected boolean setTtlInternal(Object key, long ttl, TimeUnit timeUnit) {
long ttlInMillis = timeUnit.toMillis(ttl);
Data keyData = serializationService.toData(key);
MapOperation operation = operationProvider.createSetTtlOperation(name, keyData, ttlInMillis);
return (Boolean) invokeOperation(keyData, operation);
}
Aggregations