I have plans to load cache concurrently from multiple threads. The simplest form of this would be:
IgniteCache<Integer, Integer> cache = ignite.getOrCreateCache("ints");
ExecutorService es = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
for (int i = 0; i < 20000000; i++) {
int t = i;
es.submit(() -> {
cache.put(t, t);
});
}
Is it safe to do like that? I read the documentation of the method:
Associates the specified value with the specified key in the cache. If the Cache previously contained a mapping for the key, the old value is replaced by the specified value. (A cache c is said to contain a mapping for a key k if and only if c.containsKey(k) would return true.)
There is no any words about thread-safety. So is it safe to put in IgniteCache
concurrently?