[Deployers on JBoss (Deployers/JBoss)] - Re: Ordering of .ear subdeployments
by vickyk
anonymous wrote :
| Instead, add a .sar to your ear that instantiates an mbean that introduces a small delay in its startService() method, to get your delay. Then make the .sar to be the last module in application.xml (by default it should be deployed first, I guess, so the test should fail), then compare the dates and expect this to be the last deployment.
|
Oops if I understood this clearly what you are trying to say is that the entire testing should be concluded based on the result that the SAR should be deployed last .
It makes a sense to me , but I was thinking of a way to get the a proper ordering as i could get by introcuing some delay or by System.nanoTime() usage .
Anyway I think I will continue with this .
Well I dont think I need to create a seperate EAR , I will use the \unpacked-ear2.ear from the testsuite which I have been doing during executing the test suites till now .
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3961822#3961822
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3961822
18 years, 5 months
[Deployers on JBoss (Deployers/JBoss)] - Re: Ordering of .ear subdeployments
by vickyk
anonymous wrote :
| E.g. I have the feeling if you do a listDeployed() on the MainDeployer you get back the list of deployments in the order they are actually deployed. So iterate those and see if you get what you'd expect.
|
After looking at the code I could see the following code sippet in the init of the MainDeployer
| if (!inLocalCopyDir(deployment.url) && deploymentList.contains(deployment) == false)
| {
| deploymentList.add(deployment);
| log.debug("Watching new file: " + deployment.url);
| }
|
The deploymentList contains the entries which will be rendered by the listDeployed() , this does not give the proper information if the deployments are packaged.
So the alternative to get the actual deployment ordering would be based on the lastDeployed field of the DeploymentInfo . This seems to be working appropriately .
The only concern in this case is that the precision is lost as the the lastDeployed field could be same for some of the sub-deployments. Actually this is because the System.currentTimeMillis() is not enough for this purpose .
We can either think of using the System.nanoTime() in the MainDeployer but by doing this we will loose the backward compartability , as this method has been a part of the jdk1.5 .
What i did to make the UnitTest give me the accurate results was to include the following code snippet
| deployment.lastModified=lastModified;
| //Introduced for Testing JBAS-2904
| try{
| Thread.sleep(1);
| }
| catch(InterruptedException ex){
| }
| //introduced for Testing JBAS-2904
| deployment.lastDeployed=System.currentTimeMillis();
|
This gives the proper lastDeployed precision .
Since this code won't be called so frequently , thus will not result in the performance hit . This gives the appropriate deployment ordering .
Are there any other ways we can get the actual Deployment Ordering ?
Regards
Vicky
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3961761#3961761
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3961761
18 years, 5 months