Repository: camel Updated Branches: refs/heads/master b8dea6b6a -> 5017a5a48
Polished Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5017a5a4 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/5017a5a4 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/5017a5a4 Branch: refs/heads/master Commit: 5017a5a48fe1291ed5e5ab9ce1aa79b263a3facf Parents: b8dea6b Author: Claus Ibsen <davscl...@apache.org> Authored: Fri Dec 19 15:37:32 2014 +0100 Committer: Claus Ibsen <davscl...@apache.org> Committed: Fri Dec 19 15:37:32 2014 +0100 ---------------------------------------------------------------------- .../camel/processor/UnitOfWorkProducer.java | 26 ++------------------ 1 file changed, 2 insertions(+), 24 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/5017a5a4/camel-core/src/main/java/org/apache/camel/processor/UnitOfWorkProducer.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/processor/UnitOfWorkProducer.java b/camel-core/src/main/java/org/apache/camel/processor/UnitOfWorkProducer.java index 7684b65..2b5f522 100644 --- a/camel-core/src/main/java/org/apache/camel/processor/UnitOfWorkProducer.java +++ b/camel-core/src/main/java/org/apache/camel/processor/UnitOfWorkProducer.java @@ -16,14 +16,12 @@ */ package org.apache.camel.processor; -import java.util.concurrent.CountDownLatch; - -import org.apache.camel.AsyncCallback; import org.apache.camel.AsyncProcessor; import org.apache.camel.Endpoint; import org.apache.camel.Exchange; import org.apache.camel.ExchangePattern; import org.apache.camel.Producer; +import org.apache.camel.util.AsyncProcessorHelper; import org.apache.camel.util.ServiceHelper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -70,27 +68,7 @@ public final class UnitOfWorkProducer implements Producer { } public void process(final Exchange exchange) throws Exception { - final CountDownLatch latch = new CountDownLatch(1); - boolean sync = processor.process(exchange, new AsyncCallback() { - public void done(boolean doneSync) { - if (!doneSync) { - LOG.trace("Asynchronous callback received for exchangeId: {}", exchange.getExchangeId()); - latch.countDown(); - } - } - - @Override - public String toString() { - return "Done " + processor; - } - }); - if (!sync) { - LOG.trace("Waiting for asynchronous callback before continuing for exchangeId: {} -> {}", - exchange.getExchangeId(), exchange); - latch.await(); - LOG.trace("Asynchronous callback received, will continue routing exchangeId: {} -> {}", - exchange.getExchangeId(), exchange); - } + AsyncProcessorHelper.process(processor, exchange); } public void start() throws Exception {