Search in sources :

Example 86 with Data

use of com.hazelcast.nio.serialization.Data in project hazelcast by hazelcast.

the class MapProxySupport method getAsyncInternal.

protected InternalCompletableFuture<Data> getAsyncInternal(Data key) {
    int partitionId = partitionService.getPartitionId(key);
    MapOperation operation = operationProvider.createGetOperation(name, key);
    try {
        long startTime = System.currentTimeMillis();
        InternalCompletableFuture<Data> future = operationService.createInvocationBuilder(SERVICE_NAME, operation, partitionId).setResultDeserialized(false).invoke();
        if (statisticsEnabled) {
            future.andThen(new IncrementStatsExecutionCallback<Data>(operation, startTime));
        }
        return future;
    } catch (Throwable t) {
        throw rethrow(t);
    }
}
Also used : Data(com.hazelcast.nio.serialization.Data) MapOperation(com.hazelcast.map.impl.operation.MapOperation)

Example 87 with Data

use of com.hazelcast.nio.serialization.Data in project hazelcast by hazelcast.

the class MapProxySupport method putAsyncInternal.

protected InternalCompletableFuture<Data> putAsyncInternal(Data key, Data value, long ttl, TimeUnit timeunit) {
    int partitionId = getNodeEngine().getPartitionService().getPartitionId(key);
    MapOperation operation = operationProvider.createPutOperation(name, key, value, getTimeInMillis(ttl, timeunit));
    operation.setThreadId(ThreadUtil.getThreadId());
    try {
        long startTime = System.currentTimeMillis();
        InternalCompletableFuture<Data> future = operationService.invokeOnPartition(SERVICE_NAME, operation, partitionId);
        if (statisticsEnabled) {
            future.andThen(new IncrementStatsExecutionCallback<Data>(operation, startTime));
        }
        return future;
    } catch (Throwable t) {
        throw rethrow(t);
    }
}
Also used : Data(com.hazelcast.nio.serialization.Data) MapOperation(com.hazelcast.map.impl.operation.MapOperation)

Example 88 with Data

use of com.hazelcast.nio.serialization.Data in project hazelcast by hazelcast.

the class NearCachedMapProxyImpl method executeOnEntriesInternal.

@Override
public void executeOnEntriesInternal(EntryProcessor entryProcessor, Predicate predicate, List<Data> resultingKeyValuePairs) {
    super.executeOnEntriesInternal(entryProcessor, predicate, resultingKeyValuePairs);
    for (int i = 0; i < resultingKeyValuePairs.size(); i += 2) {
        Data key = resultingKeyValuePairs.get(i);
        invalidateCache(key);
    }
}
Also used : Data(com.hazelcast.nio.serialization.Data)

Example 89 with Data

use of com.hazelcast.nio.serialization.Data in project hazelcast by hazelcast.

the class NearCachedMapProxyImpl method getCachedValues.

private void getCachedValues(List<Data> keys, List<Object> resultingKeyValuePairs) {
    Iterator<Data> iterator = keys.iterator();
    while (iterator.hasNext()) {
        Data key = iterator.next();
        Object value = getCachedValue(key, true);
        if (value == null || value == NOT_CACHED) {
            continue;
        }
        resultingKeyValuePairs.add(toObject(key));
        resultingKeyValuePairs.add(toObject(value));
        iterator.remove();
    }
}
Also used : Data(com.hazelcast.nio.serialization.Data)

Example 90 with Data

use of com.hazelcast.nio.serialization.Data in project hazelcast by hazelcast.

the class NearCachedMapProxyImpl method removeInternal.

@Override
protected Data removeInternal(Data key) {
    Data data = super.removeInternal(key);
    invalidateCache(key);
    return data;
}
Also used : Data(com.hazelcast.nio.serialization.Data)

Aggregations

Data (com.hazelcast.nio.serialization.Data)773 ClientMessage (com.hazelcast.client.impl.protocol.ClientMessage)140 Test (org.junit.Test)121 QuickTest (com.hazelcast.test.annotation.QuickTest)118 ParallelTest (com.hazelcast.test.annotation.ParallelTest)108 ArrayList (java.util.ArrayList)81 Map (java.util.Map)64 SerializationService (com.hazelcast.spi.serialization.SerializationService)54 HashMap (java.util.HashMap)54 NodeEngine (com.hazelcast.spi.NodeEngine)50 HashSet (java.util.HashSet)39 Address (com.hazelcast.nio.Address)28 AbstractMap (java.util.AbstractMap)28 Record (com.hazelcast.map.impl.record.Record)27 HazelcastInstance (com.hazelcast.core.HazelcastInstance)26 HeapData (com.hazelcast.internal.serialization.impl.HeapData)26 List (java.util.List)20 Future (java.util.concurrent.Future)20 CacheEventData (com.hazelcast.cache.impl.CacheEventData)19 Operation (com.hazelcast.spi.Operation)18