Prevent server startup if rollbacks cause patch entry recording to fail

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@21897 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2010-08-20 11:39:41 +00:00
parent a0e426f85c
commit a11e5505ca
2 changed files with 5 additions and 6 deletions

View File

@@ -409,7 +409,6 @@ public abstract class AbstractPatch implements Patch, ApplicationEventPublisher
{
public String execute() throws Exception
{
// downgrade integrity checking
IntegrityChecker.setWarnInTransaction();

View File

@@ -80,20 +80,20 @@ public class PatchExecuter extends AbstractLifecycleBean
logger.info(I18NUtil.getMessage(MSG_CHECKING));
Date before = new Date(System.currentTimeMillis() - 60000L); // 60 seconds ago
patchService.applyOutstandingPatches();
boolean applySucceeded = patchService.applyOutstandingPatches();
Date after = new Date(System .currentTimeMillis() + 20000L); // 20 seconds ahead
// get all the patches executed in the time
List<AppliedPatch> appliedPatches = patchService.getPatches(before, after);
// don't report anything if nothing was done
if (appliedPatches.size() == 0)
if (applySucceeded && appliedPatches.size() == 0)
{
logger.info(I18NUtil.getMessage(MSG_NO_PATCHES_REQUIRED));
}
else
{
boolean succeeded = true;
boolean allPassed = true;
// list all patches applied, including failures
for (AppliedPatch patchInfo : appliedPatches)
{
@@ -108,12 +108,12 @@ public class PatchExecuter extends AbstractLifecycleBean
}
else
{
succeeded = false;
allPassed = false;
logger.error(I18NUtil.getMessage(MSG_FAILED, patchInfo.getId(), patchInfo.getReport()));
}
}
// generate an error if there was a failure
if (!succeeded)
if (!allPassed || !applySucceeded)
{
throw new AlfrescoRuntimeException("Not all patches could be applied");
}