Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@

### API Changes

* ?

* [Fixed Issue 243](https://github.com/jenkinsci/java-client-api/issues/243)

Added new methods to JenkinsServer for stopping and restarting Jenkins. The methods are restart(Boolean crumbFlag), safeRestart(Boolean crumbFlag), exit(Boolean crumbFlag) and safeExit(Boolean crumbFlag)

Thanks for that to [Chids](https://github.com/Chids-gs).

## Release 0.3.7

* Changed Eclipse Formatting configuration.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -917,4 +917,74 @@ private String toViewBaseUrl(FolderJob folder, String name) {
return toBaseUrl(folder) + "view/" + EncodingUtils.encode(name);
}

/**
* Restart Jenkins without waiting for any existing build to complete
*
* @param crumbFlag
* <code>true</code> to add <b>crumbIssuer</b> <code>false</code>
* otherwise.
* @throws IOException
* in case of an error.
*/
public void restart(Boolean crumbFlag) throws IOException {
try {
client.post("/restart", crumbFlag);
} catch (org.apache.http.client.ClientProtocolException e) {
LOGGER.error("restart()", e);
}
}

/**
* safeRestart: Puts Jenkins into the quiet mode, wait for existing builds
* to be completed, and then restart Jenkins
*
* @param crumbFlag
* <code>true</code> to add <b>crumbIssuer</b> <code>false</code>
* otherwise.
* @throws IOException
* in case of an error.
*/
public void safeRestart(Boolean crumbFlag) throws IOException {
try {
client.post("/safeRestart", crumbFlag);
} catch (org.apache.http.client.ClientProtocolException e) {
LOGGER.error("safeRestart()", e);
}
}

/**
* Shutdown Jenkins without waiting for any existing build to complete
*
* @param crumbFlag
* <code>true</code> to add <b>crumbIssuer</b> <code>false</code>
* otherwise.
* @throws IOException
* in case of an error.
*/
//
public void exit(Boolean crumbFlag) throws IOException {
try {
client.post("/exit", crumbFlag);
} catch (org.apache.http.client.ClientProtocolException e) {
LOGGER.error("exit()", e);
}
}

/**
* safeExit: Puts Jenkins into the quiet mode, wait for existing builds to
* be completed, and then shut down Jenkins
*
* @param crumbFlag
* <code>true</code> to add <b>crumbIssuer</b> <code>false</code>
* otherwise.
* @throws IOException
* in case of an error.
*/
public void safeExit(Boolean crumbFlag) throws IOException {
try {
client.post("/safeExit", crumbFlag);
} catch (org.apache.http.client.ClientProtocolException e) {
LOGGER.error("safeExit()", e);
}
}
}