use of org.apache.ignite.internal.processors.cache.IgniteCacheFutureImpl in project ignite by apache.
the class DataStreamerImpl method addData.
/** {@inheritDoc} */
@Override
public IgniteFuture<?> addData(Collection<? extends Map.Entry<K, V>> entries) {
A.notEmpty(entries, "entries");
checkSecurityPermission(SecurityPermission.CACHE_PUT);
enterBusy();
try {
GridFutureAdapter<Object> resFut = new GridFutureAdapter<>();
resFut.listen(rmvActiveFut);
activeFuts.add(resFut);
Collection<KeyCacheObjectWrapper> keys = new GridConcurrentHashSet<>(entries.size(), U.capacity(entries.size()), 1);
Collection<DataStreamerEntry> entries0 = new ArrayList<>(entries.size());
for (Map.Entry<K, V> entry : entries) {
KeyCacheObject key = cacheObjProc.toCacheKeyObject(cacheObjCtx, null, entry.getKey(), true);
CacheObject val = cacheObjProc.toCacheObject(cacheObjCtx, entry.getValue(), true);
keys.add(new KeyCacheObjectWrapper(key));
entries0.add(new DataStreamerEntry(key, val));
}
load0(entries0, resFut, keys, 0);
return new IgniteCacheFutureImpl<>(resFut);
} catch (IgniteDataStreamerTimeoutException e) {
throw e;
} catch (IgniteException e) {
return new IgniteFinishedFutureImpl<>(e);
} finally {
leaveBusy();
}
}
Aggregations