Hi.

Could you please share your reproducer example?


I added classes to repoduce the error. It also throws cache closed errors I
am ok with it. But others.

-- 
Alper Tekinalp

Software Developer
Evam Streaming Analytics

Atatürk Mah. Turgut Özal Bulv.
Gardenya 5 Plaza K:6 Ataşehir
34758 İSTANBUL

Tel:  +90 216 455 01 53 Fax: +90 216 455 01 54
www.evam.com.tr
<http://www.evam.com>
/**
 * Created by alpert on 08/11/2016.
 */
public class Main {

    public static void main(String[] args) throws InterruptedException {
        IgniteThread t1 = new IgniteThread("1");
        IgniteThread t2 = new IgniteThread("2");

        t1.createCache();
        t2.createCache();

        t1.start();
        t2.start();

        t1.destroyCache();
        Thread.sleep(100);
        t2.destroyCache();

        System.exit(0);
    }
}
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.Ignition;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheMemoryMode;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cache.CacheRebalanceMode;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.cache.query.QueryCursor;
import org.apache.ignite.cache.query.ScanQuery;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.processors.cache.CacheEntryImpl;
import org.apache.ignite.lang.IgniteBiPredicate;

/**
 * Created by alpert on 08/12/2016.
 */
public class IgniteThread extends Thread {
    private static String cacheName = "EXAMPLE";

    Ignite start;

    public IgniteThread(String gridName) {
        IgniteConfiguration igniteConfiguration = new IgniteConfiguration();
        igniteConfiguration.setGridName(gridName);
        start = Ignition.start(igniteConfiguration);
        setName(gridName);
    }

    public void run() {

        while (true) {

            ScanQuery<String, String> scanQuery = new ScanQuery<String, String>()
                    .setLocal(true)
                    .setFilter(new IgniteBiPredicate<String, String>() {
                        @Override
                        public boolean apply(String key, String p) {
                            return key.equals("");
                        }
                    });

            IgniteCache<String, String> example = start.cache(cacheName);
            for(int partition : start.affinity(cacheName).primaryPartitions(start.cluster().localNode())) {
                scanQuery.setPartition(partition);

                try (QueryCursor cursor = example.query(scanQuery)) {
                    for (Object p : cursor) {
                        String value = (String) ((CacheEntryImpl) p).getValue();
                        System.out.println(value);
                    }
                } catch (Exception e)  {
                    e.printStackTrace();
                }
            }

            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }

    public void createCache() {
        CacheConfiguration configuration = new CacheConfiguration();
        configuration.setAtomicityMode(CacheAtomicityMode.ATOMIC)
                .setCacheMode(CacheMode.PARTITIONED)
                .setMemoryMode(CacheMemoryMode.OFFHEAP_TIERED)
                .setRebalanceMode(CacheRebalanceMode.SYNC)
                .setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC)
                .setRebalanceThrottle(100)
                .setRebalanceBatchSize(2*1024*1024)
                .setBackups(1)
                .setName(cacheName)
                .setEagerTtl(false);
        start.getOrCreateCache(configuration);
    }

    public void destroyCache() {
        start.destroyCache(cacheName);
    }
}

Reply via email to