SLIDER-1198 container.state is set to STATE_LIVE for containers belonging to apps which have been killed
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
index 8e45fe4..c6f99c6 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/SliderAppMaster.java
@@ -1606,7 +1606,7 @@
     launchService.stop();
 
     //now release all containers
-    releaseAllContainers();
+    releaseAllContainers(finalMessage);
 
     // When the application completes, it should send a finish application
     // signal to the RM
@@ -1980,7 +1980,7 @@
   /**
    * Shutdown operation: release all containers
    */
-  private void releaseAllContainers() {
+  private void releaseAllContainers(String releaseMessage) {
     if (providerService instanceof AgentProviderService) {
       log.info("Setting stopInitiated flag to true");
       AgentProviderService agentProviderService = (AgentProviderService) providerService;
@@ -1996,7 +1996,8 @@
     } catch (InterruptedException e) {
       log.info("Sleep for container release interrupted");
     } finally {
-      List<AbstractRMOperation> operations = appState.releaseAllContainers();
+      List<AbstractRMOperation> operations = appState
+          .releaseAllContainers(releaseMessage);
       providerRMOperationHandler.execute(operations);
       // now apply the operations
       execute(operations);
diff --git a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppState.java b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppState.java
index 0ca9f78..766db30 100644
--- a/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppState.java
+++ b/slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppState.java
@@ -2341,7 +2341,8 @@
    * Release all containers.
    * @return a list of operations to execute
    */
-  public synchronized List<AbstractRMOperation> releaseAllContainers() {
+  public synchronized List<AbstractRMOperation> releaseAllContainers(
+      String releaseMessage) {
 
     Collection<RoleInstance> targets = cloneOwnedContainerList();
     log.info("Releasing {} containers", targets.size());
@@ -2357,11 +2358,14 @@
       if (!instance.released) {
         String url = getLogsURLForContainer(possible);
         // Add the completed container log link (overwrites log link for live
-        // container)
+        // container). Mark container stopped as well.
         ContainerInformation ci = getApplicationDiagnostics()
             .getContainer(id.toString());
         if (ci != null) {
           ci.logLink = url;
+          ci.state = StateValues.STATE_STOPPED;
+          ci.exitCode = ContainerExitStatus.SUCCESS;
+          ci.diagnostics = releaseMessage;
         }
         log.info("Releasing container. Log: " + url);
         try {