On 22 November 2010 23:42, <[email protected]> wrote:
> 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);
Could be made final?
>
> 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)
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]