Class PartitionedTask<I,O,X,Y>

java.lang.Object
ch.tocco.nice2.persist.core.api.exec.PartitionedTask<I,O,X,Y>
Type Parameters:
I - parameter type of the PartitionedTask
O - return type of the PartitionedTask
X - parameter type of the nested task
Y - return type of the nested task
All Implemented Interfaces:
PersistTask<Iterable<I>,Iterable<O>>, PersistTaskIterable<Iterable<I>,O>

public class PartitionedTask<I,O,X,Y> extends Object implements PersistTaskIterable<Iterable<I>,O>
A PersistTaskIterable that takes an Iterable of parameters. The nested task is executed once for each partition (and given an Iterable of parameters). For each partition a new context (and transaction) is created to limit the size of the context. As Entity instances can only be used with the Context they are associated to, they should typically not be used as parameter or return types of the outer PersistTaskIterable (I, O) (use PrimaryKey or EntityId instead!). In addition this would defeat the purpose of using multiple contexts to save memory. The inner task can use Entity as parameter or return type though. A converter function that has to be passed to the constructor will convert the parameters and return values of the outer task to inner task and vice versa. (see entityToPrimaryKey() for example).