@Override
protected void setChunk(SimpleStepBuilder<I, O> builder) {
if(timeout != null && getCommitInterval() != null) {
CompositeCompletionPolicy completionPolicy = new CompositeCompletionPolicy();
CompletionPolicy [] policies = new CompletionPolicy[2];
policies[0] = new SimpleCompletionPolicy(getCommitInterval());
policies[1] = new TimeoutTerminationPolicy(timeout * 1000);
completionPolicy.setPolicies(policies);
builder.chunk(completionPolicy);
} else if(timeout != null) {
builder.chunk(new TimeoutTerminationPolicy(timeout * 1000));