You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sr...@apache.org on 2014/09/16 00:32:26 UTC

git commit: AMBARI-7299. Slider View: Update slider-core JAR to 0.51.0 version (srimanth)

Repository: ambari
Updated Branches:
  refs/heads/trunk f84ee8dd7 -> 26cd2f4b0


AMBARI-7299. Slider View: Update slider-core JAR to 0.51.0 version (srimanth)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/26cd2f4b
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/26cd2f4b
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/26cd2f4b

Branch: refs/heads/trunk
Commit: 26cd2f4b0f1e7ed23aab9fef3e6365bc4d91094e
Parents: f84ee8d
Author: Srimanth Gunturi <sg...@hortonworks.com>
Authored: Sun Sep 14 17:20:06 2014 -0700
Committer: Srimanth Gunturi <sg...@hortonworks.com>
Committed: Mon Sep 15 15:32:20 2014 -0700

----------------------------------------------------------------------
 .../slider-core/0.41.0/slider-core-0.41.0.jar   | Bin 1125710 -> 0 bytes
 .../slider-core/0.41.0/slider-core-0.41.0.pom   |  25 --
 .../slider-core/0.51.0/slider-core-0.51.0.jar   | Bin 0 -> 1144236 bytes
 .../slider-core/0.51.0/slider-core-0.51.0.pom   |  25 ++
 .../slider/slider-core/maven-metadata-local.xml |   6 +-
 contrib/views/slider/lib/slider-agent.tar.gz    | Bin 0 -> 480985 bytes
 contrib/views/slider/pom.xml                    |   2 +-
 .../view/slider/SliderAppsResourceProvider.java |  15 +-
 .../view/slider/SliderAppsViewController.java   |   9 +-
 .../slider/SliderAppsViewControllerImpl.java    | 324 ++++++++++---------
 .../view/slider/rest/SliderAppsResource.java    |   2 +-
 .../ambari/view/slider/rest/client/Metric.java  |   3 +
 12 files changed, 228 insertions(+), 183 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/26cd2f4b/contrib/views/slider/lib/org/apache/slider/slider-core/0.41.0/slider-core-0.41.0.jar
----------------------------------------------------------------------
diff --git a/contrib/views/slider/lib/org/apache/slider/slider-core/0.41.0/slider-core-0.41.0.jar b/contrib/views/slider/lib/org/apache/slider/slider-core/0.41.0/slider-core-0.41.0.jar
deleted file mode 100644
index a6e9063..0000000
Binary files a/contrib/views/slider/lib/org/apache/slider/slider-core/0.41.0/slider-core-0.41.0.jar and /dev/null differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/26cd2f4b/contrib/views/slider/lib/org/apache/slider/slider-core/0.41.0/slider-core-0.41.0.pom
----------------------------------------------------------------------
diff --git a/contrib/views/slider/lib/org/apache/slider/slider-core/0.41.0/slider-core-0.41.0.pom b/contrib/views/slider/lib/org/apache/slider/slider-core/0.41.0/slider-core-0.41.0.pom
deleted file mode 100644
index bdd574b..0000000
--- a/contrib/views/slider/lib/org/apache/slider/slider-core/0.41.0/slider-core-0.41.0.pom
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-   Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
--->
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>org.apache.slider</groupId>
-  <artifactId>slider-core</artifactId>
-  <version>0.41.0</version>
-  <description>POM was created from install:install-file</description>
-</project>

http://git-wip-us.apache.org/repos/asf/ambari/blob/26cd2f4b/contrib/views/slider/lib/org/apache/slider/slider-core/0.51.0/slider-core-0.51.0.jar
----------------------------------------------------------------------
diff --git a/contrib/views/slider/lib/org/apache/slider/slider-core/0.51.0/slider-core-0.51.0.jar b/contrib/views/slider/lib/org/apache/slider/slider-core/0.51.0/slider-core-0.51.0.jar
new file mode 100644
index 0000000..e7d7665
Binary files /dev/null and b/contrib/views/slider/lib/org/apache/slider/slider-core/0.51.0/slider-core-0.51.0.jar differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/26cd2f4b/contrib/views/slider/lib/org/apache/slider/slider-core/0.51.0/slider-core-0.51.0.pom
----------------------------------------------------------------------
diff --git a/contrib/views/slider/lib/org/apache/slider/slider-core/0.51.0/slider-core-0.51.0.pom b/contrib/views/slider/lib/org/apache/slider/slider-core/0.51.0/slider-core-0.51.0.pom
new file mode 100644
index 0000000..6168fff
--- /dev/null
+++ b/contrib/views/slider/lib/org/apache/slider/slider-core/0.51.0/slider-core-0.51.0.pom
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.slider</groupId>
+  <artifactId>slider-core</artifactId>
+  <version>0.51.0</version>
+  <description>POM was created from install:install-file</description>
+</project>

http://git-wip-us.apache.org/repos/asf/ambari/blob/26cd2f4b/contrib/views/slider/lib/org/apache/slider/slider-core/maven-metadata-local.xml
----------------------------------------------------------------------
diff --git a/contrib/views/slider/lib/org/apache/slider/slider-core/maven-metadata-local.xml b/contrib/views/slider/lib/org/apache/slider/slider-core/maven-metadata-local.xml
index 7240a2e..eaf2be4 100644
--- a/contrib/views/slider/lib/org/apache/slider/slider-core/maven-metadata-local.xml
+++ b/contrib/views/slider/lib/org/apache/slider/slider-core/maven-metadata-local.xml
@@ -19,10 +19,10 @@
   <groupId>org.apache.slider</groupId>
   <artifactId>slider-core</artifactId>
   <versioning>
-    <release>0.41.0</release>
+    <release>0.51.0</release>
     <versions>
-      <version>0.41.0</version>
+      <version>0.51.0</version>
     </versions>
-    <lastUpdated>20140905131533</lastUpdated>
+    <lastUpdated>20140911131533</lastUpdated>
   </versioning>
 </metadata>

http://git-wip-us.apache.org/repos/asf/ambari/blob/26cd2f4b/contrib/views/slider/lib/slider-agent.tar.gz
----------------------------------------------------------------------
diff --git a/contrib/views/slider/lib/slider-agent.tar.gz b/contrib/views/slider/lib/slider-agent.tar.gz
new file mode 100644
index 0000000..d108e4b
Binary files /dev/null and b/contrib/views/slider/lib/slider-agent.tar.gz differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/26cd2f4b/contrib/views/slider/pom.xml
----------------------------------------------------------------------
diff --git a/contrib/views/slider/pom.xml b/contrib/views/slider/pom.xml
index ec4089f..cfb0abc 100644
--- a/contrib/views/slider/pom.xml
+++ b/contrib/views/slider/pom.xml
@@ -403,7 +403,7 @@
 		<zookeeper.version>3.4.5</zookeeper.version>
 		<jetty.version>6.1.26</jetty.version>
 		<metrics.version>3.0.1</metrics.version>
-		<slider.version>0.41.0</slider.version>
+		<slider.version>0.51.0</slider.version>
 	</properties>
 
 	<build>

http://git-wip-us.apache.org/repos/asf/ambari/blob/26cd2f4b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsResourceProvider.java
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsResourceProvider.java b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsResourceProvider.java
index 8d47769..0c0dd12 100644
--- a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsResourceProvider.java
+++ b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsResourceProvider.java
@@ -61,7 +61,10 @@ public class SliderAppsResourceProvider implements ResourceProvider<SliderApp> {
 		} catch (IOException e) {
 			logger.warn("Unable to delete Slider app with id " + resourceId, e);
 			throw new SystemException(e.getMessage(), e);
-		}
+		} catch (InterruptedException e) {
+		    logger.warn("Unable to delete Slider app with id " + resourceId, e);
+            throw new SystemException(e.getMessage(), e);
+        }
 	}
 
 	@Override
@@ -80,7 +83,10 @@ public class SliderAppsResourceProvider implements ResourceProvider<SliderApp> {
 		} catch (IOException e) {
 			logger.warn("Unable to determine Slider app with id " + resourceId, e);
 			throw new SystemException(e.getMessage(), e);
-		}
+		} catch (InterruptedException e) {
+		    logger.warn("Unable to determine Slider app with id " + resourceId, e);
+            throw new SystemException(e.getMessage(), e);
+        }
 	}
 
 	@Override
@@ -99,7 +105,10 @@ public class SliderAppsResourceProvider implements ResourceProvider<SliderApp> {
 		} catch (IOException e) {
 			logger.warn("Unable to determine Slider apps", e);
 			throw new SystemException(e.getMessage(), e);
-		}
+		} catch (InterruptedException e) {
+		    logger.warn("Unable to determine Slider apps", e);
+            throw new SystemException(e.getMessage(), e);
+        }
 		return appSet;
 	}
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/26cd2f4b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewController.java
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewController.java b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewController.java
index 70e333f..93c63f2 100644
--- a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewController.java
+++ b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewController.java
@@ -47,9 +47,10 @@ public interface SliderAppsViewController {
    * @return
    * @throws YarnException
    * @throws IOException
+   * @throws InterruptedException 
    */
   public SliderApp getSliderApp(String applicationId, Set<String> properties)
-      throws YarnException, IOException;
+      throws YarnException, IOException, InterruptedException;
 
   /**
    * Provides list of Slider apps with requested properties populated.
@@ -60,9 +61,10 @@ public interface SliderAppsViewController {
    * @return
    * @throws YarnException
    * @throws IOException
+   * @throws InterruptedException 
    */
   public List<SliderApp> getSliderApps(Set<String> properties)
-      throws YarnException, IOException;
+      throws YarnException, IOException, InterruptedException;
 
   /**
    * Attempts to delete a Slider app. An unsuccessful attempt will result in
@@ -71,9 +73,10 @@ public interface SliderAppsViewController {
    * @param applicationId
    * @throws YarnException
    * @throws IOException
+   * @throws InterruptedException 
    */
   public void deleteSliderApp(String applicationId) throws YarnException,
-      IOException;
+      IOException, InterruptedException;
 
   public SliderAppType getSliderAppType(String appTypeId, Set<String> properties);
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/26cd2f4b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java
index f17b66d..c4871f2 100644
--- a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java
+++ b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java
@@ -59,6 +59,7 @@ import org.apache.slider.common.params.ActionCreateArgs;
 import org.apache.slider.common.params.ActionFreezeArgs;
 import org.apache.slider.common.params.ActionThawArgs;
 import org.apache.slider.common.tools.SliderFileSystem;
+import org.apache.slider.core.exceptions.SliderException;
 import org.apache.slider.core.exceptions.UnknownApplicationInstanceException;
 import org.apache.slider.core.main.LauncherExitCodes;
 import org.apache.slider.providers.agent.application.metadata.Application;
@@ -119,22 +120,45 @@ public class SliderAppsViewControllerImpl implements SliderAppsViewController {
     }
     return null;
   }
-
+  
+  private static interface SliderClientContextRunnable<T> {
+    public T run(SliderClient sliderClient) throws YarnException, IOException, InterruptedException;
+  }
+  
+  private <T> T invokeSliderClientRunnable(final SliderClientContextRunnable<T> runnable) throws IOException, InterruptedException {
+    ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader();
+    Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+    try {
+      T value = UserGroupInformation.getBestUGI(null, "yarn").doAs(
+          new PrivilegedExceptionAction<T>() {
+            @Override
+            public T run() throws Exception {
+              final SliderClient sliderClient = createSliderClient();
+              try{
+                return runnable.run(sliderClient);
+              }finally{
+                destroySliderClient(sliderClient);
+              }
+            }
+          });
+      return value;
+    } finally {
+      Thread.currentThread().setContextClassLoader(currentClassLoader);
+    }
+  }
+  
   @Override
-  public SliderApp getSliderApp(String applicationId, Set<String> properties)
-      throws YarnException, IOException {
-    ApplicationId appId = getApplicationId(applicationId);
+  public SliderApp getSliderApp(String applicationId, final Set<String> properties)
+      throws YarnException, IOException, InterruptedException {
+    final ApplicationId appId = getApplicationId(applicationId);
     if (appId != null) {
-      ClassLoader currentClassLoader = Thread.currentThread()
-          .getContextClassLoader();
-      Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
-      try {
-        SliderClient sliderClient = getSliderClient();
-        ApplicationReport yarnApp = sliderClient.getApplicationReport(appId);
-        return createSliderAppObject(yarnApp, properties, sliderClient);
-      } finally {
-        Thread.currentThread().setContextClassLoader(currentClassLoader);
-      }
+      return invokeSliderClientRunnable(new SliderClientContextRunnable<SliderApp>() {
+        @Override
+        public SliderApp run(SliderClient sliderClient) throws YarnException, IOException {
+          ApplicationReport yarnApp = sliderClient.getApplicationReport(appId);
+          return createSliderAppObject(yarnApp, properties, sliderClient);
+        }
+      });
     }
     return null;
   }
@@ -322,24 +346,29 @@ public class SliderAppsViewControllerImpl implements SliderAppsViewController {
 
   /**
    * Creates a new {@link SliderClient} initialized with appropriate
-   * configuration. If configuration was not determined, <code>null</code> is
-   * returned.
+   * configuration and started. This slider client can be used to invoke
+   * individual API.
    * 
-   * @return
+   * When work with this client is done,
+   * {@link #destroySliderClient(SliderClient)} must be called.
+   * 
+   * @return created {@link SliderClient}
+   * @see #destroySliderClient(SliderClient)
+   * @see #runSliderCommand(String...)
    */
-  protected SliderClient getSliderClient() {
+  protected SliderClient createSliderClient() {
     Configuration sliderClientConfiguration = getSliderClientConfiguration();
-    if (sliderClientConfiguration != null) {
-      SliderClient client = new SliderClient() {
-        @Override
-        public String getUsername() throws IOException {
-          return "yarn";
-        }
+    SliderClient client = new SliderClient() {
+      @Override
+      public String getUsername() throws IOException {
+        return "yarn";
+      }
 
-        @Override
-        protected void serviceInit(Configuration conf) throws Exception {
-          super.serviceInit(conf);
-          // Override the default FS client to set the super user.
+      @Override
+      protected void initHadoopBinding() throws IOException, SliderException {
+        super.initHadoopBinding();
+        // Override the default FS client to the calling user
+        try {
           FileSystem fs = FileSystem.get(FileSystem.getDefaultUri(getConfig()),
               getConfig(), "yarn");
           SliderFileSystem fileSystem = new SliderFileSystem(fs, getConfig());
@@ -347,20 +376,49 @@ public class SliderAppsViewControllerImpl implements SliderAppsViewController {
               .getDeclaredField("sliderFileSystem");
           fsField.setAccessible(true);
           fsField.set(this, fileSystem);
+        } catch (InterruptedException e) {
+          throw new SliderException("Slider view unable to override filesystem of Slider client", e);
+        } catch (NoSuchFieldException e) {
+          throw new SliderException("Slider view unable to override filesystem of Slider client", e);
+        } catch (SecurityException e) {
+          throw new SliderException("Slider view unable to override filesystem of Slider client", e);
+        } catch (IllegalArgumentException e) {
+          throw new SliderException("Slider view unable to override filesystem of Slider client", e);
+        } catch (IllegalAccessException e) {
+          throw new SliderException("Slider view unable to override filesystem of Slider client", e);
+        }
+      }
+
+      @Override
+      public void init(Configuration conf) {
+        super.init(conf);
+        try {
+          initHadoopBinding();
+        } catch (SliderException e) {
+          throw new RuntimeException("Unable to automatically init Hadoop binding", e);
+        } catch (IOException e) {
+          throw new RuntimeException("Unable to automatically init Hadoop binding", e);
         }
-      };
-      try {
-        sliderClientConfiguration = client.bindArgs(sliderClientConfiguration,
-            new String[] { "usage" });
-      } catch (Exception e) {
-        logger.warn("Unable to set SliderClient configs", e);
-        throw new RuntimeException(e.getMessage(), e);
       }
+    };
+    try {
+      sliderClientConfiguration = client.bindArgs(sliderClientConfiguration,
+          new String[] { "usage" });
       client.init(sliderClientConfiguration);
       client.start();
-      return client;
+    } catch (Exception e) {
+      logger.warn("Unable to create SliderClient", e);
+      throw new RuntimeException(e.getMessage(), e);
+    } catch (Throwable e) {
+      logger.warn("Unable to create SliderClient", e);
+      throw new RuntimeException(e.getMessage(), e);
     }
-    return null;
+    return client;
+  }
+
+  protected void destroySliderClient(SliderClient sliderClient) {
+    sliderClient.stop();
+    sliderClient = null;
   }
 
   /**
@@ -389,58 +447,54 @@ public class SliderAppsViewControllerImpl implements SliderAppsViewController {
   }
 
   @Override
-  public List<SliderApp> getSliderApps(Set<String> properties)
-      throws YarnException, IOException {
-    List<SliderApp> sliderApps = new ArrayList<SliderApp>();
-    ClassLoader currentClassLoader = Thread.currentThread()
-        .getContextClassLoader();
-    Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
-    try {
-      Map<String, SliderApp> sliderAppsMap = new HashMap<String, SliderApp>();
-      SliderClient sliderClient = getSliderClient();
-      List<ApplicationReport> yarnApps = sliderClient.listSliderInstances(null);
-      for (ApplicationReport yarnApp : yarnApps) {
-        SliderApp sliderAppObject = createSliderAppObject(yarnApp, properties,
-            sliderClient);
-        if (sliderAppObject != null) {
-          if (sliderAppsMap.containsKey(sliderAppObject.getName())) {
-            if (sliderAppsMap.get(sliderAppObject.getName()).getId()
-                .compareTo(sliderAppObject.getId()) < 0) {
+  public List<SliderApp> getSliderApps(final Set<String> properties)
+      throws YarnException, IOException, InterruptedException {
+    return invokeSliderClientRunnable(new SliderClientContextRunnable<List<SliderApp>>() {
+      @Override
+      public List<SliderApp> run(SliderClient sliderClient)
+          throws YarnException, IOException {
+        List<SliderApp> sliderApps = new ArrayList<SliderApp>();
+        Map<String, SliderApp> sliderAppsMap = new HashMap<String, SliderApp>();
+        List<ApplicationReport> yarnApps = sliderClient.listSliderInstances(null);
+        for (ApplicationReport yarnApp : yarnApps) {
+          SliderApp sliderAppObject = createSliderAppObject(yarnApp, properties,
+              sliderClient);
+          if (sliderAppObject != null) {
+            if (sliderAppsMap.containsKey(sliderAppObject.getName())) {
+              if (sliderAppsMap.get(sliderAppObject.getName()).getId()
+                  .compareTo(sliderAppObject.getId()) < 0) {
+                sliderAppsMap.put(sliderAppObject.getName(), sliderAppObject);
+              }
+            } else {
               sliderAppsMap.put(sliderAppObject.getName(), sliderAppObject);
             }
-          } else {
-            sliderAppsMap.put(sliderAppObject.getName(), sliderAppObject);
           }
         }
+        if (sliderAppsMap.size() > 0)
+          sliderApps.addAll(sliderAppsMap.values());
+        return sliderApps;
       }
-      if (sliderAppsMap.size() > 0)
-        sliderApps.addAll(sliderAppsMap.values());
-    } finally {
-      Thread.currentThread().setContextClassLoader(currentClassLoader);
-    }
-    return sliderApps;
+    });
   }
 
   @Override
-  public void deleteSliderApp(String applicationId) throws YarnException,
-      IOException {
-    ClassLoader currentClassLoader = Thread.currentThread()
-        .getContextClassLoader();
-    Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
-    try {
-      Set<String> properties = new HashSet<String>();
-      properties.add("id");
-      properties.add("name");
-      SliderApp sliderApp = getSliderApp(applicationId, properties);
-      if (sliderApp == null) {
-        throw new ApplicationNotFoundException(applicationId);
+  public void deleteSliderApp(final String applicationId) throws YarnException,
+      IOException, InterruptedException {
+    Integer code = invokeSliderClientRunnable(new SliderClientContextRunnable<Integer>() {
+      @Override
+      public Integer run(SliderClient sliderClient) throws YarnException,
+          IOException, InterruptedException {
+        Set<String> properties = new HashSet<String>();
+        properties.add("id");
+        properties.add("name");
+        SliderApp sliderApp = getSliderApp(applicationId, properties);
+        if (sliderApp == null) {
+          throw new ApplicationNotFoundException(applicationId);
+        }
+        return sliderClient.actionDestroy(sliderApp.getName());
       }
-
-      SliderClient sliderClient = getSliderClient();
-      sliderClient.actionDestroy(sliderApp.getName());
-    } finally {
-      Thread.currentThread().setContextClassLoader(currentClassLoader);
-    }
+    });
+    logger.info("Deleted Slider App [" + applicationId + "] with exit code " + code);
   }
 
   @Override
@@ -623,25 +677,18 @@ public class SliderAppsViewControllerImpl implements SliderAppsViewController {
       createArgs.resources = resourcesJsonFile;
       createArgs.image = new Path(hdfsLocation
           + "/user/yarn/agent/slider-agent.tar.gz");
-
-      ClassLoader currentClassLoader = Thread.currentThread()
-          .getContextClassLoader();
-      Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
-      try {
-        ApplicationId applicationId = UserGroupInformation.getBestUGI(null,
-            "yarn").doAs(new PrivilegedExceptionAction<ApplicationId>() {
-          public ApplicationId run() throws IOException, YarnException {
-            SliderClient sliderClient = getSliderClient();
-            sliderClient.actionCreate(appName, createArgs);
-            return sliderClient.applicationId;
+      
+      return invokeSliderClientRunnable(new SliderClientContextRunnable<String>() {
+        @Override
+        public String run(SliderClient sliderClient) throws YarnException, IOException, InterruptedException {
+          sliderClient.actionCreate(appName, createArgs);
+          ApplicationId applicationId = sliderClient.applicationId;
+          if (applicationId != null) {
+            return getApplicationIdString(applicationId);
           }
-        });
-        if (applicationId != null) {
-          return getApplicationIdString(applicationId);
+          return null;
         }
-      } finally {
-        Thread.currentThread().setContextClassLoader(currentClassLoader);
-      }
+      });
     }
     return null;
   }
@@ -711,59 +758,42 @@ public class SliderAppsViewControllerImpl implements SliderAppsViewController {
   }
 
   @Override
-  public void freezeApp(String appId) throws YarnException, IOException,
+  public void freezeApp(final String appId) throws YarnException, IOException,
       InterruptedException {
-    ClassLoader currentClassLoader = Thread.currentThread()
-        .getContextClassLoader();
-    Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
-    try {
-      Set<String> properties = new HashSet<String>();
-      properties.add("id");
-      properties.add("name");
-      final SliderApp sliderApp = getSliderApp(appId, properties);
-      if (sliderApp == null)
-        throw new ApplicationNotFoundException(appId);
-
-      ApplicationId applicationId = UserGroupInformation.getBestUGI(null,
-          "yarn").doAs(new PrivilegedExceptionAction<ApplicationId>() {
-        public ApplicationId run() throws IOException, YarnException {
-          SliderClient sliderClient = getSliderClient();
-          ActionFreezeArgs freezeArgs = new ActionFreezeArgs();
-          sliderClient.actionFreeze(sliderApp.getName(), freezeArgs);
-          return sliderClient.applicationId;
-        }
-      });
-      logger.debug("Slider app has been frozen - " + applicationId.toString());
-    } finally {
-      Thread.currentThread().setContextClassLoader(currentClassLoader);
-    }
+    ApplicationId applicationId = invokeSliderClientRunnable(new SliderClientContextRunnable<ApplicationId>() {
+      @Override
+      public ApplicationId run(SliderClient sliderClient) throws YarnException, IOException, InterruptedException {
+        Set<String> properties = new HashSet<String>();
+        properties.add("id");
+        properties.add("name");
+        final SliderApp sliderApp = getSliderApp(appId, properties);
+        if (sliderApp == null)
+          throw new ApplicationNotFoundException(appId);
+        ActionFreezeArgs freezeArgs = new ActionFreezeArgs();
+        sliderClient.actionFreeze(sliderApp.getName(), freezeArgs);
+        return sliderClient.applicationId;
+      }
+    });
+    logger.info("Frozen Slider App [" + appId + "] with response: " + applicationId.toString());
   }
 
   @Override
-  public void thawApp(String appId) throws YarnException, IOException,
-      InterruptedException {
-    ClassLoader currentClassLoader = Thread.currentThread()
-        .getContextClassLoader();
-    Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
-    try {
-      Set<String> properties = new HashSet<String>();
-      properties.add("id");
-      properties.add("name");
-      final SliderApp sliderApp = getSliderApp(appId, properties);
-      if (sliderApp == null)
-        throw new ApplicationNotFoundException(appId);
-      ApplicationId applicationId = UserGroupInformation.getBestUGI(null,
-          "yarn").doAs(new PrivilegedExceptionAction<ApplicationId>() {
-        public ApplicationId run() throws IOException, YarnException {
-          SliderClient sliderClient = getSliderClient();
-          ActionThawArgs thawArgs = new ActionThawArgs();
-          sliderClient.actionThaw(sliderApp.getName(), thawArgs);
-          return sliderClient.applicationId;
-        }
-      });
-      logger.debug("Slider app has been thawed - " + applicationId.toString());
-    } finally {
-      Thread.currentThread().setContextClassLoader(currentClassLoader);
-    }
+  public void thawApp(final String appId) throws YarnException, IOException, InterruptedException {
+    ApplicationId applicationId = invokeSliderClientRunnable(new SliderClientContextRunnable<ApplicationId>() {
+      @Override
+      public ApplicationId run(SliderClient sliderClient) throws YarnException,
+          IOException, InterruptedException {
+        Set<String> properties = new HashSet<String>();
+        properties.add("id");
+        properties.add("name");
+        final SliderApp sliderApp = getSliderApp(appId, properties);
+        if (sliderApp == null)
+          throw new ApplicationNotFoundException(appId);
+        ActionThawArgs thawArgs = new ActionThawArgs();
+        sliderClient.actionThaw(sliderApp.getName(), thawArgs);
+        return sliderClient.applicationId;
+      }
+    });
+    logger.info("Thawed Slider App [" + appId + "] with response: " + applicationId.toString());
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/26cd2f4b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/rest/SliderAppsResource.java
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/rest/SliderAppsResource.java b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/rest/SliderAppsResource.java
index 4459db2..68f363b 100644
--- a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/rest/SliderAppsResource.java
+++ b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/rest/SliderAppsResource.java
@@ -72,7 +72,7 @@ public class SliderAppsResource {
   @DELETE
   @Path("{appId}")
   public void deleteApp(@Context HttpHeaders headers, @Context UriInfo uri,
-      @PathParam("appId") String appId) throws YarnException, IOException {
+      @PathParam("appId") String appId) throws YarnException, IOException, InterruptedException {
     sliderAppsViewController.deleteSliderApp(appId);
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/26cd2f4b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/rest/client/Metric.java
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/rest/client/Metric.java b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/rest/client/Metric.java
index e92d174..4bbeb2f 100644
--- a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/rest/client/Metric.java
+++ b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/rest/client/Metric.java
@@ -19,11 +19,13 @@
 package org.apache.ambari.view.slider.rest.client;
 
 import org.apache.log4j.Logger;
+import org.codehaus.jackson.annotate.JsonIgnore;
 
 import javax.xml.xpath.XPath;
 import javax.xml.xpath.XPathExpression;
 import javax.xml.xpath.XPathExpressionException;
 import javax.xml.xpath.XPathFactory;
+
 import java.util.ArrayList;
 import java.util.List;
 
@@ -73,6 +75,7 @@ public class Metric {
     this.temporal = temporal;
   }
 
+  @JsonIgnore
   public XPathExpression getxPathExpression() {
     if (!xPathExpressionComputed) {
       XPathFactory xPathfactory = XPathFactory.newInstance();