use of com.hazelcast.multimap.impl.operations.MultiMapResponse in project hazelcast by hazelcast.
the class ObjectMultiMapProxy method get.
@Override
public Collection<V> get(K key) {
checkNotNull(key, NULL_KEY_IS_NOT_ALLOWED);
final NodeEngine nodeEngine = getNodeEngine();
Data dataKey = nodeEngine.toData(key);
MultiMapResponse result = getAllInternal(dataKey);
return result.getObjectCollection(nodeEngine);
}
use of com.hazelcast.multimap.impl.operations.MultiMapResponse in project hazelcast by hazelcast.
the class ObjectMultiMapProxy method values.
@Override
public Collection<V> values() {
final NodeEngine nodeEngine = getNodeEngine();
Map map = valuesInternal();
Collection values = new LinkedList();
for (Object obj : map.values()) {
if (obj == null) {
continue;
}
MultiMapResponse response = nodeEngine.toObject(obj);
values.addAll(response.getObjectCollection(nodeEngine));
}
return values;
}
use of com.hazelcast.multimap.impl.operations.MultiMapResponse in project hazelcast by hazelcast.
the class TransactionalMultiMapProxySupport method getInternal.
protected Collection<MultiMapRecord> getInternal(Data key) {
checkObjectNotNull(key);
Collection<MultiMapRecord> coll = txMap.get(key);
if (coll == null) {
GetAllOperation operation = new GetAllOperation(name, key);
operation.setThreadId(ThreadUtil.getThreadId());
try {
int partitionId = getNodeEngine().getPartitionService().getPartitionId(key);
final OperationService operationService = getNodeEngine().getOperationService();
Future<MultiMapResponse> f = operationService.invokeOnPartition(MultiMapService.SERVICE_NAME, operation, partitionId);
MultiMapResponse response = f.get();
coll = response.getRecordCollection(getNodeEngine());
} catch (Throwable t) {
throw ExceptionUtil.rethrow(t);
}
}
return coll;
}
use of com.hazelcast.multimap.impl.operations.MultiMapResponse in project hazelcast by hazelcast.
the class TxnLockAndGetOperation method run.
@Override
public void run() throws Exception {
MultiMapContainer container = getOrCreateContainer();
if (!container.txnLock(dataKey, getCallerUuid(), threadId, getCallId(), ttl, blockReads)) {
throw new TransactionException("Transaction couldn't obtain lock!");
}
MultiMapValue multiMapValue = getMultiMapValueOrNull();
boolean isLocal = executedLocally();
Collection<MultiMapRecord> collection = multiMapValue == null ? null : multiMapValue.getCollection(isLocal);
MultiMapResponse multiMapResponse = new MultiMapResponse(collection, getValueCollectionType(container));
multiMapResponse.setNextRecordId(container.nextId());
response = multiMapResponse;
}
Aggregations