jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1485124 - in /jackrabbit/oak/trunk/oak-lucene/src: main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadWriteOakDirectory.java test/java/org/apache/jackrabbit/oak/jcr/query/MultiSessionQueryTest.java
Date Wed, 22 May 2013 09:02:07 GMT
Author: thomasm
Date: Wed May 22 09:02:06 2013
New Revision: 1485124

URL: http://svn.apache.org/r1485124
Log:
OAK-837 Lucene: colliding concurrency node creation (test case; ignored)

Added:
    jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/jcr/query/MultiSessionQueryTest.java
Modified:
    jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadWriteOakDirectory.java

Modified: jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadWriteOakDirectory.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadWriteOakDirectory.java?rev=1485124&r1=1485123&r2=1485124&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadWriteOakDirectory.java
(original)
+++ jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ReadWriteOakDirectory.java
Wed May 22 09:02:06 2013
@@ -24,7 +24,7 @@ import org.apache.lucene.store.IOContext
 import org.apache.lucene.store.IndexOutput;
 
 /**
- * A red-write implementation of the Lucene {@link Directory} (a flat list of
+ * A read-write implementation of the Lucene {@link Directory} (a flat list of
  * files) that allows to store Lucene index content in an Oak repository.
  */
 public class ReadWriteOakDirectory extends ReadOnlyOakDirectory {

Added: jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/jcr/query/MultiSessionQueryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/jcr/query/MultiSessionQueryTest.java?rev=1485124&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/jcr/query/MultiSessionQueryTest.java
(added)
+++ jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/jcr/query/MultiSessionQueryTest.java
Wed May 22 09:02:06 2013
@@ -0,0 +1,77 @@
+/*
+ * 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.query;
+
+import javax.jcr.Node;
+import javax.jcr.Session;
+import javax.jcr.SimpleCredentials;
+
+import org.apache.jackrabbit.core.query.AbstractQueryTest;
+import org.junit.Ignore;
+
+/**
+ * Tests the Lucene index using multiple threads.
+ */
+public class MultiSessionQueryTest extends AbstractQueryTest {
+
+    final static int THREAD_COUNT = 3;
+
+    @Ignore
+    public void testConcurrent() throws Exception {
+        final Exception[] ex = new Exception[1];
+        Thread[] threads = new Thread[THREAD_COUNT];
+        for (int i = 0; i < THREAD_COUNT; i++) {
+            final Session s = superuser.getRepository().login(
+                    new SimpleCredentials("admin", "admin".toCharArray()));
+            final String node = "node" + i;
+            Thread t = new Thread() {
+                @Override
+                public void run() {
+                    try {
+                        doTest(s, node);
+                    } catch (Exception e) {
+                        ex[0] = e;
+                    }
+                }
+            };
+            threads[i] = t;
+        }
+        for (Thread t : threads) {
+            t.start();
+        }
+        Thread.sleep(100);
+        for (Thread t : threads) {
+            t.join();
+        }
+        if (ex[0] != null) {
+            throw ex[0];
+        }
+    }
+
+    void doTest(Session s, String node) throws Exception {
+        Node root = s.getRootNode();
+        if (!root.hasNode(node)) {
+            root.addNode(node);
+            s.save();
+        }
+        for (int i = 0; i < 10; i++) {
+            // Thread.sleep(100);
+            // System.out.println("session " + node + " work");
+        }
+    }
+
+}



Mime
View raw message