简体   繁体   English

如何在JBoss AS下加快应用程序的取消部署

[英]How can I speed-up the application undeployment under JBoss AS

Under JBoss SOA 5.3.0.GA (a flavor of JBoss AS), I have an EAR with several WARs. 在JBoss SOA 5.3.0.GA(一种JBoss AS风格)下,我有一个带有多个WAR的EAR。 When the EAR is undeployed, each WAR takes about 5 seconds to be undeployed. 取消部署EAR时,每个WAR大约需要5秒钟才能取消部署。

This is due to CatalinaEventHandler.stopContext(Context) , where aa five second sleep is done: 这是由于CatalinaEventHandler.stopContext(Context) ,其中完成了五秒钟的睡眠:

273   public void stopContext(Context context)
274   {
275      this.checkInit();
276
277      if (!this.exclude(context))
278      {
279         log.debug(this.sm.getString("modcluster.context.stop", context.getPath(), context.getParent().getName()));
280
281         // Send STOP-APP
282         MCMPRequest request = this.requestFactory.createStopRequest(context);
283    
284         this.mcmpHandler.sendRequest(request);
285         Thread thr = Thread.currentThread();
286         try {
287            thr.sleep(5000); // Time for requests being processed.
288         } catch(Exception ex) {
289         }
290      }
291   }

Is there a way to speed-up the web applications undeployment ? 有没有一种方法可以加快Web应用程序的取消部署?

Based on the CatalinaEventHandler.stopContext(Context) source code, there is no easy way to speedup the web application shutdown. 基于CatalinaEventHandler.stopContext(Context)源代码,没有简单的方法可以加快Web应用程序的关闭速度。

However, I used a workaround: I replaced the 5000 constant value (line 287) by a value from the system properties, compiled and repackaged the jboss-as/server/myServer/deploy/mod-cluster.sar/mod-cluster-1.0.10.GA_CP02.jar (and removed the signing information from the JAR in MANIFEST.MF and other .SF file): 但是,我使用了一种解决方法:我用系统属性中的值替换了5000常数(第287行),编译并重新打包了jboss-as/server/myServer/deploy/mod-cluster.sar/mod-cluster-1.0.10.GA_CP02.jar (并从MANIFEST.MF和其他.SF文件中的JAR中删除了签名信息):

// get the timeout
long timeout = 5000; // the default timeout
String propName = "org.jboss.modcluster.CatalinaEventHandler.stopContext.timeout";
String timeoutStr = System.getProperty(propName);
if (timeoutStr!=null) {
    try {
        timeout = Long.parseLong(timeoutStr);
    } catch (NumberFormatException e) {
        log.warn("could not parse "+propName+" : "+e.toString());
    }
}

// wait for requests being processed
try {
   thr.sleep(timeout);
} catch(Exception ex) {
}

Then I start the server using -Dorg.jboss.modcluster.CatalinaEventHandler.stopContext.timeout=50 and my web applications do their shutdown very fast since the wait period is only 50 ms. 然后,我使用-Dorg.jboss.modcluster.CatalinaEventHandler.stopContext.timeout=50启动服务器,并且我的Web应用程序非常快速地关闭服务器,因为等待时间仅为50 ms。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM