org.infinispan.iteration.impl.TransactionAwareCloseableIterable Maven / Gradle / Ivy
package org.infinispan.iteration.impl;
import org.infinispan.Cache;
import org.infinispan.commons.util.CloseableIterable;
import org.infinispan.commons.util.CloseableIterator;
import org.infinispan.container.entries.CacheEntry;
import org.infinispan.context.impl.TxInvocationContext;
import org.infinispan.transaction.impl.LocalTransaction;
/**
* CloseableIterable implementation that will enhance another CloseableIterable to use the provided context values in the
* iteration process properly. That is context values will take precendence over values found from the iterator.
*
* @author wburns
* @since 7.0
*/
public class TransactionAwareCloseableIterable implements CloseableIterable> {
protected final CloseableIterable> iterable;
protected final TxInvocationContext ctx;
protected final Cache cache;
public TransactionAwareCloseableIterable(CloseableIterable> iterable,
TxInvocationContext ctx, Cache cache) {
this.iterable = iterable;
this.ctx = ctx;
this.cache = cache;
}
@Override
public void close() {
iterable.close();
}
@Override
public CloseableIterator> iterator() {
return new TransactionAwareCloseableIterator(iterable.iterator(), ctx, cache);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy