Search in sources :

Example 11 with AtomicConfiguration

use of org.apache.ignite.configuration.AtomicConfiguration in project ignite by apache.

the class IgniteAtomicLongChangingTopologySelfTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
    discoSpi.setIpFinder(IP_FINDER);
    cfg.setDiscoverySpi(discoSpi).setNetworkTimeout(30_000);
    AtomicConfiguration atomicCfg = new AtomicConfiguration();
    atomicCfg.setCacheMode(PARTITIONED);
    atomicCfg.setBackups(1);
    cfg.setAtomicConfiguration(atomicCfg);
    ((TcpCommunicationSpi) cfg.getCommunicationSpi()).setSharedMemoryPort(-1);
    cfg.setClientMode(client);
    cfg.setPeerClassLoadingEnabled(false);
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) AtomicConfiguration(org.apache.ignite.configuration.AtomicConfiguration) TcpCommunicationSpi(org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 12 with AtomicConfiguration

use of org.apache.ignite.configuration.AtomicConfiguration in project ignite by apache.

the class IgniteCachePutRetryAbstractSelfTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    cfg.setIncludeEventTypes();
    ((TcpDiscoverySpi) cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
    ((TcpCommunicationSpi) cfg.getCommunicationSpi()).setSharedMemoryPort(-1);
    AtomicConfiguration acfg = new AtomicConfiguration();
    acfg.setBackups(1);
    cfg.setAtomicConfiguration(acfg);
    cfg.setIncludeEventTypes(new int[0]);
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) AtomicConfiguration(org.apache.ignite.configuration.AtomicConfiguration) TcpCommunicationSpi(org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 13 with AtomicConfiguration

use of org.apache.ignite.configuration.AtomicConfiguration in project ignite by apache.

the class GridCachePartitionedSequenceMultiNodeSelfTest method atomicConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected AtomicConfiguration atomicConfiguration() {
    AtomicConfiguration atomicCfg = super.atomicConfiguration();
    atomicCfg.setBackups(1);
    atomicCfg.setAtomicSequenceReserveSize(BATCH_SIZE);
    return atomicCfg;
}
Also used : AtomicConfiguration(org.apache.ignite.configuration.AtomicConfiguration)

Example 14 with AtomicConfiguration

use of org.apache.ignite.configuration.AtomicConfiguration in project ignite by apache.

the class GridCacheAtomicReferenceApiSelfAbstractTest 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);
    IgniteAtomicReference<String> ref1 = ignite.atomicReference("ref1", "a", true);
    IgniteAtomicReference<String> ref2 = ignite.atomicReference("ref2", "b", true);
    IgniteAtomicReference<String> ref3 = ignite.atomicReference("ref3", "c", true);
    AtomicConfiguration cfg = new AtomicConfiguration().setGroupName("grp1");
    IgniteAtomicReference<String> ref4 = ignite.atomicReference("ref4", cfg, "d", true);
    IgniteAtomicReference<String> ref5 = ignite.atomicReference("ref5", cfg, "e", true);
    IgniteAtomicReference<String> ref6 = ignite.atomicReference("ref6", cfg, "f", true);
    assertNull(ignite.atomicReference("ref4", "a", false));
    assertNull(ignite.atomicReference("ref5", "a", false));
    assertNull(ignite.atomicReference("ref6", "a", false));
    assertNull(ignite.atomicReference("ref1", cfg, "a", false));
    assertNull(ignite.atomicReference("ref2", cfg, "a", false));
    assertNull(ignite.atomicReference("ref3", cfg, "a", false));
    assertTrue(ref1.compareAndSet("a", "A"));
    assertTrue(ref2.compareAndSet("b", "B"));
    assertTrue(ref3.compareAndSet("c", "C"));
    assertTrue(ref4.compareAndSet("d", "D"));
    assertTrue(ref5.compareAndSet("e", "E"));
    assertTrue(ref6.compareAndSet("f", "F"));
    assertFalse(ref1.compareAndSet("a", "Z"));
    assertFalse(ref2.compareAndSet("b", "Z"));
    assertFalse(ref3.compareAndSet("c", "Z"));
    assertFalse(ref4.compareAndSet("d", "Z"));
    assertFalse(ref5.compareAndSet("e", "Z"));
    assertFalse(ref6.compareAndSet("f", "Z"));
    assertEquals("A", ref1.get());
    assertEquals("B", ref2.get());
    assertEquals("C", ref3.get());
    assertEquals("D", ref4.get());
    assertEquals("E", ref5.get());
    assertEquals("F", ref6.get());
    ref2.close();
    ref5.close();
    assertTrue(ref2.removed());
    assertTrue(ref5.removed());
    assertNull(ignite.atomicReference("ref2", "b", false));
    assertNull(ignite.atomicReference("ref5", cfg, "e", false));
    assertFalse(ref1.removed());
    assertFalse(ref3.removed());
    assertFalse(ref4.removed());
    assertFalse(ref6.removed());
    assertNotNull(ignite.atomicReference("ref1", "a", false));
    assertNotNull(ignite.atomicReference("ref3", "c", false));
    assertNotNull(ignite.atomicReference("ref4", cfg, "d", false));
    assertNotNull(ignite.atomicReference("ref6", cfg, "f", false));
}
Also used : Ignite(org.apache.ignite.Ignite) AtomicConfiguration(org.apache.ignite.configuration.AtomicConfiguration)

Example 15 with AtomicConfiguration

use of org.apache.ignite.configuration.AtomicConfiguration in project ignite by apache.

the class GridCachePartitionedAtomicReferenceApiSelfTest method atomicConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected AtomicConfiguration atomicConfiguration() {
    AtomicConfiguration cfg = super.atomicConfiguration();
    cfg.setBackups(1);
    return cfg;
}
Also used : AtomicConfiguration(org.apache.ignite.configuration.AtomicConfiguration)

Aggregations

AtomicConfiguration (org.apache.ignite.configuration.AtomicConfiguration)29 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)10 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)9 Ignite (org.apache.ignite.Ignite)6 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)5 TcpCommunicationSpi (org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi)5 IgniteAtomicSequence (org.apache.ignite.IgniteAtomicSequence)3 HashMap (java.util.HashMap)2 LinkedHashMap (java.util.LinkedHashMap)2 IgniteAtomicLong (org.apache.ignite.IgniteAtomicLong)2 BinaryBasicNameMapper (org.apache.ignite.binary.BinaryBasicNameMapper)2 LruEvictionPolicy (org.apache.ignite.cache.eviction.lru.LruEvictionPolicy)2 BinaryConfiguration (org.apache.ignite.configuration.BinaryConfiguration)2 TransactionConfiguration (org.apache.ignite.configuration.TransactionConfiguration)2 PlatformDotNetBinaryConfiguration (org.apache.ignite.platform.dotnet.PlatformDotNetBinaryConfiguration)2 NoopEventStorageSpi (org.apache.ignite.spi.eventstorage.NoopEventStorageSpi)2 MemoryEventStorageSpi (org.apache.ignite.spi.eventstorage.memory.MemoryEventStorageSpi)2 Serializable (java.io.Serializable)1 Map (java.util.Map)1 IgniteException (org.apache.ignite.IgniteException)1