jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From am...@apache.org
Subject svn commit: r1760825 - in /jackrabbit/trunk: jackrabbit-aws-ext/src/main/java/org/apache/jackrabbit/aws/ext/ds/ jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/ jackrabbit-vfs-ext/src/main/java/org/apache/jackrabbit/vfs/ext/ds/
Date Thu, 15 Sep 2016 04:56:01 GMT
Author: amitj
Date: Thu Sep 15 04:56:00 2016
New Revision: 1760825

URL: http://svn.apache.org/viewvc?rev=1760825&view=rev
Log:
JCR-4018: Consistent Async Upload Executor handling in Backend implementations

Slightly modified patch from Woonsan Ko

Added:
    jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/AbstractBackend.java
  (with props)
Modified:
    jackrabbit/trunk/jackrabbit-aws-ext/src/main/java/org/apache/jackrabbit/aws/ext/ds/S3Backend.java
    jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/FSBackend.java
    jackrabbit/trunk/jackrabbit-vfs-ext/src/main/java/org/apache/jackrabbit/vfs/ext/ds/VFSBackend.java

Modified: jackrabbit/trunk/jackrabbit-aws-ext/src/main/java/org/apache/jackrabbit/aws/ext/ds/S3Backend.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-aws-ext/src/main/java/org/apache/jackrabbit/aws/ext/ds/S3Backend.java?rev=1760825&r1=1760824&r2=1760825&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-aws-ext/src/main/java/org/apache/jackrabbit/aws/ext/ds/S3Backend.java
(original)
+++ jackrabbit/trunk/jackrabbit-aws-ext/src/main/java/org/apache/jackrabbit/aws/ext/ds/S3Backend.java
Thu Sep 15 04:56:00 2016
@@ -36,11 +36,11 @@ import java.util.concurrent.TimeUnit;
 import org.apache.jackrabbit.aws.ext.S3Constants;
 import org.apache.jackrabbit.aws.ext.S3RequestDecorator;
 import org.apache.jackrabbit.aws.ext.Utils;
+import org.apache.jackrabbit.core.data.AbstractBackend;
 import org.apache.jackrabbit.core.data.AsyncTouchCallback;
 import org.apache.jackrabbit.core.data.AsyncTouchResult;
 import org.apache.jackrabbit.core.data.AsyncUploadCallback;
 import org.apache.jackrabbit.core.data.AsyncUploadResult;
-import org.apache.jackrabbit.core.data.Backend;
 import org.apache.jackrabbit.core.data.CachingDataStore;
 import org.apache.jackrabbit.core.data.DataIdentifier;
 import org.apache.jackrabbit.core.data.DataStoreException;
@@ -71,7 +71,7 @@ import com.amazonaws.util.StringUtils;
 /**
  * A data store backend that stores data on Amazon S3.
  */
-public class S3Backend implements Backend {
+public class S3Backend extends AbstractBackend {
 
     /**
      * Logger instance.
@@ -86,13 +86,9 @@ public class S3Backend implements Backen
 
     private TransferManager tmx;
 
-    private CachingDataStore store;
-
     private Properties properties;
 
     private Date startTime;
-    
-    private ThreadPoolExecutor asyncWriteExecuter;
 
     private S3RequestDecorator s3ReqDecorator;
 
@@ -103,6 +99,7 @@ public class S3Backend implements Backen
     @Override
     public void init(CachingDataStore store, String homeDir, String config)
             throws DataStoreException {
+        super.init(store, homeDir, config);
         Properties initProps = null;
         //Check is configuration is already provided. That takes precedence
         //over config provided via file based config
@@ -132,7 +129,7 @@ public class S3Backend implements Backen
             Thread.currentThread().setContextClassLoader(
                 getClass().getClassLoader());
             LOG.debug("init");
-            this.store = store;
+            setDataStore(store);
             s3ReqDecorator = new S3RequestDecorator(prop);
 
             s3service = Utils.openService(prop);
@@ -184,9 +181,7 @@ public class S3Backend implements Backen
                 asyncWritePoolSize = Integer.parseInt(maxConnsStr)
                     - writeThreads;
             }
-            
-            asyncWriteExecuter = (ThreadPoolExecutor) Executors.newFixedThreadPool(
-                asyncWritePoolSize, new NamedThreadFactory("s3-write-worker"));
+            setAsyncWritePoolSize(asyncWritePoolSize);
             String renameKeyProp = prop.getProperty(S3Constants.S3_RENAME_KEYS);
             boolean renameKeyBool = (renameKeyProp == null || "".equals(renameKeyProp))
                     ? false
@@ -226,7 +221,7 @@ public class S3Backend implements Backen
             throw new IllegalArgumentException(
                 "callback parameter cannot be null in asyncUpload");
         }
-        asyncWriteExecuter.execute(new AsyncUploadJob(identifier, file,
+        getAsyncWriteExecutor().execute(new AsyncUploadJob(identifier, file,
             callback));
     }
 
@@ -327,7 +322,7 @@ public class S3Backend implements Backen
             Thread.currentThread().setContextClassLoader(
                 getClass().getClassLoader());
 
-            asyncWriteExecuter.execute(new Runnable() {
+            getAsyncWriteExecutor().execute(new Runnable() {
                 @Override
                 public void run() {
                     try {
@@ -537,13 +532,13 @@ public class S3Backend implements Backen
                     long lastModified = s3ObjSumm.getLastModified().getTime();
                     LOG.debug("Identifier [{}]'s lastModified = [{}]", identifier, lastModified);
                     if (lastModified < min
-                        && store.confirmDelete(identifier)
+                        && getDataStore().confirmDelete(identifier)
                          // confirm once more that record's lastModified < min
                         //  order is important here
                         && s3service.getObjectMetadata(bucket,
                             s3ObjSumm.getKey()).getLastModified().getTime() < min) {
                        
-                        store.deleteFromCache(identifier);
+                        getDataStore().deleteFromCache(identifier);
                         LOG.debug("add id [{}] to delete lists",
                             s3ObjSumm.getKey());
                         deleteList.add(new DeleteObjectsRequest.KeyVersion(
@@ -584,9 +579,9 @@ public class S3Backend implements Backen
     }
 
     @Override
-    public void close() {
+    public void close() throws DataStoreException {
+        super.close();
         // backend is closing. abort all mulitpart uploads from start.
-        asyncWriteExecuter.shutdownNow();
         if(s3service.doesBucketExist(bucket)) {
             tmx.abortMultipartUploads(bucket, startTime);
         }

Added: jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/AbstractBackend.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/AbstractBackend.java?rev=1760825&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/AbstractBackend.java
(added)
+++ jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/AbstractBackend.java
Thu Sep 15 04:56:00 2016
@@ -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.core.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.core.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) {
+            ((ExecutorService) asyncExecutor).shutdownNow();
+        }
+    }
+
+    /**
+     * Returns the {@link CachingDataStore} instance using this backend.
+     * @return the {@link CachingDataStore} instance using this backend
+     */
+    protected CachingDataStore getDataStore() {
+        return dataStore;
+    }
+
+    /**
+     * Sets the {@link CachingDataStore} instance using this backend.
+     * @param dataStore the {@link CachingDataStore} instance using this backend
+     */
+    protected void setDataStore(CachingDataStore dataStore) {
+        this.dataStore = dataStore;
+    }
+
+    /**
+     * Returns path of repository home dir.
+     * @return path of repository home dir
+     */
+    protected String getHomeDir() {
+        return homeDir;
+    }
+
+    /**
+     * Sets path of repository home dir.
+     * @param homeDir path of repository home dir
+     */
+    protected void setHomeDir(String homeDir) {
+        this.homeDir = homeDir;
+    }
+
+    /**
+     * Returns path of config property file.
+     * @return path of config property file
+     */
+    protected String getConfig() {
+        return config;
+    }
+
+    /**
+     * Sets path of config property file.
+     * @param config path of config property file
+     */
+    protected void setConfig(String config) {
+        this.config = config;
+    }
+
+    /**
+     * Returns Executor used to execute asynchronous write or touch jobs.
+     * @return Executor used to execute asynchronous write or touch jobs
+     */
+    protected Executor getAsyncWriteExecutor() {
+        Executor executor = asyncWriteExecutor;
+
+        if (executor == null) {
+            synchronized (this) {
+                executor = asyncWriteExecutor;
+                if (executor == null) {
+                    asyncWriteExecutor = executor = createAsyncWriteExecutor();
+                }
+            }
+        }
+
+        return executor;
+    }
+
+    /**
+     * Creates an {@link Executor}.
+     * This method is invoked during the initialization for asynchronous write/touch job
executions.
+     * @return an {@link Executor}
+     */
+    protected Executor createAsyncWriteExecutor() {
+        Executor asyncExecutor;
+
+        if (dataStore.getAsyncUploadLimit() > 0 && getAsyncWritePoolSize() >
0) {
+            asyncExecutor = (ThreadPoolExecutor) Executors.newFixedThreadPool(getAsyncWritePoolSize(),
+                    new NamedThreadFactory(getClass().getSimpleName() + "-write-worker"));
+        } else {
+            asyncExecutor = new ImmediateExecutor();
+        }
+
+        return asyncExecutor;
+    }
+
+    /**
+     * This class implements {@link Executor} interface to run {@code command} right away,
+     * resulting in non-asynchronous mode executions.
+     */
+    private class ImmediateExecutor implements Executor {
+        @Override
+        public void execute(Runnable command) {
+            command.run();
+        }
+    }
+
+}

Propchange: jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/AbstractBackend.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/FSBackend.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/FSBackend.java?rev=1760825&r1=1760824&r2=1760825&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/FSBackend.java
(original)
+++ jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/FSBackend.java
Thu Sep 15 04:56:00 2016
@@ -32,33 +32,20 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Properties;
 import java.util.Set;
-import java.util.concurrent.Executor;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ThreadPoolExecutor;
 
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.IOUtils;
-import org.apache.jackrabbit.core.data.util.NamedThreadFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class FSBackend implements Backend {
+public class FSBackend extends AbstractBackend {
 
     private Properties properties;
 
     private String fsPath;
 
-    private CachingDataStore store;
-
-    private String homeDir;
-
-    private String config;
-
     File fsPathDir;
 
-    private Executor asyncWriteExecuter;
-
     public static final String FS_BACKEND_PATH = "fsBackendPath";
 
     /**
@@ -74,10 +61,10 @@ public class FSBackend implements Backen
     @Override
     public void init(CachingDataStore store, String homeDir, String config)
                     throws DataStoreException {
+        super.init(store, homeDir, config);
         Properties initProps = null;
         // Check is configuration is already provided. That takes precedence
         // over config provided via file based config
-        this.config = config;
         if (this.properties != null) {
             initProps = this.properties;
         } else {
@@ -100,12 +87,12 @@ public class FSBackend implements Backen
 
     public void init(CachingDataStore store, String homeDir, Properties prop)
                     throws DataStoreException {
-        this.store = store;
-        this.homeDir = homeDir;
+        setDataStore(store);
+        setHomeDir(homeDir);
         this.fsPath = prop.getProperty(FS_BACKEND_PATH);
         if (this.fsPath == null || "".equals(this.fsPath)) {
             throw new DataStoreException("Could not initialize FSBackend from "
-                + config + ". [" + FS_BACKEND_PATH + "] property not found.");
+                + getConfig() + ". [" + FS_BACKEND_PATH + "] property not found.");
         }
         fsPathDir = new File(this.fsPath);
         if (fsPathDir.exists() && fsPathDir.isFile()) {
@@ -119,8 +106,6 @@ public class FSBackend implements Backen
                     + fsPathDir.getAbsolutePath());
             }
         }
-        asyncWriteExecuter = createAsyncWriteExecutor();
-
     }
 
     @Override
@@ -191,7 +176,7 @@ public class FSBackend implements Backen
             throw new IllegalArgumentException(
                 "callback parameter cannot be null in asyncUpload");
         }
-        asyncWriteExecuter.execute(new Runnable() {
+        getAsyncWriteExecutor().execute(new Runnable() {
             @Override
             public void run() {
                 try {
@@ -269,7 +254,7 @@ public class FSBackend implements Backen
             Thread.currentThread().setContextClassLoader(
                 getClass().getClassLoader());
 
-            asyncWriteExecuter.execute(new Runnable() {
+            getAsyncWriteExecutor().execute(new Runnable() {
                 @Override
                 public void run() {
                     try {
@@ -292,15 +277,6 @@ public class FSBackend implements Backen
     }
 
     @Override
-    public void close() throws DataStoreException {
-        Executor asyncExecutor = getAsyncWriteExecutor();
-
-        if (asyncExecutor != null && asyncExecutor instanceof ExecutorService) {
-            ((ExecutorService) asyncExecutor).shutdownNow();
-        }
-    }
-
-    @Override
     public Set<DataIdentifier> deleteAllOlderThan(long min)
                     throws DataStoreException {
         Set<DataIdentifier> deleteIdSet = new HashSet<DataIdentifier>(30);
@@ -337,32 +313,6 @@ public class FSBackend implements Backen
     }
 
     /**
-     * Creates a {@link Executor}.
-     * This method is invoked during the initialization for asynchronous write/touch job
executions.
-     * @return a {@link Executor}
-     */
-    protected Executor createAsyncWriteExecutor() {
-        Executor asyncExecutor;
-
-        if (store.getAsyncUploadLimit() > 0) {
-            asyncExecutor = Executors.newFixedThreadPool(10,
-                    new NamedThreadFactory("fs-write-worker"));
-        } else {
-            asyncExecutor = new ImmediateExecutor();
-        }
-
-        return asyncExecutor;
-    }
-
-    /**
-     * Returns ThreadPoolExecutor used to execute asynchronous write or touch jobs.
-     * @return ThreadPoolExecutor used to execute asynchronous write or touch jobs
-     */
-    protected Executor getAsyncWriteExecutor() {
-        return asyncWriteExecuter;
-    }
-
-    /**
      * Returns the identified file. This method implements the pattern used to
      * avoid problems with too many files in a single directory.
      * <p>
@@ -487,8 +437,8 @@ public class FSBackend implements Backen
                 }
                 if (lastModified < min) {
                     DataIdentifier id = new DataIdentifier(file.getName());
-                    if (store.confirmDelete(id)) {
-                        store.deleteFromCache(id);
+                    if (getDataStore().confirmDelete(id)) {
+                        getDataStore().deleteFromCache(id);
                         if (LOG.isInfoEnabled()) {
                             LOG.info("Deleting old file "
                                 + file.getAbsolutePath() + " modified: "
@@ -522,16 +472,4 @@ public class FSBackend implements Backen
             }
         }
     }
-
-    /**
-     * This class implements {@link Executor} interface to run {@code command} right away,
-     * resulting in non-asynchronous mode executions.
-     */
-    private class ImmediateExecutor implements Executor {
-        @Override
-        public void execute(Runnable command) {
-            command.run();
-        }
-    }
-
 }

Modified: jackrabbit/trunk/jackrabbit-vfs-ext/src/main/java/org/apache/jackrabbit/vfs/ext/ds/VFSBackend.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-vfs-ext/src/main/java/org/apache/jackrabbit/vfs/ext/ds/VFSBackend.java?rev=1760825&r1=1760824&r2=1760825&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-vfs-ext/src/main/java/org/apache/jackrabbit/vfs/ext/ds/VFSBackend.java
(original)
+++ jackrabbit/trunk/jackrabbit-vfs-ext/src/main/java/org/apache/jackrabbit/vfs/ext/ds/VFSBackend.java
Thu Sep 15 04:56:00 2016
@@ -28,30 +28,27 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.Set;
 import java.util.concurrent.Executor;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
 import java.util.concurrent.ThreadPoolExecutor;
 
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.vfs2.FileObject;
 import org.apache.commons.vfs2.FileSystemException;
 import org.apache.commons.vfs2.FileType;
+import org.apache.jackrabbit.core.data.AbstractBackend;
 import org.apache.jackrabbit.core.data.AsyncTouchCallback;
 import org.apache.jackrabbit.core.data.AsyncTouchResult;
 import org.apache.jackrabbit.core.data.AsyncUploadCallback;
 import org.apache.jackrabbit.core.data.AsyncUploadResult;
-import org.apache.jackrabbit.core.data.Backend;
 import org.apache.jackrabbit.core.data.CachingDataStore;
 import org.apache.jackrabbit.core.data.DataIdentifier;
 import org.apache.jackrabbit.core.data.DataStoreException;
-import org.apache.jackrabbit.core.data.util.NamedThreadFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
  * A data store backend that stores data on VFS file system.
  */
-public class VFSBackend implements Backend {
+public class VFSBackend extends AbstractBackend {
 
     /**
      * Logger instance.
@@ -79,26 +76,11 @@ public class VFSBackend implements Backe
     private static final String TOUCH_FILE_NAME_SUFFIX = ".touch";
 
     /**
-     * {@link CachingDataStore} instance using this backend.
-     */
-    private CachingDataStore store;
-
-    /**
      * VFS base folder object.
      */
     private FileObject baseFolder;
 
     /**
-     * The pool size of asynchronous write pooling executor.
-     */
-    private int asyncWritePoolSize = DEFAULT_ASYNC_WRITE_POOL_SIZE;
-
-    /**
-     * Asynchronous write pooling executor.
-     */
-    private Executor asyncWriteExecutor;
-
-    /**
      * Whether or not a touch file is preferred to set/get the last modified timestamp for
a file object
      * instead of setting/getting the last modified timestamp directly from the file object.
      */
@@ -109,34 +91,16 @@ public class VFSBackend implements Backe
     }
 
     /**
-     * Returns the pool size of the async write pool executor.
-     * @return the pool size of the async write pool executor
-     */
-    public int getAsyncWritePoolSize() {
-        return asyncWritePoolSize;
-    }
-
-    /**
-     * Sets the pool size of the async 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 store, String homeDir, String config) throws DataStoreException
{
-        this.store = store;
+        super.init(store, homeDir, config);
 
         // When it's local file system, no need to use a separate touch file.
         if ("file".equals(baseFolder.getName().getScheme())) {
             touchFilePreferred = false;
         }
-
-        asyncWriteExecutor = createAsyncWriteExecutor();
     }
 
     /**
@@ -281,18 +245,6 @@ public class VFSBackend implements Backe
      * {@inheritDoc}
      */
     @Override
-    public void close() throws DataStoreException {
-        Executor asyncExecutor = getAsyncWriteExecutor();
-
-        if (asyncExecutor != null && asyncExecutor instanceof ExecutorService) {
-            ((ExecutorService) asyncExecutor).shutdownNow();
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
     public Set<DataIdentifier> deleteAllOlderThan(long timestamp) throws DataStoreException
{
         Set<DataIdentifier> deleteIdSet = new HashSet<DataIdentifier>(30);
 
@@ -456,32 +408,6 @@ public class VFSBackend implements Backe
     }
 
     /**
-     * Creates a {@link ThreadPoolExecutor}.
-     * This method is invoked during the initialization for asynchronous write/touch job
executions.
-     * @return a {@link ThreadPoolExecutor}
-     */
-    protected Executor createAsyncWriteExecutor() {
-        Executor asyncExecutor;
-
-        if (getAsyncWritePoolSize() > 0) {
-            asyncExecutor = (ThreadPoolExecutor) Executors.newFixedThreadPool(getAsyncWritePoolSize(),
-                    new NamedThreadFactory("vfs-write-worker"));
-        } else {
-            asyncExecutor = new ImmediateExecutor();
-        }
-
-        return asyncExecutor;
-    }
-
-    /**
-     * Returns ThreadPoolExecutor used to execute asynchronous write or touch jobs.
-     * @return ThreadPoolExecutor used to execute asynchronous write or touch jobs
-     */
-    protected Executor getAsyncWriteExecutor() {
-        return asyncWriteExecutor;
-    }
-
-    /**
      * Returns the approximate number of threads that are actively executing asynchronous
writing tasks.
      * @return the approximate number of threads that are actively executing asynchronous
writing tasks
      */
@@ -531,7 +457,6 @@ public class VFSBackend implements Backe
     /**
      * Set the last modified time of a fileObject, if the fileObject is writable.
      * @param fileObject the file object
-     * @param time the new last modified date
      * @throws DataStoreException if the fileObject is writable but modifying the date fails
      */
     private void updateLastModifiedTime(FileObject fileObject) throws DataStoreException
{
@@ -550,7 +475,7 @@ public class VFSBackend implements Backe
 
     /**
      * Get the last modified time of a file object.
-     * @param file the file object
+     * @param fileObject the file object
      * @return the last modified date
      * @throws DataStoreException if reading fails
      */
@@ -777,8 +702,8 @@ public class VFSBackend implements Backe
                 if (lastModified < timestamp) {
                     identifier = new DataIdentifier(fileObject.getName().getBaseName());
 
-                    if (store.confirmDelete(identifier)) {
-                        store.deleteFromCache(identifier);
+                    if (getDataStore().confirmDelete(identifier)) {
+                        getDataStore().deleteFromCache(identifier);
 
                         if (LOG.isInfoEnabled()) {
                             LOG.info("Deleting old file " + fileObject.getName().getFriendlyURI()
+ " modified: "
@@ -797,17 +722,6 @@ public class VFSBackend implements Backe
         }
     }
 
-    /**
-     * This class implements {@link Executor} interface to run {@code command} right away,
-     * resulting in non-asynchronous mode executions.
-     */
-    private class ImmediateExecutor implements Executor {
-        @Override
-        public void execute(Runnable command) {
-            command.run();
-        }
-    }
-
     /**
      * This class implements {@link Runnable} interface to copy {@link File} to VFS file
object asynchronously.
      */



Mime
View raw message