commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgo...@apache.org
Subject svn commit: r1037943 - /commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/AbstractFileSystem.java
Date Mon, 22 Nov 2010 23:42:12 GMT
Author: rgoers
Date: Mon Nov 22 23:42:12 2010
New Revision: 1037943

URL: http://svn.apache.org/viewvc?rev=1037943&view=rev
Log:
Convert useCount to AtomicLong

Modified:
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/AbstractFileSystem.java

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/AbstractFileSystem.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/AbstractFileSystem.java?rev=1037943&r1=1037942&r2=1037943&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/AbstractFileSystem.java
(original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/AbstractFileSystem.java
Mon Nov 22 23:42:12 2010
@@ -47,6 +47,7 @@ import java.util.HashSet;
 import java.util.Map;
 import java.lang.reflect.InvocationTargetException;
 import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
 
 /**
  * A partial {@link org.apache.commons.vfs2.FileSystem} implementation.
@@ -94,7 +95,7 @@ public abstract class AbstractFileSystem
     /**
      * How many fileObjects are handed out
      */
-    private long useCount;
+    private AtomicLong useCount = new AtomicLong(0);
 
 
     private FileSystemKey cacheKey;
@@ -570,7 +571,7 @@ public abstract class AbstractFileSystem
      */
     public boolean isReleaseable()
     {
-        return useCount < 1;
+        return useCount.get() < 1;
     }
 
     void freeResources()
@@ -628,12 +629,12 @@ public abstract class AbstractFileSystem
 
     void fileObjectHanded(FileObject fileObject)
     {
-        useCount++;
+        useCount.incrementAndGet();
     }
 
     void fileObjectDestroyed(FileObject fileObject)
     {
-        useCount--;
+        useCount.decrementAndGet();
     }
 
     void setCacheKey(FileSystemKey cacheKey)



Mime
View raw message