jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1584077 - /jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/CompatibilityIssuesTest.java
Date Wed, 02 Apr 2014 16:08:03 GMT
Author: mduerig
Date: Wed Apr  2 16:08:02 2014
New Revision: 1584077

URL: http://svn.apache.org/r1584077
Log:
OAK-26: MVCC causes write skew
Cleanup

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/CompatibilityIssuesTest.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/CompatibilityIssuesTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/CompatibilityIssuesTest.java?rev=1584077&r1=1584076&r2=1584077&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/CompatibilityIssuesTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/CompatibilityIssuesTest.java
Wed Apr  2 16:08:02 2014
@@ -107,7 +107,7 @@ public class CompatibilityIssuesTest ext
         // same thread session refreshing doesn't come into the way
         final Session session0 = createAdminSession();
         try {
-            FutureTask<Void> t0 = new FutureTask<Void>(new Callable<Void>()
{
+            run(new Callable<Void>() {
                 @Override
                 public Void call() throws Exception {
                     Node testNode = session0.getNode("/").addNode("testNode");
@@ -118,8 +118,6 @@ public class CompatibilityIssuesTest ext
                     return null;
                 }
             });
-            new Thread(t0).start();
-            t0.get();
         } finally {
             session0.logout();
         }
@@ -127,7 +125,7 @@ public class CompatibilityIssuesTest ext
         final Session session1 = createAdminSession();
         final Session session2 = createAdminSession();
         try {
-            FutureTask<Void> t1 = new FutureTask<Void>(new Callable<Void>()
{
+            run(new Callable<Void>() {
                 @Override
                 public Void call() throws Exception {
                     session1.getNode("/testNode").setProperty("p1", -1);
@@ -136,10 +134,8 @@ public class CompatibilityIssuesTest ext
                     return null;
                 }
             });
-            new Thread(t1).start();
-            t1.get();
 
-            FutureTask<Void> t2 = new FutureTask<Void>(new Callable<Void>()
{
+            run(new Callable<Void>() {
                 @Override
                 public Void call() throws Exception {
                     session2.getNode("/testNode").setProperty("p2", -1);
@@ -148,9 +144,6 @@ public class CompatibilityIssuesTest ext
                     return null;
                 }
             });
-            new Thread(t2).start();
-            t2.get();
-
         } finally {
             session1.logout();
             session2.logout();
@@ -167,6 +160,12 @@ public class CompatibilityIssuesTest ext
         }
     }
 
+    private static void run(Callable<Void> callable) throws InterruptedException, ExecutionException
{
+        FutureTask<Void> task = new FutureTask<Void>(callable);
+        new Thread(task).start();
+        task.get();
+    }
+
     private static void check(Session session) throws RepositoryException {
         if (session.getNode("/testNode").getProperty("p1").getLong() +
                 session.getNode("/testNode").getProperty("p2").getLong() < 0) {



Mime
View raw message