You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2015/05/10 20:42:44 UTC

[3/3] camel git commit: CAMEL-8765: JpaConsumer - May poll too soon before JPA stuff is initialized.

CAMEL-8765: JpaConsumer - May poll too soon before JPA stuff is initialized.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/e137f17e
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e137f17e
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e137f17e

Branch: refs/heads/camel-2.14.x
Commit: e137f17ea545285e053921eafdfc78e82db1d3e3
Parents: c1bdc24
Author: Claus Ibsen <da...@apache.org>
Authored: Sun May 10 20:46:13 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Sun May 10 20:46:41 2015 +0200

----------------------------------------------------------------------
 .../main/java/org/apache/camel/component/jpa/JpaConsumer.java | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/e137f17e/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java
index 95c9d26..0a6ff8e 100644
--- a/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java
+++ b/components/camel-jpa/src/main/java/org/apache/camel/component/jpa/JpaConsumer.java
@@ -479,9 +479,11 @@ public class JpaConsumer extends ScheduledBatchPollingConsumer {
 
     @Override
     protected void doStart() throws Exception {
-        super.doStart();
+        // need to setup entity manager first
         this.entityManager = entityManagerFactory.createEntityManager();
         LOG.trace("Created EntityManager {} on {}", entityManager, this);
+
+        super.doStart();
     }
 
     @Override
@@ -491,8 +493,9 @@ public class JpaConsumer extends ScheduledBatchPollingConsumer {
 
     @Override
     protected void doShutdown() throws Exception {
-        super.doShutdown();
         this.entityManager.close();
         LOG.trace("Closed EntityManager {} on {}", entityManager, this);
+
+        super.doShutdown();
     }
 }