Search in sources :

Example 31 with TransactionalMap

use of com.hazelcast.core.TransactionalMap in project hazelcast by hazelcast.

the class TransactionalMapGetMessageTask method innerCall.

@Override
protected Object innerCall() throws Exception {
    final TransactionContext context = getEndpoint().getTransactionContext(parameters.txnId);
    final TransactionalMap map = context.getMap(parameters.name);
    Object response = map.get(parameters.key);
    return serializationService.toData(response);
}
Also used : TransactionalMap(com.hazelcast.core.TransactionalMap) TransactionContext(com.hazelcast.transaction.TransactionContext)

Example 32 with TransactionalMap

use of com.hazelcast.core.TransactionalMap in project hazelcast by hazelcast.

the class TransactionalMapIsEmptyMessageTask method innerCall.

@Override
protected Object innerCall() throws Exception {
    final TransactionContext context = getEndpoint().getTransactionContext(parameters.txnId);
    final TransactionalMap map = context.getMap(parameters.name);
    return map.isEmpty();
}
Also used : TransactionalMap(com.hazelcast.core.TransactionalMap) TransactionContext(com.hazelcast.transaction.TransactionContext)

Example 33 with TransactionalMap

use of com.hazelcast.core.TransactionalMap in project hazelcast by hazelcast.

the class TransactionalMapPutMessageTask method innerCall.

@Override
protected Object innerCall() throws Exception {
    final TransactionContext context = getEndpoint().getTransactionContext(parameters.txnId);
    final TransactionalMap map = context.getMap(parameters.name);
    Object response = map.put(parameters.key, parameters.value, parameters.ttl, TimeUnit.MILLISECONDS);
    return serializationService.toData(response);
}
Also used : TransactionalMap(com.hazelcast.core.TransactionalMap) TransactionContext(com.hazelcast.transaction.TransactionContext)

Example 34 with TransactionalMap

use of com.hazelcast.core.TransactionalMap in project hazelcast by hazelcast.

the class TransactionalMapRemoveMessageTask method innerCall.

@Override
protected Object innerCall() throws Exception {
    final TransactionContext context = getEndpoint().getTransactionContext(parameters.txnId);
    final TransactionalMap map = context.getMap(parameters.name);
    Object oldValue = map.remove(parameters.key);
    return serializationService.toData(oldValue);
}
Also used : TransactionalMap(com.hazelcast.core.TransactionalMap) TransactionContext(com.hazelcast.transaction.TransactionContext)

Example 35 with TransactionalMap

use of com.hazelcast.core.TransactionalMap in project hazelcast by hazelcast.

the class TransactionalMapReplaceMessageTask method innerCall.

@Override
protected Object innerCall() throws Exception {
    final TransactionContext context = getEndpoint().getTransactionContext(parameters.txnId);
    final TransactionalMap map = context.getMap(parameters.name);
    Object oldValue = map.replace(parameters.key, parameters.value);
    return serializationService.toData(oldValue);
}
Also used : TransactionalMap(com.hazelcast.core.TransactionalMap) TransactionContext(com.hazelcast.transaction.TransactionContext)

Aggregations

TransactionalMap (com.hazelcast.core.TransactionalMap)92 Test (org.junit.Test)73 QuickTest (com.hazelcast.test.annotation.QuickTest)68 ParallelTest (com.hazelcast.test.annotation.ParallelTest)67 HazelcastInstance (com.hazelcast.core.HazelcastInstance)61 TransactionException (com.hazelcast.transaction.TransactionException)60 TransactionalTaskContext (com.hazelcast.transaction.TransactionalTaskContext)59 NightlyTest (com.hazelcast.test.annotation.NightlyTest)47 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)38 Config (com.hazelcast.config.Config)36 TransactionContext (com.hazelcast.transaction.TransactionContext)33 MapStoreConfig (com.hazelcast.config.MapStoreConfig)32 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)30 IMap (com.hazelcast.core.IMap)29 HazelcastTestSupport.randomString (com.hazelcast.test.HazelcastTestSupport.randomString)12 SqlPredicate (com.hazelcast.query.SqlPredicate)8 HazelcastInstanceNotActiveException (com.hazelcast.core.HazelcastInstanceNotActiveException)7 Collection (java.util.Collection)7 ExpectedRuntimeException (com.hazelcast.test.ExpectedRuntimeException)6 TransactionNotActiveException (com.hazelcast.transaction.TransactionNotActiveException)6