This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-vfs.git

commit d1b7591f6b83ee637208d55efed09fdb8e92ec88
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Tue Feb 2 11:33:44 2021 -0500

    Add and use VFS.close().
---
 .../src/main/java/org/apache/commons/vfs2/VFS.java     | 18 +++++++++++++++---
 src/changes/changes.xml                                |  3 +++
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/VFS.java 
b/commons-vfs2/src/main/java/org/apache/commons/vfs2/VFS.java
index 6cb5698..225169d 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/VFS.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/VFS.java
@@ -31,6 +31,20 @@ public final class VFS {
     private static Boolean uriStyle;
 
     /**
+     * Closes the default {@link FileSystemManager} instance.
+     * <p>
+     * Warning, if you close the default instance, a new one will be created 
by {@link #getManager()}.
+     * </p>
+     *
+     * @since 2.8.0
+     */
+    public static synchronized void close() {
+        if (instance != null) {
+            instance.close();
+        }
+    }
+
+    /**
      * Creates a file system manager instance.
      *
      * @param managerClassName The specific manager impelmentation class name.
@@ -90,9 +104,7 @@ public final class VFS {
      * @since 2.5.0
      */
     public static FileSystemManager reset() throws FileSystemException {
-        if (instance != null) {
-            instance.close();
-        }
+        close();
         return instance = 
createFileSystemManager("org.apache.commons.vfs2.impl.StandardFileSystemManager");
     }
 
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 33699c3..ec1c36d 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -73,6 +73,9 @@ The <action> type attribute can be add,update,fix,remove.
       <action issue="VFS-748" dev="ggregory" due-to="PeterAlfredLee, Gary 
Gregory" type="update">
         TarProvider Incorrectly marks file IMAGINARY after garbage collection 
with WeakRefFilesCache, #97.
       </action>
+      <action dev="ggregory" due-to="Gary Gregory" type="update">
+        Add and use VFS.close().
+      </action>
       <!-- UPDATES -->
       <action dev="ggregory" due-to="PeterAlfredLee" type="update">
         Modify some code use for-each loop and stream API #142.

Reply via email to