use of org.apache.camel.spi.SynchronizationVetoable in project camel by apache.
the class DefaultUnitOfWork method handoverSynchronization.
@Override
public void handoverSynchronization(Exchange target, Predicate<Synchronization> filter) {
if (synchronizations == null || synchronizations.isEmpty()) {
return;
}
Iterator<Synchronization> it = synchronizations.iterator();
while (it.hasNext()) {
Synchronization synchronization = it.next();
boolean handover = true;
if (synchronization instanceof SynchronizationVetoable) {
SynchronizationVetoable veto = (SynchronizationVetoable) synchronization;
handover = veto.allowHandover();
}
if (handover && (filter == null || filter.test(synchronization))) {
log.trace("Handover synchronization {} to: {}", synchronization, target);
target.addOnCompletion(synchronization);
// remove it if its handed over
it.remove();
} else {
log.trace("Handover not allow for synchronization {}", synchronization);
}
}
}
Aggregations