Search in sources :

Example 6 with IgniteIllegalStateException

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

the class IgniteCachePrimaryNodeFailureRecoveryAbstractTest method checkKey.

/**
     * @param key Key.
     * @param keyNodes Key nodes.
     */
private void checkKey(Integer key, Collection<ClusterNode> keyNodes) {
    if (keyNodes == null) {
        for (Ignite ignite : G.allGrids()) {
            IgniteCache<Integer, Integer> cache = ignite.cache(DEFAULT_CACHE_NAME);
            assertNull("Unexpected value for: " + ignite.name(), cache.localPeek(key));
        }
        for (Ignite ignite : G.allGrids()) {
            IgniteCache<Integer, Integer> cache = ignite.cache(DEFAULT_CACHE_NAME);
            assertNull("Unexpected value for: " + ignite.name(), cache.get(key));
        }
    } else {
        boolean found = false;
        for (ClusterNode node : keyNodes) {
            try {
                Ignite ignite = grid(node);
                found = true;
                ignite.cache(DEFAULT_CACHE_NAME);
                assertEquals("Unexpected value for: " + ignite.name(), key, key);
            } catch (IgniteIllegalStateException ignore) {
            // No-op.
            }
        }
        assertTrue("Failed to find key node.", found);
        for (Ignite ignite : G.allGrids()) {
            IgniteCache<Integer, Integer> cache = ignite.cache(DEFAULT_CACHE_NAME);
            assertEquals("Unexpected value for: " + ignite.name(), key, cache.get(key));
        }
    }
}
Also used : ClusterNode(org.apache.ignite.cluster.ClusterNode) Ignite(org.apache.ignite.Ignite) IgniteIllegalStateException(org.apache.ignite.IgniteIllegalStateException)

Aggregations

IgniteIllegalStateException (org.apache.ignite.IgniteIllegalStateException)6 Ignite (org.apache.ignite.Ignite)3 MalformedURLException (java.net.MalformedURLException)1 URL (java.net.URL)1 Collection (java.util.Collection)1 ServletContext (javax.servlet.ServletContext)1 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)1 IgniteException (org.apache.ignite.IgniteException)1 ClusterNode (org.apache.ignite.cluster.ClusterNode)1 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)1 IgniteKernal (org.apache.ignite.internal.IgniteKernal)1 CacheObjectBinaryProcessorImpl (org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl)1 IgniteCacheObjectProcessor (org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessor)1 GridSpringResourceContext (org.apache.ignite.internal.processors.resource.GridSpringResourceContext)1 GridAbsPredicate (org.apache.ignite.internal.util.lang.GridAbsPredicate)1