use of org.apache.ignite.configuration.AtomicConfiguration in project ignite by apache.
the class GridCacheSequenceApiSelfAbstractTest method atomicConfiguration.
/**
* {@inheritDoc}
*/
protected AtomicConfiguration atomicConfiguration() {
AtomicConfiguration atomicCfg = super.atomicConfiguration();
atomicCfg.setAtomicSequenceReserveSize(BATCH_SIZE);
return atomicCfg;
}
use of org.apache.ignite.configuration.AtomicConfiguration in project ignite by apache.
the class IgniteAtomicLongApiAbstractSelfTest method testMultipleStructuresInDifferentGroups.
/**
* Tests that basic API works correctly when there are multiple structures in multiple groups.
*
* @throws Exception If failed.
*/
public void testMultipleStructuresInDifferentGroups() throws Exception {
Ignite ignite = grid(0);
AtomicConfiguration cfg = new AtomicConfiguration().setGroupName("grp1");
IgniteAtomicLong atomic1 = ignite.atomicLong("atomic1", 1, true);
IgniteAtomicLong atomic2 = ignite.atomicLong("atomic2", 2, true);
IgniteAtomicLong atomic3 = ignite.atomicLong("atomic3", cfg, 3, true);
IgniteAtomicLong atomic4 = ignite.atomicLong("atomic4", cfg, 4, true);
assertNull(ignite.atomicLong("atomic1", cfg, 1, false));
assertNull(ignite.atomicLong("atomic2", cfg, 2, false));
assertNull(ignite.atomicLong("atomic3", 3, false));
assertNull(ignite.atomicLong("atomic4", 4, false));
assertTrue(atomic1.compareAndSet(1, 11));
assertTrue(atomic2.compareAndSet(2, 12));
assertTrue(atomic3.compareAndSet(3, 13));
assertTrue(atomic4.compareAndSet(4, 14));
assertFalse(atomic1.compareAndSet(1, 0));
assertFalse(atomic2.compareAndSet(2, 0));
assertFalse(atomic3.compareAndSet(3, 0));
assertFalse(atomic4.compareAndSet(4, 0));
atomic2.close();
atomic4.close();
assertTrue(atomic2.removed());
assertTrue(atomic4.removed());
assertNull(ignite.atomicLong("atomic2", 2, false));
assertNull(ignite.atomicLong("atomic4", cfg, 4, false));
assertFalse(atomic1.removed());
assertFalse(atomic3.removed());
assertNotNull(ignite.atomicLong("atomic1", 1, false));
assertNotNull(ignite.atomicLong("atomic3", cfg, 3, false));
}
use of org.apache.ignite.configuration.AtomicConfiguration in project ignite by apache.
the class IgniteAtomicsAbstractTest method atomicConfiguration.
/**
* @return Atomic configuration.
*/
protected AtomicConfiguration atomicConfiguration() {
AtomicConfiguration atomicCfg = new AtomicConfiguration();
atomicCfg.setCacheMode(atomicsCacheMode());
return atomicCfg;
}
use of org.apache.ignite.configuration.AtomicConfiguration in project ignite by apache.
the class GridCachePartitionedAtomicSequenceMultiThreadedTest method atomicConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected AtomicConfiguration atomicConfiguration() {
AtomicConfiguration cfg = super.atomicConfiguration();
cfg.setBackups(1);
cfg.setAtomicSequenceReserveSize(10);
return cfg;
}
use of org.apache.ignite.configuration.AtomicConfiguration in project ignite by apache.
the class GridCachePartitionedAtomicLongLoadTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
AtomicConfiguration atomicCfg = new AtomicConfiguration();
atomicCfg.setCacheMode(PARTITIONED);
atomicCfg.setBackups(1);
atomicCfg.setAtomicSequenceReserveSize(10);
c.setAtomicConfiguration(atomicCfg);
c.getTransactionConfiguration().setDefaultTxConcurrency(PESSIMISTIC);
c.getTransactionConfiguration().setDefaultTxIsolation(REPEATABLE_READ);
CacheConfiguration cc = defaultCacheConfiguration();
cc.setCacheMode(CacheMode.PARTITIONED);
cc.setRebalanceMode(CacheRebalanceMode.SYNC);
cc.setWriteSynchronizationMode(FULL_SYNC);
LruEvictionPolicy plc = new LruEvictionPolicy();
plc.setMaxSize(1000);
cc.setEvictionPolicy(plc);
cc.setOnheapCacheEnabled(true);
cc.setBackups(1);
cc.setAffinity(new RendezvousAffinityFunction(true));
c.setCacheConfiguration(cc);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(ipFinder);
c.setDiscoverySpi(disco);
return c;
}
Aggregations