}
@Override
public void perform(final Consumer<MapService<K, V>> action,
MapService<K, V> view) {
ConcurrentContext ctx = ConcurrentContext.enter();
try {
int concurrency = ctx.getConcurrency();
MapService<K, V>[] subViews = view.split(concurrency + 1, false);
for (int i = 1; i < subViews.length; i++) {
final MapService<K, V> subView = subViews[i];
ctx.execute(new Runnable() {
@Override
public void run() {
target().perform(action, subView);
}
});
}
target().perform(action, subViews[0]); // This thread works too !
} finally {
// Any exception raised during parallel iterations will be re-raised here.
ctx.exit();
}
}