Author: julien(a)jboss.com
Date: 2007-06-03 15:40:18 -0400 (Sun, 03 Jun 2007)
New Revision: 7378
Modified:
trunk/common/src/main/org/jboss/portal/common/util/URLStreamOpeningThread.java
Log:
thread safe
Modified: trunk/common/src/main/org/jboss/portal/common/util/URLStreamOpeningThread.java
===================================================================
---
trunk/common/src/main/org/jboss/portal/common/util/URLStreamOpeningThread.java 2007-06-03
19:34:48 UTC (rev 7377)
+++
trunk/common/src/main/org/jboss/portal/common/util/URLStreamOpeningThread.java 2007-06-03
19:40:18 UTC (rev 7378)
@@ -22,7 +22,6 @@
package org.jboss.portal.common.util;
-
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
@@ -37,30 +36,38 @@
*/
public class URLStreamOpeningThread extends Thread
{
- volatile private URL url;
- /** */
- private InputStream inputStream;
+ /** . */
+ private final URL url;
+ /** . */
+ private volatile InputStream inputStream;
+
/** Exception in the event a connection error occurs */
- private IOException exception = null;
+ private volatile IOException exception;
public URLStreamOpeningThread(URL url)
{
ParameterValidation.throwIllegalArgExceptionIfNull(url, "URL");
+ //
this.url = url;
+ this.inputStream = null;
+ this.exception = null;
}
public void run()
{
try
{
- inputStream = url.openStream();
- if (inputStream == null)
+ InputStream in = url.openStream();
+ if (in == null)
{
throw new IllegalArgumentException("Cannot open stream from [" +
url + "]");
}
+
+ //
+ inputStream = in;
}
catch (IOException e)
{