jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r767416 - in /jackrabbit/trunk/jackrabbit-core/src: main/java/org/apache/jackrabbit/core/SessionImpl.java test/java/org/apache/jackrabbit/core/data/GarbageCollectorTest.java
Date Wed, 22 Apr 2009 09:05:22 GMT
Author: thomasm
Date: Wed Apr 22 09:05:22 2009
New Revision: 767416

URL: http://svn.apache.org/viewvc?rev=767416&view=rev
Log:
JCR-2080 DataStore: garbage collection can fail when using workspace maxIdleTime

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/GarbageCollectorTest.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java?rev=767416&r1=767415&r2=767416&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java
Wed Apr 22 09:05:22 2009
@@ -680,11 +680,17 @@
         PersistenceManager pm = vm.getPersistenceManager();
         pmList.add(pm);
         String[] wspNames = rep.getWorkspaceNames();
-        SystemSession[] sysSessions = new SystemSession[wspNames.length];
+        Session[] sessions = new Session[wspNames.length];
         for (int i = 0; i < wspNames.length; i++) {
             String wspName = wspNames[i];
             WorkspaceInfo wspInfo = rep.getWorkspaceInfo(wspName);
-            sysSessions[i] = rep.getSystemSession(wspName);
+            // this will initialize the workspace if required
+            wspInfo.getSystemSession();
+            SessionImpl session = SystemSession.create(rep, wspInfo.getConfig());
+            // mark this session as 'active' so the workspace does not get disposed
+            // by the workspace-janitor until the garbage collector is done
+            rep.onSessionCreated(session);
+            sessions[i] = session;
             pm = wspInfo.getPersistenceManager();
             pmList.add(pm);
         }
@@ -697,7 +703,7 @@
             }
             ipmList[i] = (IterablePersistenceManager) pm;
         }
-        GarbageCollector gc = new GarbageCollector(this, ipmList, sysSessions);
+        GarbageCollector gc = new GarbageCollector(this, ipmList, sessions);
         return gc;
     }
 

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/GarbageCollectorTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/GarbageCollectorTest.java?rev=767416&r1=767415&r2=767416&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/GarbageCollectorTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/GarbageCollectorTest.java
Wed Apr 22 09:05:22 2009
@@ -55,7 +55,7 @@
             public void run() {
                 try {
                     node.setProperty("slowBlob", new InputStream() {
-                        int pos = 0;
+                        int pos;
                         public int read() throws IOException {
                             pos++;
                             if (pos < 10000) {



Mime
View raw message