jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexparvule...@apache.org
Subject svn commit: r1466850 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/p2/ oak-jcr/src/main/java/...
Date Thu, 11 Apr 2013 12:38:07 GMT
Author: alexparvulescu
Date: Thu Apr 11 12:38:06 2013
New Revision: 1466850

URL: http://svn.apache.org/r1466850
Log:
OAK-763 Asynchronous indexing
 - moved the scheduler to oak-core
 - refactored/cleaned the code indexing a bit

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/Oak.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexConstants.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexHookManagerDiff.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUtils.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/p2/Property2Index.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/p2/Property2IndexHook.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/p2/Property2IndexHookProvider.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/p2/Property2IndexLookup.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/Jcr.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/Oak.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/Oak.java?rev=1466850&r1=1466849&r2=1466850&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/Oak.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/Oak.java Thu Apr
11 12:38:06 2013
@@ -18,6 +18,7 @@ package org.apache.jackrabbit.oak;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.concurrent.ScheduledExecutorService;
 
 import javax.annotation.Nonnull;
 import javax.jcr.NoSuchWorkspaceException;
@@ -57,6 +58,7 @@ import org.apache.jackrabbit.oak.spi.sta
 
 import static com.google.common.base.Preconditions.checkNotNull;
 import static com.google.common.collect.Lists.newArrayList;
+import static java.util.concurrent.Executors.newScheduledThreadPool;
 
 /**
  * Builder class for constructing {@link ContentRepository} instances with
@@ -87,6 +89,8 @@ public class Oak {
 
     private SecurityProvider securityProvider;
 
+    private ScheduledExecutorService executor = newScheduledThreadPool(0);
+
     private String defaultWorkspaceName = DEFAULT_WORKSPACE_NAME;
 
     public Oak(NodeStore store) {
@@ -226,6 +230,17 @@ public class Oak {
         return this;
     }
 
+    @Nonnull
+    public Oak with(@Nonnull ScheduledExecutorService executorService) {
+        this.executor = executorService;
+        return this;
+    }
+
+    @Nonnull
+    public ScheduledExecutorService getExecutorService() {
+        return this.executor;
+    }
+
     public ContentRepository createContentRepository() {
         IndexHookProvider indexHooks = CompositeIndexHookProvider.compose(indexHookProviders);
         OakInitializer.initialize(store, new CompositeInitializer(initializers), indexHooks);

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexConstants.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexConstants.java?rev=1466850&r1=1466849&r2=1466850&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexConstants.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexConstants.java
Thu Apr 11 12:38:06 2013
@@ -31,6 +31,8 @@ public interface IndexConstants {
 
     String REINDEX_PROPERTY_NAME = "reindex";
 
+    String ASYNC_PROPERTY_NAME = "async";
+
     /**
      * Marks a unique property index.
      */

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexHookManagerDiff.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexHookManagerDiff.java?rev=1466850&r1=1466849&r2=1466850&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexHookManagerDiff.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexHookManagerDiff.java
Thu Apr 11 12:38:06 2013
@@ -16,12 +16,12 @@
  */
 package org.apache.jackrabbit.oak.plugins.index;
 
-import static org.apache.jackrabbit.JcrConstants.JCR_PRIMARYTYPE;
+import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.ASYNC_PROPERTY_NAME;
 import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.INDEX_DEFINITIONS_NAME;
-import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.INDEX_DEFINITIONS_NODE_TYPE;
 import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.REINDEX_PROPERTY_NAME;
 import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.TYPE_PROPERTY_NAME;
-import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.TYPE_UNKNOWN;
+import static org.apache.jackrabbit.oak.plugins.index.IndexUtils.getBoolean;
+import static org.apache.jackrabbit.oak.plugins.index.IndexUtils.isIndexNodeType;
 import static org.apache.jackrabbit.oak.plugins.memory.EmptyNodeState.EMPTY_NODE;
 
 import java.util.HashSet;
@@ -65,51 +65,51 @@ class IndexHookManagerDiff implements Ed
     public void enter(NodeState before, NodeState after)
             throws CommitFailedException {
         NodeState ref = node.getNodeState();
-        if (ref.hasChildNode(INDEX_DEFINITIONS_NAME)) {
-            Set<String> existingTypes = new HashSet<String>();
-            Set<String> reindexTypes = new HashSet<String>();
-            NodeState index = ref.getChildNode(INDEX_DEFINITIONS_NAME);
-            for (String indexName : index.getChildNodeNames()) {
-                NodeState indexChild = index.getChildNode(indexName);
-                if (isIndexNodeType(indexChild.getProperty(JCR_PRIMARYTYPE))) {
-                    PropertyState reindexPS = indexChild
-                            .getProperty(REINDEX_PROPERTY_NAME);
-                    boolean reindex = reindexPS == null
-                            || (reindexPS != null && indexChild.getProperty(
-                                    REINDEX_PROPERTY_NAME).getValue(
-                                    Type.BOOLEAN));
-                    String type = TYPE_UNKNOWN;
-                    PropertyState typePS = indexChild
-                            .getProperty(TYPE_PROPERTY_NAME);
-                    if (typePS != null && !typePS.isArray()) {
-                        type = typePS.getValue(Type.STRING);
-                    }
-                    if (reindex) {
-                        reindexTypes.add(type);
-                    }
-                    existingTypes.add(type);
-                }
-            }
-            existingTypes.remove(TYPE_UNKNOWN);
-            reindexTypes.remove(TYPE_UNKNOWN);
+        if (!ref.hasChildNode(INDEX_DEFINITIONS_NAME)) {
+            return;
+        }
 
-            List<IndexHook> hooks = Lists.newArrayList();
-            List<IndexHook> reindex = Lists.newArrayList();
-            for (String type : existingTypes) {
-                List<? extends IndexHook> hooksTmp = provider.getIndexHooks(
-                        type, node);
-                if (reindexTypes.contains(type)) {
-                    reindex.addAll(hooksTmp);
-                } else {
-                    hooks.addAll(hooksTmp);
+        Set<String> allTypes = new HashSet<String>();
+        Set<String> reindexTypes = new HashSet<String>();
+        NodeState index = ref.getChildNode(INDEX_DEFINITIONS_NAME);
+        for (String indexName : index.getChildNodeNames()) {
+            NodeState indexChild = index.getChildNode(indexName);
+            if (isIndexNodeType(indexChild)) {
+                boolean reindex = getBoolean(indexChild, REINDEX_PROPERTY_NAME,
+                        true);
+                boolean async = getBoolean(indexChild, ASYNC_PROPERTY_NAME,
+                        false);
+                String type = null;
+                PropertyState typePS = indexChild
+                        .getProperty(TYPE_PROPERTY_NAME);
+                if (typePS != null && !typePS.isArray()) {
+                    type = typePS.getValue(Type.STRING);
+                }
+                if (type == null || async) {
+                    // skip null & async types
+                    continue;
+                }
+                if (reindex) {
+                    reindexTypes.add(type);
                 }
+                allTypes.add(type);
             }
-            reindex(reindex, ref);
-            if (!hooks.isEmpty()) {
-                this.inner = VisibleEditor.wrap(CompositeEditor.compose(hooks));
-                this.inner.enter(before, after);
+        }
+
+        List<IndexHook> hooks = Lists.newArrayList();
+        List<IndexHook> reindex = Lists.newArrayList();
+        for (String type : allTypes) {
+            if (reindexTypes.contains(type)) {
+                reindex.addAll(provider.getIndexHooks(type, node));
+            } else {
+                hooks.addAll(provider.getIndexHooks(type, node));
             }
         }
+        reindex(reindex, ref);
+        if (!hooks.isEmpty()) {
+            this.inner = VisibleEditor.wrap(CompositeEditor.compose(hooks));
+            this.inner.enter(before, after);
+        }
     }
 
     private void reindex(List<IndexHook> hooks, NodeState state)
@@ -147,11 +147,6 @@ class IndexHookManagerDiff implements Ed
         this.inner.leave(before, after);
     }
 
-    private static boolean isIndexNodeType(PropertyState ps) {
-        return ps != null && !ps.isArray()
-                && ps.getValue(Type.STRING).equals(INDEX_DEFINITIONS_NODE_TYPE);
-    }
-
     @Override
     public void propertyAdded(PropertyState after) throws CommitFailedException {
         inner.propertyAdded(after);

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUtils.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUtils.java?rev=1466850&r1=1466849&r2=1466850&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUtils.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUtils.java
Thu Apr 11 12:38:06 2013
@@ -17,13 +17,14 @@
 package org.apache.jackrabbit.oak.plugins.index;
 
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
 import org.apache.jackrabbit.oak.api.PropertyState;
-import org.apache.jackrabbit.oak.api.Type;
+import org.apache.jackrabbit.oak.plugins.index.p2.Property2IndexHookProvider;
 import org.apache.jackrabbit.oak.plugins.memory.PropertyStates;
 import org.apache.jackrabbit.oak.spi.state.ChildNodeEntry;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
@@ -32,22 +33,33 @@ import org.apache.jackrabbit.oak.util.No
 
 import static org.apache.jackrabbit.JcrConstants.JCR_PRIMARYTYPE;
 import static org.apache.jackrabbit.JcrConstants.NT_UNSTRUCTURED;
+import static org.apache.jackrabbit.oak.api.Type.BOOLEAN;
+import static org.apache.jackrabbit.oak.api.Type.NAME;
 import static org.apache.jackrabbit.oak.api.Type.STRING;
+import static org.apache.jackrabbit.oak.api.Type.STRINGS;
 import static org.apache.jackrabbit.oak.commons.PathUtils.concat;
+import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.DECLARING_NODE_TYPES;
+import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.INDEX_DEFINITIONS_NAME;
+import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.INDEX_DEFINITIONS_NODE_TYPE;
+import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.PROPERTY_NAMES;
+import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.REINDEX_PROPERTY_NAME;
+import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.TYPE_PROPERTY_NAME;
+import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.TYPE_UNKNOWN;
+import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.UNIQUE_PROPERTY_NAME;
 
 /**
  * TODO document
  */
-public class IndexUtils implements IndexConstants {
+public class IndexUtils {
 
     public static NodeBuilder getOrCreateOakIndex(NodeBuilder root) {
         NodeBuilder index;
-        if (!root.hasChildNode(IndexConstants.INDEX_DEFINITIONS_NAME)) {
-            index = root.child(IndexConstants.INDEX_DEFINITIONS_NAME);
+        if (!root.hasChildNode(INDEX_DEFINITIONS_NAME)) {
+            index = root.child(INDEX_DEFINITIONS_NAME);
             // TODO: use property node type name
-            index.setProperty(JCR_PRIMARYTYPE, NT_UNSTRUCTURED, Type.NAME);
+            index.setProperty(JCR_PRIMARYTYPE, NT_UNSTRUCTURED, NAME);
         } else {
-            index = root.child(IndexConstants.INDEX_DEFINITIONS_NAME);
+            index = root.child(INDEX_DEFINITIONS_NAME);
         }
         return index;
     }
@@ -62,23 +74,24 @@ public class IndexUtils implements Index
      *                      uniqueness.
      * @param propertyNames The property names that should be indexed.
      */
-    public static void createIndexDefinition(@Nonnull NodeBuilder index,
+    public static NodeBuilder createIndexDefinition(@Nonnull NodeBuilder index,
                                              @Nonnull String indexDefName,
                                              boolean reindex,
                                              boolean unique,
-                                             @Nonnull List<String> propertyNames,
-                                             @Nullable List<String> declaringNodeTypeNames)
{
+                                             @Nonnull Collection<String> propertyNames,
+                                             @Nullable Collection<String> declaringNodeTypeNames)
{
         NodeBuilder entry = index.child(indexDefName)
-                .setProperty(JCR_PRIMARYTYPE, IndexConstants.INDEX_DEFINITIONS_NODE_TYPE,
Type.NAME)
-                .setProperty(IndexConstants.TYPE_PROPERTY_NAME, "p2")
-                .setProperty(IndexConstants.REINDEX_PROPERTY_NAME, reindex);
+                .setProperty(JCR_PRIMARYTYPE, INDEX_DEFINITIONS_NODE_TYPE, NAME)
+                .setProperty(TYPE_PROPERTY_NAME, Property2IndexHookProvider.TYPE)
+                .setProperty(REINDEX_PROPERTY_NAME, reindex);
         if (unique) {
-            entry.setProperty(IndexConstants.UNIQUE_PROPERTY_NAME, unique);
+            entry.setProperty(UNIQUE_PROPERTY_NAME, unique);
         }
-        entry.setProperty(PropertyStates.createProperty(IndexConstants.PROPERTY_NAMES, propertyNames,
Type.STRINGS));
+        entry.setProperty(PropertyStates.createProperty(PROPERTY_NAMES, propertyNames, STRINGS));
         if (declaringNodeTypeNames != null && !declaringNodeTypeNames.isEmpty())
{
-            entry.setProperty(PropertyStates.createProperty(IndexConstants.DECLARING_NODE_TYPES,
declaringNodeTypeNames, Type.STRINGS));
+            entry.setProperty(PropertyStates.createProperty(DECLARING_NODE_TYPES, declaringNodeTypeNames,
STRINGS));
         }
+        return entry;
     }
 
     /**
@@ -95,16 +108,16 @@ public class IndexUtils implements Index
                                              boolean unique,
                                              @Nonnull String[] propertyNames,
                                              @Nullable String[] declaringNodeTypeNames) {
-        NodeUtil entry = indexNode.getOrAddChild(indexDefName, IndexConstants.INDEX_DEFINITIONS_NODE_TYPE);
-        entry.setString(IndexConstants.TYPE_PROPERTY_NAME, "p2");
-        entry.setBoolean(IndexConstants.REINDEX_PROPERTY_NAME, true);
+        NodeUtil entry = indexNode.getOrAddChild(indexDefName, INDEX_DEFINITIONS_NODE_TYPE);
+        entry.setString(TYPE_PROPERTY_NAME, Property2IndexHookProvider.TYPE);
+        entry.setBoolean(REINDEX_PROPERTY_NAME, true);
         if (unique) {
-            entry.setBoolean(IndexConstants.UNIQUE_PROPERTY_NAME, true);
+            entry.setBoolean(UNIQUE_PROPERTY_NAME, true);
         }
         if (declaringNodeTypeNames != null && declaringNodeTypeNames.length >
0) {
-            entry.setStrings(IndexConstants.DECLARING_NODE_TYPES, declaringNodeTypeNames);
+            entry.setStrings(DECLARING_NODE_TYPES, declaringNodeTypeNames);
         }
-        entry.setStrings(IndexConstants.PROPERTY_NAMES, propertyNames);
+        entry.setStrings(PROPERTY_NAMES, propertyNames);
     }
 
     /**
@@ -152,4 +165,19 @@ public class IndexUtils implements Index
         return new IndexDefinitionImpl(name, type, concat(path, name));
     }
 
+    public static boolean isIndexNodeType(NodeState state) {
+        PropertyState ps = state.getProperty(JCR_PRIMARYTYPE);
+        return ps != null && !ps.isArray()
+                && ps.getValue(STRING).equals(INDEX_DEFINITIONS_NODE_TYPE);
+    }
+
+    public static boolean getBoolean(NodeState state, String property,
+            boolean def) {
+        PropertyState ps = state.getProperty(property);
+        if (ps == null) {
+            return def;
+        }
+        return ps != null && ps.getValue(BOOLEAN);
+    }
+
 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/p2/Property2Index.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/p2/Property2Index.java?rev=1466850&r1=1466849&r2=1466850&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/p2/Property2Index.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/p2/Property2Index.java
Thu Apr 11 12:38:06 2013
@@ -80,8 +80,6 @@ import com.google.common.base.Charsets;
  */
 class Property2Index implements QueryIndex {
 
-    public static final String TYPE = "p2";
-
     // TODO the max string length should be removed, or made configurable
     private static final int MAX_STRING_LENGTH = 100; 
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/p2/Property2IndexHook.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/p2/Property2IndexHook.java?rev=1466850&r1=1466849&r2=1466850&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/p2/Property2IndexHook.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/p2/Property2IndexHook.java
Thu Apr 11 12:38:06 2013
@@ -22,7 +22,7 @@ import static org.apache.jackrabbit.oak.
 import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.INDEX_DEFINITIONS_NAME;
 import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.INDEX_DEFINITIONS_NODE_TYPE;
 import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.TYPE_PROPERTY_NAME;
-import static org.apache.jackrabbit.oak.plugins.index.p2.Property2Index.TYPE;
+import static org.apache.jackrabbit.oak.plugins.index.p2.Property2IndexHookProvider.TYPE;
 import static org.apache.jackrabbit.oak.plugins.memory.EmptyNodeState.EMPTY_NODE;
 
 import java.io.Closeable;

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/p2/Property2IndexHookProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/p2/Property2IndexHookProvider.java?rev=1466850&r1=1466849&r2=1466850&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/p2/Property2IndexHookProvider.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/p2/Property2IndexHookProvider.java
Thu Apr 11 12:38:06 2013
@@ -16,8 +16,6 @@
  */
 package org.apache.jackrabbit.oak.plugins.index.p2;
 
-import static org.apache.jackrabbit.oak.plugins.index.p2.Property2Index.TYPE;
-
 import java.util.List;
 
 import org.apache.felix.scr.annotations.Component;
@@ -39,6 +37,8 @@ import com.google.common.collect.Immutab
 @Service(IndexHookProvider.class)
 public class Property2IndexHookProvider implements IndexHookProvider {
 
+    public static final String TYPE = "p2";
+
     @Override
     public List<? extends IndexHook> getIndexHooks(String type,
             NodeBuilder builder) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/p2/Property2IndexLookup.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/p2/Property2IndexLookup.java?rev=1466850&r1=1466849&r2=1466850&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/p2/Property2IndexLookup.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/p2/Property2IndexLookup.java
Thu Apr 11 12:38:06 2013
@@ -20,6 +20,7 @@ import static org.apache.jackrabbit.oak.
 import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.INDEX_DEFINITIONS_NAME;
 import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.PROPERTY_NAMES;
 import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.TYPE_PROPERTY_NAME;
+import static org.apache.jackrabbit.oak.plugins.index.p2.Property2IndexHookProvider.TYPE;
 
 import java.util.Iterator;
 import java.util.List;
@@ -53,7 +54,7 @@ import org.apache.jackrabbit.oak.spi.sta
  * </pre>
  */
 public class Property2IndexLookup {
-    
+
     private static final int MAX_COST = 100;
 
     private final IndexStoreStrategy store = new ContentMirrorStoreStrategy();
@@ -131,7 +132,7 @@ public class Property2IndexLookup {
         for (ChildNodeEntry entry : state.getChildNodeEntries()) {
             NodeState ns = entry.getNodeState();
             PropertyState type = ns.getProperty(TYPE_PROPERTY_NAME);
-            if (type == null || type.isArray() || !Property2Index.TYPE.equals(type.getValue(Type.STRING)))
{
+            if (type == null || type.isArray() || !TYPE.equals(type.getValue(Type.STRING)))
{
                 continue;
             }
             if (containsValue(ns.getProperty(PROPERTY_NAMES), propertyName)) {

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/Jcr.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/Jcr.java?rev=1466850&r1=1466849&r2=1466850&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/Jcr.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/Jcr.java Thu
Apr 11 12:38:06 2013
@@ -16,7 +16,6 @@
  */
 package org.apache.jackrabbit.oak.jcr;
 
-import java.util.concurrent.Executors;
 import java.util.concurrent.ScheduledExecutorService;
 
 import javax.annotation.Nonnull;
@@ -52,8 +51,6 @@ public class Jcr {
 
     private final Oak oak;
 
-    private ScheduledExecutorService executor = Executors.newScheduledThreadPool(0);
-
     private SecurityProvider securityProvider;
 
     public Jcr(Oak oak) {
@@ -138,13 +135,15 @@ public class Jcr {
 
     @Nonnull
     public final Jcr with(@Nonnull ScheduledExecutorService executor) {
-        this.executor = checkNotNull(executor);
+        oak.with(checkNotNull(executor));
         return this;
     }
 
     public Repository createRepository() {
         return new RepositoryImpl(
-                oak.createContentRepository(), executor, securityProvider);
+                oak.createContentRepository(), 
+                oak.getExecutorService(), 
+                securityProvider);
     }
 
 }



Mime
View raw message