My applications consists of set of war-files. One of components has a scheduled task wcich depends on some other war. So I want to specify deployment order of these components. I deploy my application by placing all the wars in glassfish autodeploy folder in some remote production servers, so I can't use domain.xml to configure deployment order. And I want to specify war-file deployment order in descriptor, something like glassfish-web.xml. But I can't find that parameter in any of them. Is it possible to do?
1 Answers
As far as i know you can not specify a deployment order for multiple war files in the autodeploy directory.
The reason is that the glassfish AutoDeployDirectoryScanner scans the directory via File.listfiles() and as the javadoc of File states:
There is no guarantee that the name strings in the resulting array will appear in any specific order
The glassfish autodeployer creates an empty file with .war_deployed suffix.
Example: For yourfile.war the autodeployer creates a yourfile.war_deployed file. The original war file will still be in the directory.
My suggestion:
You can check for the existence of a .war_deployed file and trigger the copy process of the next war file.
You migth run a script/cronjob which copies the files in the desired order one after one to the autodeploy directory if the previous war was deployed succesfully.