int i = 0;
try
{
while (i < theDeployers.size())
{
Deployer deployer = theDeployers.get(i);
if (deployer.isParentFirst())
doInstallParentFirst(deployer, deploymentContext);
else
doInstallParentLast(deployer, deploymentContext);
++i;
}
}
catch (Throwable t)
{
deploymentContext.setState(DeploymentState.ERROR);
deploymentContext.setProblem(t);
// Unwind the previous deployments
for (int j = i - 1; j >= 0; --j)
{
Deployer deployer = theDeployers.get(j);
if (deployer.isParentFirst())
doUninstallParentLast(deployer, deploymentContext, true, true);
else
doUninstallParentFirst(deployer, deploymentContext, true, true);
}