jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chet...@apache.org
Subject svn commit: r1513836 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/core/ oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/
Date Wed, 14 Aug 2013 12:23:09 GMT
Author: chetanm
Date: Wed Aug 14 12:23:08 2013
New Revision: 1513836

URL: http://svn.apache.org/r1513836
Log:
 OAK-946 - Improve support for debugging Oak

 Initial implementation using counter based implementation for identifying contentSession
and
 using toString to expose the identifier

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentSessionImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/SessionDelegate.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentSessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentSessionImpl.java?rev=1513836&r1=1513835&r2=1513836&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentSessionImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentSessionImpl.java
Wed Aug 14 12:23:08 2013
@@ -20,6 +20,7 @@ import static com.google.common.base.Pre
 
 import java.io.IOException;
 import java.util.Set;
+import java.util.concurrent.atomic.AtomicLong;
 
 import javax.annotation.Nonnull;
 import javax.security.auth.login.LoginException;
@@ -45,6 +46,11 @@ class ContentSessionImpl implements Cont
 
     private static final Logger log = LoggerFactory.getLogger(ContentSessionImpl.class);
 
+    /**
+     * Session counter. Used to generate unique internal session names.
+     */
+    private static final AtomicLong SESSION_COUNTER = new AtomicLong();
+
     private final LoginContext loginContext;
     private final SecurityProvider securityProvider;
     private final String workspaceName;
@@ -52,6 +58,7 @@ class ContentSessionImpl implements Cont
     private final CommitHook hook;
     private final ChangeDispatcher changeDispatcher;
     private final QueryIndexProvider indexProvider;
+    private final String sessionName;
 
     private volatile boolean live = true;
 
@@ -69,6 +76,7 @@ class ContentSessionImpl implements Cont
         this.hook = hook;
         this.changeDispatcher = changeDispatcher;
         this.indexProvider = indexProvider;
+        this.sessionName = "session-" + SESSION_COUNTER.incrementAndGet();
     }
 
     private void checkLive() {
@@ -127,4 +135,8 @@ class ContentSessionImpl implements Cont
         }
     }
 
+    @Override
+    public String toString() {
+        return sessionName;
+    }
 }

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java?rev=1513836&r1=1513835&r2=1513836&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
Wed Aug 14 12:23:08 2013
@@ -688,4 +688,8 @@ public class SessionImpl implements Jack
         return sessionContext.getUserManager();
     }
 
+    @Override
+    public String toString() {
+        return sd.getContentSession().toString();
+    }
 }
\ No newline at end of file

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/SessionDelegate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/SessionDelegate.java?rev=1513836&r1=1513835&r2=1513836&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/SessionDelegate.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/SessionDelegate.java
Wed Aug 14 12:23:08 2013
@@ -432,7 +432,12 @@ public class SessionDelegate {
         return root;
     }
 
-    //-----------------------------------------------------------< internal >---
+    @Override
+    public String toString() {
+        return contentSession.toString();
+    }
+
+//-----------------------------------------------------------< internal >---
 
     /**
      * Wraps the given {@link CommitFailedException} instance using the



Mime
View raw message