use of com.hazelcast.transaction.TransactionalMap in project hazelcast by hazelcast.
the class ClientTxnMapTest method testDuplicateValuesWithPredicates.
@Test
public void testDuplicateValuesWithPredicates() throws Exception {
final String mapName = randomString();
IMap map = client.getMap(mapName);
final SampleTestObjects.Employee emp1 = new SampleTestObjects.Employee("employee1", 10, true, 10D);
map.put("employee1", emp1);
final TransactionContext context = client.newTransactionContext();
context.beginTransaction();
final TransactionalMap txMap = context.getMap(mapName);
assertNull(txMap.put("employee1_repeated", emp1));
assertEquals(2, txMap.size());
assertEquals(2, txMap.keySet(Predicates.sql("age = 10")).size());
assertEquals(2, txMap.values(Predicates.sql("age = 10")).size());
context.commitTransaction();
assertEquals(2, map.keySet(Predicates.sql("age = 10")).size());
assertEquals(2, map.values(Predicates.sql("age = 10")).size());
}
use of com.hazelcast.transaction.TransactionalMap in project hazelcast by hazelcast.
the class TransactionalMapContainsKeyMessageTask method innerCall.
@Override
protected Object innerCall() throws Exception {
final TransactionContext context = endpoint.getTransactionContext(parameters.txnId);
final TransactionalMap map = context.getMap(parameters.name);
return ((TransactionalMapProxy) map).containsKey(parameters.key, true);
}
use of com.hazelcast.transaction.TransactionalMap in project hazelcast by hazelcast.
the class TransactionalMapGetMessageTask method innerCall.
@Override
protected Object innerCall() throws Exception {
final TransactionContext context = endpoint.getTransactionContext(parameters.txnId);
final TransactionalMap map = context.getMap(parameters.name);
Object response = ((TransactionalMapProxy) map).get(parameters.key, true);
return serializationService.toData(response);
}
use of com.hazelcast.transaction.TransactionalMap in project hazelcast by hazelcast.
the class TransactionalMapGetForUpdateMessageTask method innerCall.
@Override
protected Object innerCall() throws Exception {
final TransactionContext context = endpoint.getTransactionContext(parameters.txnId);
final TransactionalMap map = context.getMap(parameters.name);
Object response = map.getForUpdate(parameters.key);
return serializationService.toData(response);
}
use of com.hazelcast.transaction.TransactionalMap in project hazelcast by hazelcast.
the class TransactionalMapIsEmptyMessageTask method innerCall.
@Override
protected Object innerCall() throws Exception {
final TransactionContext context = endpoint.getTransactionContext(parameters.txnId);
final TransactionalMap map = context.getMap(parameters.name);
return map.isEmpty();
}
Aggregations