[jboss-cvs] JBossAS SVN: r104602 - projects/vfs/trunk/src/main/java/org/jboss/vfs/util.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon May 10 05:57:37 EDT 2010
Author: alesj
Date: 2010-05-10 05:57:36 -0400 (Mon, 10 May 2010)
New Revision: 104602
Modified:
projects/vfs/trunk/src/main/java/org/jboss/vfs/util/LazyInputStream.java
Log:
Do nothing on close if there was no demand for the stream.
Modified: projects/vfs/trunk/src/main/java/org/jboss/vfs/util/LazyInputStream.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/vfs/util/LazyInputStream.java 2010-05-10 08:06:49 UTC (rev 104601)
+++ projects/vfs/trunk/src/main/java/org/jboss/vfs/util/LazyInputStream.java 2010-05-10 09:57:36 UTC (rev 104602)
@@ -33,6 +33,9 @@
* Delaying opening stream from underlying virtual file as long as possible.
* Won't be opened if not used at all.
*
+ * Synchronization is very simplistic, as it's highly unlikely
+ * there will be a lot of concurrent requests.
+ *
* @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
*/
public class LazyInputStream extends InputStream
@@ -91,9 +94,13 @@
}
@Override
- public void close() throws IOException
+ public synchronized void close() throws IOException
{
+ if (stream == null)
+ return;
+
openStream().close();
+ stream = null; // reset the stream
}
@Override
More information about the jboss-cvs-commits
mailing list