diff --git a/ReleaseNotes.md b/ReleaseNotes.md
index 39db74ac..89335b2f 100644
--- a/ReleaseNotes.md
+++ b/ReleaseNotes.md
@@ -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.
diff --git a/jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java b/jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java
index 4b8cce3b..0cc5eb0f 100644
--- a/jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java
+++ b/jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java
@@ -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
+ * true
to add crumbIssuer false
+ * 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
+ * true
to add crumbIssuer false
+ * 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
+ * true
to add crumbIssuer false
+ * 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
+ * true
to add crumbIssuer false
+ * 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);
+ }
+ }
}