Skip to content

Commit

Permalink
fix JENKINS-9117: Jenkins hangs in the shutdown mode after thinBackup…
Browse files Browse the repository at this point in the history
… is triggered

git-svn-id: https://svn.jenkins-ci.org/trunk/hudson/plugins/thinBackup@39091 71c3de6d-444a-0410-be80-ed276b4c234a
  • Loading branch information
tofuatjava committed Mar 21, 2011
1 parent 7555e9c commit 6d363ab
Showing 1 changed file with 10 additions and 4 deletions.
Expand Up @@ -69,8 +69,10 @@ protected void execute(final TaskListener arg0) throws IOException, InterruptedE
}

protected void backupNow(final BackupType type) {
final Hudson hudson = Hudson.getInstance();
String backupPath = null;
try {
final String backupPath = plugin.getBackupPath();
backupPath = plugin.getBackupPath();
final boolean cleanupDiff = plugin.isCleanupDiff();
final String noMaxStoredFull = plugin.getNrMaxStoredFull();
int maxStoredFull;
Expand All @@ -85,18 +87,22 @@ protected void backupNow(final BackupType type) {
}

if (!StringUtils.isEmpty(backupPath)) {
final Hudson hudson = Hudson.getInstance();
hudson.doQuietDown();
LOGGER.fine("Wait until executors are idle to perform backup.");
Utils.waitUntilIdle();
new HudsonBackup(new File(backupPath), Hudson.getInstance().getRootDir(), type, maxStoredFull, cleanupDiff,
plugin.isMoveOldBackupsToZipFile()).backup();
hudson.doCancelQuietDown();
} else {
LOGGER.warning("ThinBackup is not configured yet: No backup path set.");
}
} catch (final IOException e) {
LOGGER.log(Level.SEVERE, e.getMessage(), e);
String msg = MessageFormat
.format(
"Cannot perform a backup. Please be sure jenkins/hudson has write privileges in the configured backup path '{0}'.",
backupPath);
LOGGER.log(Level.SEVERE, msg, e);
} finally {
hudson.doCancelQuietDown();
}
}

Expand Down

0 comments on commit 6d363ab

Please sign in to comment.