-
Bug
-
Resolution: Done
-
Minor
-
1.4.0.Final
-
None
We sometimes see a timing issue with undeploy which looks like it has already been addressed if isDeployTypeXml==true but most of our tests use the dropin deploy method. I mirrored the code over with:
public void undeploy(final Archive<?> archive) throws DeploymentException {
if (log.isLoggable(Level.FINER))
String archiveName = archive.getName();
String deployName = createDeploymentName(archiveName);
String deployDir = null;
// IBM expedient patch for FAT test problems this was just done to prevent it
// having to be added to each arquillian.xml it would not be part of the PR
containerConfiguration.setFailSafeUndeployment(true);
try {
// If deploy type is xml, then remove the application from the xml file, which
// causes undeploy
if (containerConfiguration.isDeployTypeXML())
// Now we can proceed and delete the archive for either deploy type
if (containerConfiguration.isDeployTypeXML())
else
{ deployDir = getDropInDirectory(); } // Remove the deployed archive
File exportedArchiveLocation = new File(deployDir, archiveName);
if (!containerConfiguration.isFailSafeUndeployment()) {
try {
if (!Files.deleteIfExists(exportedArchiveLocation.toPath()))
} catch (IOException e)
{ throw new DeploymentException("Unable to delete archive from deployment directory", e); } } else {
try
catch (IOException e)
{ log.log(Level.WARNING, "Unable to delete archive from deployment directory -> failsafe -> file marked for delete on exit", e); exportedArchiveLocation.deleteOnExit(); }}
// If it was the archive deletion that caused the undeploy we wait for the
// correct state
if (!containerConfiguration.isDeployTypeXML())
} catch (Exception e)
{ throw new DeploymentException("Exception while undeploying application.", e); }if (log.isLoggable(Level.FINER))
{ log.exiting(className, "undeploy"); }}
I will now do a PR with the above (minus the containerConfiguration.setFailSafeUndeployment(true);
line.)