use of com.hazelcast.multimap.impl.operations.MultiMapResponse in project hazelcast by hazelcast.
the class TransactionalMultiMapProxySupport method lockAndGet.
private MultiMapResponse lockAndGet(Data key, long timeout, long ttl) {
final NodeEngine nodeEngine = getNodeEngine();
boolean blockReads = tx.getTransactionType() == TransactionType.ONE_PHASE;
TxnLockAndGetOperation operation = new TxnLockAndGetOperation(name, key, timeout, ttl, getThreadId(), blockReads);
try {
int partitionId = nodeEngine.getPartitionService().getPartitionId(key);
final OperationService operationService = nodeEngine.getOperationService();
Future<MultiMapResponse> f = operationService.invokeOnPartition(MultiMapService.SERVICE_NAME, operation, partitionId);
return f.get();
} catch (Throwable t) {
throw ExceptionUtil.rethrow(t);
}
}
use of com.hazelcast.multimap.impl.operations.MultiMapResponse in project hazelcast by hazelcast.
the class MultiMapKeySetMessageTask method reduce.
@Override
protected Object reduce(Map<Integer, Object> map) {
List<Data> keys = new ArrayList<Data>();
for (Object obj : map.values()) {
if (obj == null) {
continue;
}
MultiMapResponse response = (MultiMapResponse) obj;
Collection<Data> coll = response.getCollection();
if (coll != null) {
keys.addAll(coll);
}
}
return keys;
}
use of com.hazelcast.multimap.impl.operations.MultiMapResponse in project hazelcast by hazelcast.
the class MultiMapRemoveMessageTask method encodeResponse.
@Override
protected ClientMessage encodeResponse(Object response) {
MultiMapResponse multiMapResponse = (MultiMapResponse) response;
Collection<MultiMapRecord> collection = multiMapResponse.getCollection();
List<Data> resultCollection = new ArrayList<Data>(collection.size());
for (MultiMapRecord multiMapRecord : collection) {
resultCollection.add(serializationService.toData(multiMapRecord.getObject()));
}
return MultiMapRemoveCodec.encodeResponse(resultCollection);
}
use of com.hazelcast.multimap.impl.operations.MultiMapResponse in project hazelcast by hazelcast.
the class MultiMapGetMessageTask method encodeResponse.
@Override
protected ClientMessage encodeResponse(Object response) {
List<Data> collection = new ArrayList<Data>();
Collection<MultiMapRecord> responseCollection = ((MultiMapResponse) response).getCollection();
if (responseCollection != null) {
for (MultiMapRecord record : responseCollection) {
collection.add(serializationService.toData(record.getObject()));
}
}
return MultiMapGetCodec.encodeResponse(collection);
}
use of com.hazelcast.multimap.impl.operations.MultiMapResponse in project hazelcast by hazelcast.
the class MultiMapValuesMessageTask method reduce.
@Override
protected Object reduce(Map<Integer, Object> map) {
List<Data> list = new ArrayList<Data>();
for (Object obj : map.values()) {
if (obj == null) {
continue;
}
MultiMapResponse response = (MultiMapResponse) obj;
Collection<MultiMapRecord> coll = response.getCollection();
if (coll == null) {
continue;
}
for (MultiMapRecord record : coll) {
list.add(serializationService.toData(record.getObject()));
}
}
return list;
}
Aggregations