tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sl...@apache.org
Subject svn commit: r686185 - in /tuscany/java/sca/modules: extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ClasspathServiceDiscoverer.java extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/ResourceHelper.java
Date Fri, 15 Aug 2008 09:43:19 GMT
Author: slaws
Date: Fri Aug 15 02:43:16 2008
New Revision: 686185

URL: http://svn.apache.org/viewvc?rev=686185&view=rev
Log:
TUSCANY-2539 Turn of jar caching for URLconnection and port service discovery over to use
URLConnetion to open streams. Prevents Tuscany from holding the stream open for Jar contributions

Modified:
    tuscany/java/sca/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ClasspathServiceDiscoverer.java
    tuscany/java/sca/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/ResourceHelper.java

Modified: tuscany/java/sca/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ClasspathServiceDiscoverer.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ClasspathServiceDiscoverer.java?rev=686185&r1=686184&r2=686185&view=diff
==============================================================================
--- tuscany/java/sca/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ClasspathServiceDiscoverer.java
(original)
+++ tuscany/java/sca/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ClasspathServiceDiscoverer.java
Fri Aug 15 02:43:16 2008
@@ -25,6 +25,7 @@
 import java.io.InputStreamReader;
 import java.lang.ref.WeakReference;
 import java.net.URL;
+import java.net.URLConnection;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.security.PrivilegedActionException;
@@ -199,6 +200,13 @@
                 try {
                     is = AccessController.doPrivileged(new PrivilegedExceptionAction<InputStream>()
{
                         public InputStream run() throws IOException {
+                            URLConnection connection = url.openConnection();
+                            // TUSCANY-2539
+                            // Don't cache connections by default to stop Tuscany locking
contribution jar files
+                            // done here as this is one of the first places we open a stream
and the only way to 
+                            // set the default is to set it on an instance of URLConnection
+                            connection.setDefaultUseCaches(false);                      
     
+                            connection.setUseCaches(false);
                             return url.openStream();
                         }
                     });

Modified: tuscany/java/sca/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/ResourceHelper.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/ResourceHelper.java?rev=686185&r1=686184&r2=686185&view=diff
==============================================================================
--- tuscany/java/sca/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/ResourceHelper.java
(original)
+++ tuscany/java/sca/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/ResourceHelper.java
Fri Aug 15 02:43:16 2008
@@ -24,6 +24,7 @@
 import java.io.InputStreamReader;
 import java.io.Reader;
 import java.net.URL;
+import java.net.URLConnection;
 
 /**
  * TODO: Shouldn't this be using the contribution service?
@@ -36,7 +37,9 @@
         
         InputStream is;
         try {
-            is = scriptSrcUrl.openStream();
+            URLConnection connection = scriptSrcUrl.openConnection();                   
   
+            connection.setUseCaches(false);
+            is = connection.getInputStream();
         } catch (IOException e) {
             throw new RuntimeException(e);
         }



Mime
View raw message