How to deploy an exploded application on JBoss safely ?

Have you ever tried to deploy a large application as exploded directory ? one common issue arises from the fact that if JBoss reads the deployment descriptors before the whole application is deployed. JBoss usually complains that the application was deployed as incomplete application.
This can happen for example if you are transferring the files on a slow network, or if the application is quite big.

One workaround is not to copy files but rather moving

mv mylargeapp.ear $JBOSS_HOME/server/default/deploy

why this should work ? because on most OS mv is treated as an atomic operation, that is, files are made available only when the transfer is completed (like for example when we issue a commit to the database).

I cannot guarantee that this will work on all situations (for example on the HP docs I have read that mv is atomic only within the same filesystem. Across filesystems mv is not atomic.)…however it’s worth a try, isn’t it ??