Search in sources :

Example 6 with IgniteAtomicStamped

use of org.apache.ignite.IgniteAtomicStamped in project ignite by apache.

the class GridCacheAbstractDataStructuresFailoverSelfTest method testAtomicStampedTopologyChange.

/**
     * @throws Exception If failed.
     */
public void testAtomicStampedTopologyChange() throws Exception {
    try (IgniteAtomicStamped atomic = grid(0).atomicStamped(STRUCTURE_NAME, 10, 10, true)) {
        Ignite g = startGrid(NEW_IGNITE_INSTANCE_NAME);
        IgniteBiTuple<Integer, Integer> t = g.atomicStamped(STRUCTURE_NAME, 10, 10, false).get();
        assertEquals((Integer) 10, t.get1());
        assertEquals((Integer) 10, t.get2());
        g.atomicStamped(STRUCTURE_NAME, 10, 10, false).set(20, 20);
        stopGrid(NEW_IGNITE_INSTANCE_NAME);
        t = grid(0).atomicStamped(STRUCTURE_NAME, 10, 10, false).get();
        assertEquals((Integer) 20, t.get1());
        assertEquals((Integer) 20, t.get2());
    }
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) IgniteAtomicStamped(org.apache.ignite.IgniteAtomicStamped) Ignite(org.apache.ignite.Ignite)

Aggregations

Ignite (org.apache.ignite.Ignite)6 IgniteAtomicStamped (org.apache.ignite.IgniteAtomicStamped)6 IgniteClientDisconnectedException (org.apache.ignite.IgniteClientDisconnectedException)2 Closeable (java.io.Closeable)1 ArrayList (java.util.ArrayList)1 CyclicBarrier (java.util.concurrent.CyclicBarrier)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 IgniteAtomicLong (org.apache.ignite.IgniteAtomicLong)1 IgniteAtomicReference (org.apache.ignite.IgniteAtomicReference)1 IgniteAtomicSequence (org.apache.ignite.IgniteAtomicSequence)1 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)1 IgniteCountDownLatch (org.apache.ignite.IgniteCountDownLatch)1 IgniteException (org.apache.ignite.IgniteException)1 IgniteLock (org.apache.ignite.IgniteLock)1 IgniteQueue (org.apache.ignite.IgniteQueue)1 IgniteSemaphore (org.apache.ignite.IgniteSemaphore)1 IgniteSet (org.apache.ignite.IgniteSet)1 IgniteInternalFuture (org.apache.ignite.internal.IgniteInternalFuture)1