} else {
aggregation = createAggregation(correlationId);
timeout = getTimeout(aggregation);
}
} else if (isRescheduleTimeouts()) {
Timer t = timers.remove(correlationId);
if (t != null) {
t.cancel();
}
timeout = getTimeout(aggregation);
}
// If the aggregation is not closed
if (aggregation != null) {
if (addMessage(aggregation, in, exchange)) {
Timer t = timers.remove(correlationId);
if (t != null) {
t.cancel();
}
sendAggregate(correlationId, aggregation, false);
} else {
store.store(correlationId, aggregation);
if (timeout != null) {
if (LOG.isDebugEnabled()) {
LOG.debug("Scheduling timeout at " + timeout + " for aggregate " + correlationId);
}
Timer t = getTimerManager().schedule(new TimerListener() {
public void timerExpired(Timer timer) {
AbstractAggregator.this.onTimeout(correlationId, timer);
}
}, timeout);
timers.put(correlationId, t);