Skip to content
Permalink
Browse files
fix JENKINS-9117: Jenkins hangs in the shutdown mode after thinBackup…
… 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 6d363ab67abf2260d8d759d06f690fb564b3e3b9
Showing with 10 additions and 4 deletions.
  1. +10 −4 src/main/java/org/jvnet/hudson/plugins/thinbackup/ThinBackupPeriodicWork.java
@@ -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;
@@ -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();
}
}

0 comments on commit 6d363ab

Please sign in to comment.