Index: oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java	(date 1376476420000)
+++ oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java	(date 1376482305000)
@@ -205,13 +205,15 @@
             ContentSession contentSession = contentRepository.login(credentials, workspaceName);
             SessionContext context = createSessionContext(
                     Collections.<String, Object>singletonMap(REFRESH_INTERVAL, refreshInterval),
-                    new SessionDelegate(contentSession, securityProvider, refreshInterval));
+                    createSessionDelegate(contentSession, securityProvider, refreshInterval));
             return context.getSession();
         } catch (LoginException e) {
             throw new javax.jcr.LoginException(e.getMessage(), e);
         }
     }
 
+
+
     @Override
     public void shutdown() {
         // empty
@@ -229,6 +231,18 @@
     protected SessionContext createSessionContext(
             Map<String, Object> attributes, SessionDelegate delegate) {
         return new SessionContext(this, whiteboard, attributes, delegate);
+    }
+
+    /**
+     * Factory method for creating a {@link SessionDelegate} instance for
+     * a new session. Called by {@link #login()}. Can be overridden by
+     * subclasses to customize the SessionDelegate implementation.
+     *
+     * @return session context
+     */
+    protected SessionDelegate createSessionDelegate(ContentSession contentSession, SecurityProvider securityProvider,
+                                                  Long refreshInterval) {
+        return new SessionDelegate(contentSession,securityProvider,refreshInterval);
     }
 
     SecurityProvider getSecurityProvider() {
\ No newline at end of file
Index: oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/SessionDelegate.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/SessionDelegate.java	(date 1376476420000)
+++ oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/SessionDelegate.java	(date 1376482305000)
@@ -59,6 +59,7 @@
     private final IdentifierManager idManager;
     private final Exception initStackTrace;
     private final PermissionProvider permissionProvider;
+    private final SessionOperationInterceptor interceptor;
 
     private boolean isAlive = true;
     private int sessionOpCount;
@@ -68,6 +69,12 @@
     private boolean warnIfIdle = true;
     private boolean refreshAtNextAccess = false;
 
+
+    public SessionDelegate(@Nonnull ContentSession contentSession, SecurityProvider securityProvider,
+                           long refreshInterval) {
+        this(contentSession, securityProvider, SessionOperationInterceptor.NOOP,refreshInterval);
+    }
+
     /**
      * Create a new session delegate for a {@code ContentSession}. The refresh behaviour of the
      * session is governed by the value of the {@code refreshInterval} argument: if the session
@@ -80,8 +87,10 @@
      * @param securityProvider the security provider
      * @param refreshInterval  refresh interval in seconds.
      */
-    public SessionDelegate(@Nonnull ContentSession contentSession, SecurityProvider securityProvider, long refreshInterval) {
+    public SessionDelegate(@Nonnull ContentSession contentSession, SecurityProvider securityProvider,
+                           SessionOperationInterceptor interceptor,long refreshInterval) {
         this.contentSession = checkNotNull(contentSession);
+        this.interceptor = checkNotNull(interceptor);
         this.refreshInterval = MILLISECONDS.convert(refreshInterval, SECONDS);
         this.root = contentSession.getLatestRoot();
         this.idManager = new IdentifierManager(root);
@@ -109,6 +118,8 @@
      */
     public synchronized <T> T perform(SessionOperation<T> sessionOperation)
             throws RepositoryException {
+
+        interceptor.before(this,sessionOperation);
         // Synchronize to avoid conflicting refreshes from concurrent JCR API calls
         if (sessionOpCount == 0) {
             // Refresh and checks only for non re-entrant session operations
@@ -142,6 +153,7 @@
             if (sessionOperation.isUpdate()) {
                 updateCount++;
             }
+            interceptor.after(this,sessionOperation);
         }
     }
 
Index: oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/SessionOperationInterceptor.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/SessionOperationInterceptor.java	(date 1376482305000)
+++ oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/SessionOperationInterceptor.java	(date 1376482305000)
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.jackrabbit.oak.jcr.delegate;
+
+import org.apache.jackrabbit.oak.jcr.operation.SessionOperation;
+
+public interface SessionOperationInterceptor {
+    SessionOperationInterceptor NOOP = new SessionOperationInterceptor() {
+        @Override
+        public void before(SessionDelegate delegate, SessionOperation operation) {
+        }
+
+        @Override
+        public void after(SessionDelegate delegate, SessionOperation operation) {
+        }
+    };
+
+    /**
+     * Invoked before the sessionOperation is performed. SessionOperation MUST only be
+     * used for reading purpose and implementation must not invoke the {@link SessionOperation#perform}
+     *
+     * @param delegate sessionDelegate performing the operation
+     * @param operation operation to perform
+     */
+    void before(SessionDelegate delegate, SessionOperation operation);
+
+    /**
+     * Invoked after the sessionOperation is performed. SessionOperation MUST only be
+     * used for reading purpose and implementation must not invoke the {@link SessionOperation#perform}
+     *
+     * @param delegate sessionDelegate performing the operation
+     * @param operation operation to perform
+     */
+    void after(SessionDelegate delegate, SessionOperation operation);
+}
