tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <>
Subject Re: Parallel Deployment
Date Wed, 03 Aug 2011 17:20:01 GMT
On 03/08/2011 16:11, Adrian Stabiszewski wrote:
> Hi!
> I find the new Tomcat 7 feature "Parallel Deployment" very interesting.
> Unfortunately IMHO it is more complicated than it could be.
> As I understand it, you have to add the version number after two hashes
> (##). The version will then be compared as a String.
> This scheme doesn't fit with my versioning system which uses Maven as build
> system which uses a hyphen as version separator. 
> Is there some Interface in Tomcat I could implement to integrate my version
> scheme? Some ContextVersionComparator?

Do you want to change the ## separator or just how the comparison is
done? The first is very unlikely to happen. There aren't that many
characters that can be used safely.

The second might be possible but not per web application as the version
determination happens much earlier in the process.

> The second issue is about the ROOT or default context. AFAIK right now it is
> not possible to deploy a WAR file with an arbitrary file name as the ROOT
> context. Yes, I know you can create a ROOT.xml in conf/[Engine]/[Host] and
> point to your WAR file via docBase, but this not practical if the WAR file
> contains a version number.
> And for the parallel deployment feature I would have to create a new
> ROOT##<version>.xml for each version. I think this extra work is not
> necessary. 
> For an ideal world I have two proposals ;)
> 1. Allow setting the context name in the META-INF/context.xml of the WAR
> file. 
> Something like
> <Context path=""></Context>
> (which is forbidden atm) would deploy the WAR as a ROOT context. 

Very unlikely to change due to the complications it causes with
automated deployment. Come up with a solution that allows this without
breaking auto-deployment or making the code horribly complex then things
get rather more likely.

> Of course, if more than one WAR file wants to use the same context name the
> deployment should fail.
> This would allow to deploy the following files as ROOT context with
> different versions:
> myproject##001.war
> myproject##002.war
> 2. Allow setting a WAR base in the conf/[Engine]/[Host]/<contextname>.xml
> file. This is a different approach. This would allow to have one
> <contextname>.xml for all versions. 
> The WAR base attribute would simply point to the directory and the base name
> of the war file. In the example about this would simply be "myproject":
> <Context warBase="/warfiles/myproject"></Context>
> Tomcat could search all WAR files in the "warfiles" folder starting with
> "myproject" and ending with ".war".

That might work. I can't see any obvious pitfalls at this point. It
would need to support WARs as well as directories (if you can support
one, supporting the other shouldn't be too hard).

> I think the smoothest solution would be if I could take the build artifact
> from maven release plugin and copy it directly into the deployment directory
> ;) And to add some sugar on top, tomcat would even delete the old versions
> of the deployments once no sessions are connected with them.

That should be do-able. The behaviour would (obviously) need to be

> Is this something that would be possible for tomcat?


> How can I help?

Write some patches that implement these features. I'd suggest starting
with the auto-undeploy of old versions as I think it is less
controversial. Setting up a build environment for Tomcat trunk should be
fairly simple. Just ask questions here if you get stuck.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message