oops! forgot the diff.
-- dims
On 6/19/07, Davanum Srinivas <[EMAIL PROTECTED]> wrote:
Jerome,
You are right!
Team,
I am reviewing the code and running the tests, i can see that
org.apache.axis2.deployment.scheduler.Scheduler needs to cancel a
timer. So this means that we have to add cleanup methods in various
layers. Here's a diff that i got working with help from Glen and
Deepal. Unfortunately it means adding a cleanup method in
AxisConfigurator interface. I'll run some more tests before i checkin.
thanks,
dims
On 6/19/07, Jerome Camilleri <[EMAIL PROTECTED]> wrote:
> Davanum Srinivas wrote:
> > Please don't call createConfigurationContextFromFileSystem multiple
> > times. just call once when the daemon starts.
> thanks for this workaround...but don't you think that we should have a
> way to clean up the ressources used by the ConfigurationContext ?
>
> Regards
>
> Jérôme
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--
Davanum Srinivas :: http://davanum.wordpress.com
--
Davanum Srinivas :: http://davanum.wordpress.com
Index: src/org/apache/axis2/deployment/WarBasedAxisConfigurator.java
===
--- src/org/apache/axis2/deployment/WarBasedAxisConfigurator.java (revision 548719)
+++ src/org/apache/axis2/deployment/WarBasedAxisConfigurator.java (working copy)
@@ -144,6 +144,9 @@
}
axisConfig = populateAxisConfiguration(axis2Stream);
+if(axis2Stream != null){
+axis2Stream.close();
+}
Parameter param = new Parameter();
param.setName(Constants.Configuration.ARTIFACTS_TEMP_DIR);
param.setValue(config.getServletContext().getAttribute("javax.servlet.context.tempdir"));
@@ -233,6 +236,7 @@
log.error(ex + ": loading repository from classpath");
loadFromClassPath();
}
+axisConfig.setConfigurator(this);
return axisConfig;
}
Index: src/org/apache/axis2/deployment/DeploymentEngine.java
===
--- src/org/apache/axis2/deployment/DeploymentEngine.java (revision 548719)
+++ src/org/apache/axis2/deployment/DeploymentEngine.java (working copy)
@@ -53,6 +53,7 @@
//to keep the web resource location if any
protected static String webLocationString = null;
+protected Scheduler scheduler;
public static void setWebLocationString(String webLocationString) {
DeploymentEngine.webLocationString = webLocationString;
@@ -598,7 +599,7 @@
* @param listener : RepositoryListener
*/
protected void startSearch(RepositoryListener listener) {
-Scheduler scheduler = new Scheduler();
+scheduler = new Scheduler();
scheduler.schedule(new SchedulerTask(listener), new DeploymentIterator());
}
@@ -1071,4 +1072,13 @@
public Deployer getDeployerForExtension(String extension) {
return (Deployer)extensionToDeployerMappingMap.get(extension);
}
+
+/**
+ * Clean up the mess
+ */
+public void cleanup() {
+if(scheduler != null){
+scheduler.cleanup();
+}
+}
}
Index: src/org/apache/axis2/deployment/FileSystemConfigurator.java
===
--- src/org/apache/axis2/deployment/FileSystemConfigurator.java (revision 548719)
+++ src/org/apache/axis2/deployment/FileSystemConfigurator.java (working copy)
@@ -13,6 +13,7 @@
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
+import java.io.IOException;
/*
* Copyright 2004,2005 The Apache Software Foundation.
@@ -103,7 +104,7 @@
* @throws AxisFault
*/
public synchronized AxisConfiguration getAxisConfiguration() throws AxisFault {
-InputStream configStream;
+InputStream configStream = null;
try {
if (axis2xml != null && !"".equals(axis2xml)) {
configStream = new FileInputStream(axis2xml);
@@ -114,6 +115,14 @@
axisConfig = populateAxisConfiguration(configStream);
} catch (FileNotFoundException e) {
throw new AxisFault("System can not find the given axis2.xml " + axis2xml);
+} finally {
+if(configStream != null) {
+try {
+configStream.close();
+} catch (IOException e) {
+throw AxisFault.makeFault(e);
+}
+}
}
Parameter axis2repoPara = axisConfig.getParameter(DeploymentConstants.AXIS2_REPO);
if (axis2repoPara != null) {
@@ -124,6 +133,7 @@
} else {
loadFromClassPath();
}
+axisConfig.setConfigurator(this);
return axisConfig;
}
Index: src/org/apache/ax