User: salborini
Date: 00/08/14 22:04:30
Modified: src/main/org/jboss/ejb ContainerFactory.java
Log:
Fixed hot-redeploy bug. It had already been fixed by rickard but the new metadata
package did not include the fix.
Revision Changes Path
1.29 +21 -1 jboss/src/main/org/jboss/ejb/ContainerFactory.java
Index: ContainerFactory.java
===================================================================
RCS file: /products/cvs/ejboss/jboss/src/main/org/jboss/ejb/ContainerFactory.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- ContainerFactory.java 2000/08/12 00:40:44 1.28
+++ ContainerFactory.java 2000/08/15 05:04:30 1.29
@@ -13,6 +13,8 @@
import java.net.MalformedURLException;
import java.io.File;
import java.io.InputStream;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
import java.io.IOException;
import java.rmi.RemoteException;
import java.rmi.ServerException;
@@ -66,8 +68,9 @@
* @author Rickard �berg ([EMAIL PROTECTED])
* @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Juha Lindfors</a>
+* @author <a href="mailto:[EMAIL PROTECTED]">Sebastien Alborini</a>
*
-* @version $Revision: 1.28 $
+* @version $Revision: 1.29 $
*/
public class ContainerFactory
extends org.jboss.util.ServiceMBeanSupport
@@ -230,6 +233,23 @@
log.log("Deploying:"+url);
+
+ // copy the jar file to prevent locking - redeploy failure
+ if (url.getProtocol().startsWith("file")) {
+ File jarFile = new File(url.getFile());
+ File tmp = File.createTempFile("tmpejbjar",".jar");
+ tmp.deleteOnExit();
+ FileInputStream fin = new FileInputStream(jarFile);
+ byte[] bytes = new byte[(int)jarFile.length()];
+ fin.read(bytes);
+ FileOutputStream fout = new FileOutputStream(tmp);
+ fout.write(bytes);
+ fin.close();
+ fout.close();
+ url = tmp.toURL();
+ }
+
+
// Create the ClassLoader for this application
// TODO : the ClassLoader should come from the JMX manager if
we want to be able to share it (tomcat)
ClassLoader cl = new URLClassLoader(new URL[] { url },
Thread.currentThread().getContextClassLoader());