Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 74744 invoked from network); 4 Jan 2007 22:15:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Jan 2007 22:15:43 -0000 Received: (qmail 72484 invoked by uid 500); 4 Jan 2007 22:15:48 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 72361 invoked by uid 500); 4 Jan 2007 22:15:48 -0000 Mailing-List: contact axis-cvs-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-cvs@ws.apache.org Received: (qmail 72350 invoked by uid 500); 4 Jan 2007 22:15:48 -0000 Delivered-To: apmail-ws-axis2-cvs@ws.apache.org Received: (qmail 72347 invoked by uid 99); 4 Jan 2007 22:15:48 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Jan 2007 14:15:48 -0800 X-ASF-Spam-Status: No, hits=-8.6 required=10.0 tests=ALL_TRUSTED,INFO_TLD,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Jan 2007 14:15:40 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id 6C2391A981A; Thu, 4 Jan 2007 14:14:43 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r492778 - in /webservices/axis2/trunk/java/modules: codegen/test/org/apache/axis2/wsdl/ integration/test/org/apache/axis2/engine/ integration/test/org/apache/axis2/integration/ kernel/src/org/apache/axis2/client/ kernel/src/org/apache/axis2... Date: Thu, 04 Jan 2007 22:14:43 -0000 To: axis2-cvs@ws.apache.org From: nagy@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070104221443.6C2391A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: nagy Date: Thu Jan 4 14:14:42 2007 New Revision: 492778 URL: http://svn.apache.org/viewvc?view=rev&rev=492778 Log: Moved shutdown code from ListenerManager to ConfigurationContext, since that is where much of the initialization happens (e.g. module initialization,) and made sure that everything will be shut down properly when the JVM terminates -- this is important especially with respect to JAX-WS, as it does not provide a way for a client to signal that it is done with the runtime. Modified: webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/wsdl/WSDLServiceBuilderTest.java webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/EchoRawXMLMultipleTest.java webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/integration/UtilServer.java webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/integration/UtilsTCPServer.java webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/ServiceClient.java webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ConfigurationContext.java webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/ListenerManager.java webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/description/WSDLToAllServicesBuilderTest.java webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/UtilServer.java Modified: webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/wsdl/WSDLServiceBuilderTest.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/wsdl/WSDLServiceBuilderTest.java?view=diff&rev=492778&r1=492777&r2=492778 ============================================================================== --- webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/wsdl/WSDLServiceBuilderTest.java (original) +++ webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/wsdl/WSDLServiceBuilderTest.java Thu Jan 4 14:14:42 2007 @@ -43,7 +43,7 @@ } protected void tearDown() throws AxisFault { - lm.stop(); + configContext.terminate(); } public void testWSDLClient() throws Exception { Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/EchoRawXMLMultipleTest.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/EchoRawXMLMultipleTest.java?view=diff&rev=492778&r1=492777&r2=492778 ============================================================================== --- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/EchoRawXMLMultipleTest.java (original) +++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/EchoRawXMLMultipleTest.java Thu Jan 4 14:14:42 2007 @@ -117,7 +117,7 @@ } } sender.cleanup(); - configContext.getListenerManager().stop(); + configContext.terminate(); log.info("send the request"); } @@ -167,7 +167,7 @@ } } sender.cleanup(); - configContext.getListenerManager().stop(); + configContext.terminate(); log.info("send the request"); } @@ -185,7 +185,7 @@ TestingUtils.campareWithCreatedOMElement(result); } sender.cleanup(); - configContext.getListenerManager().stop(); + configContext.terminate(); } public void testEchoXMLMultipleDuelSync() throws Exception { @@ -209,7 +209,7 @@ TestingUtils.campareWithCreatedOMElement(result); } sender.cleanup(); - configContext.getListenerManager().stop(); + configContext.terminate(); } Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/integration/UtilServer.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/integration/UtilServer.java?view=diff&rev=492778&r1=492777&r2=492778 ============================================================================== --- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/integration/UtilServer.java (original) +++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/integration/UtilServer.java Thu Jan 4 14:14:42 2007 @@ -164,11 +164,7 @@ } else { count--; } - ListenerManager listenerManager = - receiver.getConfigurationContext().getListenerManager(); - if (listenerManager != null) { - listenerManager.stop(); - } + receiver.getConfigurationContext().terminate(); } public static ConfigurationContext getConfigurationContext() { Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/integration/UtilsTCPServer.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/integration/UtilsTCPServer.java?view=diff&rev=492778&r1=492777&r2=492778 ============================================================================== --- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/integration/UtilsTCPServer.java (original) +++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/integration/UtilsTCPServer.java Thu Jan 4 14:14:42 2007 @@ -93,11 +93,7 @@ } catch (AxisFault e) { log.error(e.getMessage(), e); } - ListenerManager listenerManager = - receiver.getConfigurationContext().getListenerManager(); - if (listenerManager != null) { - listenerManager.stop(); - } + receiver.getConfigurationContext().terminate(); } } Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/ServiceClient.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/ServiceClient.java?view=diff&rev=492778&r1=492777&r2=492778 ============================================================================== --- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/ServiceClient.java (original) +++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/ServiceClient.java Thu Jan 4 14:14:42 2007 @@ -830,8 +830,7 @@ axisConfiguration.removeServiceGroup(serviceGroupName); } } else { - //Stopping listeners if you start any - configContext.getListenerManager().stop(); + configContext.terminate(); } } } Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ConfigurationContext.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ConfigurationContext.java?view=diff&rev=492778&r1=492777&r2=492778 ============================================================================== --- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ConfigurationContext.java (original) +++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ConfigurationContext.java Thu Jan 4 14:14:42 2007 @@ -19,13 +19,18 @@ import org.apache.axis2.AxisFault; import org.apache.axis2.Constants; +import org.apache.axis2.description.AxisModule; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.AxisServiceGroup; import org.apache.axis2.description.Parameter; +import org.apache.axis2.description.TransportOutDescription; import org.apache.axis2.engine.AxisConfiguration; import org.apache.axis2.engine.DependencyManager; import org.apache.axis2.engine.ListenerManager; +import org.apache.axis2.engine.ServiceLifeCycle; import org.apache.axis2.i18n.Messages; +import org.apache.axis2.modules.Module; +import org.apache.axis2.transport.TransportSender; import org.apache.axis2.transport.http.HTTPConstants; import org.apache.axis2.util.SessionUtils; import org.apache.axiom.om.util.UUIDGenerator; @@ -66,10 +71,14 @@ private String cachedServicePath = null; + private Thread cleanupThread; + public ConfigurationContext(AxisConfiguration axisConfiguration) { super(null); this.axisConfiguration = axisConfiguration; initConfigContextTimeout(axisConfiguration); + cleanupThread = new CleanupThread(this); + Runtime.getRuntime().addShutdownHook(cleanupThread); } private void initConfigContextTimeout(AxisConfiguration axisConfiguration) { @@ -363,7 +372,7 @@ } } - public void cleanupContexts() { + private void cleanupContexts() { if (applicationSessionServiceGroupContextTable.size() > 0) { Iterator applicationScopeSgs = applicationSessionServiceGroupContextTable.values().iterator(); @@ -383,6 +392,60 @@ } } + public void terminate() + throws AxisFault + { + Runtime.getRuntime().removeShutdownHook(cleanupThread); + performCleanup(); + } + + private void performCleanup() + throws AxisFault + { + if (listenerManager != null) + { + listenerManager.stop(); + } + + /*Stop the transport senders*/ + HashMap transportOut = getAxisConfiguration().getTransportsOut(); + if (transportOut.size() > 0) { + Iterator trsItr = transportOut.values().iterator(); + while (trsItr.hasNext()) { + TransportOutDescription outDescription = (TransportOutDescription) trsItr.next(); + TransportSender trsSededer = outDescription.getSender(); + if (trsSededer != null) { + trsSededer.stop(); + } + } + } + + /*Shut down the modules*/ + HashMap modules = getAxisConfiguration().getModules(); + if (modules != null) { + Iterator moduleitr = modules.values().iterator(); + while (moduleitr.hasNext()) { + AxisModule axisModule = (AxisModule) moduleitr.next(); + Module module = axisModule.getModule(); + if (module != null) { + module.shutdown(this); + } + } + } + + cleanupContexts(); + + /*Shut down the services*/ + Iterator services = getAxisConfiguration().getServices().values().iterator(); + while (services.hasNext()) { + AxisService axisService = (AxisService) services.next(); + ServiceLifeCycle serviceLifeCycle = axisService.getServiceLifeCycle(); + if (serviceLifeCycle != null) { + serviceLifeCycle.shutDown(this, axisService); + } + } + } + public String getServiceContextPath() { if(cachedServicePath == null){ cachedServicePath = internalGetServiceContextPath(); @@ -461,5 +524,27 @@ serviceGroupContextTimoutInterval = serviceGroupContextTimoutIntervalParam.intValue(); } return serviceGroupContextTimoutInterval; + } + + class CleanupThread extends Thread + { + ConfigurationContext configContext; + + public CleanupThread(ConfigurationContext configContext) + { + this.configContext = configContext; + } + + public void run() + { + try + { + configContext.performCleanup(); + } + catch (AxisFault e) + { + e.printStackTrace(); + } + } } } Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/ListenerManager.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/ListenerManager.java?view=diff&rev=492778&r1=492777&r2=492778 ============================================================================== --- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/ListenerManager.java (original) +++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/ListenerManager.java Thu Jan 4 14:14:42 2007 @@ -150,32 +150,6 @@ transportListener.stop(); } - // Stoping Transport senders - HashMap transportOut = configctx.getAxisConfiguration().getTransportsOut(); - if (transportOut.size() > 0) { - Iterator trsItr = transportOut.values().iterator(); - while (trsItr.hasNext()) { - TransportOutDescription outDescription = (TransportOutDescription) trsItr.next(); - TransportSender trsSededer = outDescription.getSender(); - if (trsSededer != null) { - trsSededer.stop(); - } - } - } - //calling module shoutdown method - HashMap modules = configctx.getAxisConfiguration().getModules(); - if (modules != null) { - Iterator moduleitr = modules.values().iterator(); - while (moduleitr.hasNext()) { - AxisModule axisModule = (AxisModule) moduleitr.next(); - Module module = axisModule.getModule(); - if (module != null) { - module.shutdown(configctx); - } - } - } - configctx.cleanupContexts(); - shutDownServices(configctx); stopped = true; } @@ -204,16 +178,4 @@ public boolean isStopped() { return stopped; } - - private void shutDownServices(ConfigurationContext configCtx) { - Iterator services = configCtx.getAxisConfiguration().getServices().values().iterator(); - while (services.hasNext()) { - AxisService axisService = (AxisService) services.next(); - ServiceLifeCycle serviceLifeCycle = axisService.getServiceLifeCycle(); - if (serviceLifeCycle != null) { - serviceLifeCycle.shutDown(configCtx, axisService); - } - } - } - } Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java?view=diff&rev=492778&r1=492777&r2=492778 ============================================================================== --- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java (original) +++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java Thu Jan 4 14:14:42 2007 @@ -118,7 +118,7 @@ super.destroy(); //stoping listner manager try { - configContext.getListenerManager().stop(); + configContext.terminate(); } catch (AxisFault axisFault) { log.info(axisFault.getMessage()); } Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/description/WSDLToAllServicesBuilderTest.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/description/WSDLToAllServicesBuilderTest.java?view=diff&rev=492778&r1=492777&r2=492778 ============================================================================== --- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/description/WSDLToAllServicesBuilderTest.java (original) +++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/description/WSDLToAllServicesBuilderTest.java Thu Jan 4 14:14:42 2007 @@ -60,7 +60,7 @@ } protected void tearDown() throws AxisFault { - lm.stop(); + configContext.terminate(); } private void checkResults(List axisServices, String expectedService[]) { Modified: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/UtilServer.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/UtilServer.java?view=diff&rev=492778&r1=492777&r2=492778 ============================================================================== --- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/UtilServer.java (original) +++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/integration/UtilServer.java Thu Jan 4 14:14:42 2007 @@ -105,10 +105,7 @@ } else { count--; } - ListenerManager listenerManager = receiver.getConfigurationContext().getListenerManager(); - if (listenerManager != null) { - listenerManager.stop(); - } + receiver.getConfigurationContext().terminate(); } public static ConfigurationContext getConfigurationContext() { --------------------------------------------------------------------- To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org For additional commands, e-mail: axis-cvs-help@ws.apache.org