You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by ch...@apache.org on 2014/04/28 12:42:22 UTC
svn commit: r1590595 - in
/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document:
UnsavedModifications.java util/MapFactory.java
Author: chetanm
Date: Mon Apr 28 10:42:21 2014
New Revision: 1590595
URL: http://svn.apache.org/r1590595
Log:
OAK-1772 - Expose an extension point to move in memory state in UnsavedModification to persisted map
Provided an experimental extension point to provide an alternative map
Added:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/MapFactory.java (with props)
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/UnsavedModifications.java
Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/UnsavedModifications.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/UnsavedModifications.java?rev=1590595&r1=1590594&r2=1590595&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/UnsavedModifications.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/UnsavedModifications.java Mon Apr 28 10:42:21 2014
@@ -21,12 +21,13 @@ import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.locks.Lock;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
+import org.apache.jackrabbit.oak.plugins.document.util.MapFactory;
import org.apache.jackrabbit.oak.plugins.document.util.Utils;
import com.google.common.base.Function;
@@ -48,7 +49,7 @@ class UnsavedModifications {
*/
static final int BACKGROUND_MULTI_UPDATE_LIMIT = 10000;
- private final ConcurrentHashMap<String, Revision> map = new ConcurrentHashMap<String, Revision>();
+ private final ConcurrentMap<String, Revision> map = MapFactory.getInstance().create();
/**
* Puts a revision for the given path. The revision for the given path is
Added: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/MapFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/MapFactory.java?rev=1590595&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/MapFactory.java (added)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/MapFactory.java Mon Apr 28 10:42:21 2014
@@ -0,0 +1,50 @@
+/*
+ * 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.plugins.document.util;
+
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+import org.apache.jackrabbit.oak.plugins.document.Revision;
+
+/**
+ * Experimental extension point for OAK-1772 to try out alternative approaches for persisting in memory state
+ * Not part of API
+ */
+public abstract class MapFactory {
+ private static MapFactory DEFAULT = new MapFactory() {
+ @Override
+ public ConcurrentMap<String, Revision> create() {
+ return new ConcurrentHashMap<String, Revision>();
+ }
+ };
+
+ public abstract ConcurrentMap<String, Revision> create();
+
+ private static MapFactory instance = DEFAULT;
+
+ public static MapFactory getInstance(){
+ return instance;
+ }
+
+ public static void setInstance(MapFactory instance) {
+ MapFactory.instance = instance;
+ }
+}
Propchange: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/MapFactory.java
------------------------------------------------------------------------------
svn:eol-style = native