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 2014/03/25 08:42:47 UTC

[4/5] git commit: CAMEL-7321: Fix inconsistent synchronization to prevent freezing of JcrConsumer

CAMEL-7321: Fix inconsistent synchronization to prevent freezing of
JcrConsumer

Signed-off-by: Gregor Zurowski <gr...@zurowski.org>


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

Branch: refs/heads/camel-2.13.x
Commit: ab38c272820f0169d470e63af4cc8e6f25026c1f
Parents: b3af650
Author: Gregor Zurowski <gr...@zurowski.org>
Authored: Sun Mar 23 18:17:14 2014 -0400
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Mar 25 08:45:23 2014 +0100

----------------------------------------------------------------------
 components/camel-jcr/pom.xml                            | 11 -----------
 .../org/apache/camel/component/jcr/JcrConsumer.java     | 12 +++++++-----
 2 files changed, 7 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/ab38c272/components/camel-jcr/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-jcr/pom.xml b/components/camel-jcr/pom.xml
index 58d90f4..18b7b1e 100644
--- a/components/camel-jcr/pom.xml
+++ b/components/camel-jcr/pom.xml
@@ -80,15 +80,4 @@
       <scope>test</scope>
     </dependency>
   </dependencies>
-  <build>
-    <plugins>
-     <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-surefire-plugin</artifactId>
-        <configuration>
-          <forkMode>pertest</forkMode>
-        </configuration>
-     </plugin>
-    </plugins>
-  </build>
 </project>

http://git-wip-us.apache.org/repos/asf/camel/blob/ab38c272/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrConsumer.java b/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrConsumer.java
index c0d8f39..e2c8711 100644
--- a/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrConsumer.java
+++ b/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrConsumer.java
@@ -179,11 +179,13 @@ public class JcrConsumer extends DefaultConsumer implements SuspendableService {
 
             boolean isSessionLive = false;
 
-            if (JcrConsumer.this.session != null) {
-                try {
-                    isSessionLive = JcrConsumer.this.session.isLive();
-                } catch (Exception e) {
-                    LOG.debug("Exception while checking jcr session", e);
+            synchronized (this) {
+                if (JcrConsumer.this.session != null) {
+                    try {
+                        isSessionLive = JcrConsumer.this.session.isLive();
+                    } catch (Exception e) {
+                        LOG.debug("Exception while checking jcr session", e);
+                    }
                 }
             }