Search in sources :

Example 26 with MultiMapRecord

use of com.hazelcast.multimap.impl.MultiMapRecord in project hazelcast by hazelcast.

the class TransactionalMultiMapProxySupport method valueCountInternal.

protected int valueCountInternal(Data key) {
    checkObjectNotNull(key);
    Collection<MultiMapRecord> coll = txMap.get(key);
    if (coll == null) {
        CountOperation operation = new CountOperation(name, key);
        operation.setThreadId(ThreadUtil.getThreadId());
        try {
            int partitionId = getNodeEngine().getPartitionService().getPartitionId(key);
            final OperationService operationService = getNodeEngine().getOperationService();
            Future<Integer> f = operationService.invokeOnPartition(MultiMapService.SERVICE_NAME, operation, partitionId);
            return f.get();
        } catch (Throwable t) {
            throw ExceptionUtil.rethrow(t);
        }
    }
    return coll.size();
}
Also used : MultiMapRecord(com.hazelcast.multimap.impl.MultiMapRecord) OperationService(com.hazelcast.spi.OperationService) CountOperation(com.hazelcast.multimap.impl.operations.CountOperation)

Aggregations

MultiMapRecord (com.hazelcast.multimap.impl.MultiMapRecord)26 MultiMapValue (com.hazelcast.multimap.impl.MultiMapValue)11 MultiMapContainer (com.hazelcast.multimap.impl.MultiMapContainer)8 MultiMapResponse (com.hazelcast.multimap.impl.operations.MultiMapResponse)8 Data (com.hazelcast.nio.serialization.Data)7 ArrayList (java.util.ArrayList)5 ConcurrentModificationException (java.util.ConcurrentModificationException)3 List (java.util.List)3 OperationService (com.hazelcast.spi.OperationService)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 MultiMapService (com.hazelcast.multimap.impl.MultiMapService)1 ValueCollectionFactory.createCollection (com.hazelcast.multimap.impl.ValueCollectionFactory.createCollection)1 ValueCollectionFactory.emptyCollection (com.hazelcast.multimap.impl.ValueCollectionFactory.emptyCollection)1 CountOperation (com.hazelcast.multimap.impl.operations.CountOperation)1 GetAllOperation (com.hazelcast.multimap.impl.operations.GetAllOperation)1 TransactionException (com.hazelcast.transaction.TransactionException)1 Collection (java.util.Collection)1 LinkedList (java.util.LinkedList)1