reschke commented on code in PR #2810:
URL: https://github.com/apache/jackrabbit-oak/pull/2810#discussion_r3008562501


##########
oak-blob/src/main/java/org/apache/jackrabbit/oak/spi/blob/data/AbstractBackend.java:
##########
@@ -0,0 +1,191 @@
+/*
+ * 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.spi.blob.data;
+
+import java.util.concurrent.Executor;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ThreadPoolExecutor;
+
+import org.apache.jackrabbit.oak.spi.blob.data.util.NamedThreadFactory;
+
+/**
+ * Abstract Backend which has a reference to the underlying {@link 
CachingDataStore} and is
+ * maintaining the lifecycle of the internal asynchronous write executor.
+ */
+public abstract class AbstractBackend implements Backend {
+
+    /**
+     * {@link CachingDataStore} instance using this backend.
+     */
+    private CachingDataStore dataStore;
+
+    /**
+     * path of repository home dir.
+     */
+    private String homeDir;
+
+    /**
+     * path of config property file.
+     */
+    private String config;
+
+    /**
+     * The pool size of asynchronous write pooling executor.
+     */
+    private int asyncWritePoolSize = 10;
+
+    /**
+     * Asynchronous write pooling executor.
+     */
+    private volatile Executor asyncWriteExecutor;
+
+    /**
+     * Returns the pool size of the asynchronous write pool executor.
+     * @return the pool size of the asynchronous write pool executor
+     */
+    public int getAsyncWritePoolSize() {
+        return asyncWritePoolSize;
+    }
+
+    /**
+     * Sets the pool size of the asynchronous write pool executor.
+     * @param asyncWritePoolSize pool size of the async write pool executor
+     */
+    public void setAsyncWritePoolSize(int asyncWritePoolSize) {
+        this.asyncWritePoolSize = asyncWritePoolSize;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void init(CachingDataStore dataStore, String homeDir, String 
config) throws DataStoreException {
+        this.dataStore = dataStore;
+        this.homeDir = homeDir;
+        this.config = config;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void close() throws DataStoreException {
+        Executor asyncExecutor = getAsyncWriteExecutor();
+
+        if (asyncExecutor != null && asyncExecutor instanceof ExecutorService) 
{

Review Comment:
   see above; the idea was not to touch the existing code yet: it would make 
tracking down errors later on harder.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to