|
@@ -23,6 +23,7 @@ import java.io.FileOutputStream;
|
|
import java.io.FilenameFilter;
|
|
import java.io.FilenameFilter;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.io.InputStream;
|
|
|
|
+import java.lang.reflect.UndeclaredThrowableException;
|
|
import java.security.PrivilegedExceptionAction;
|
|
import java.security.PrivilegedExceptionAction;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.Collections;
|
|
import java.util.Collections;
|
|
@@ -137,7 +138,7 @@ public class SliderAppsViewControllerImpl implements SliderAppsViewController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- private <T> T invokeSliderClientRunnable(final SliderClientContextRunnable<T> runnable) throws IOException, InterruptedException {
|
|
|
|
|
|
+ private <T> T invokeSliderClientRunnable(final SliderClientContextRunnable<T> runnable) throws IOException, InterruptedException, YarnException {
|
|
ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader();
|
|
ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader();
|
|
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
|
|
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
|
|
try {
|
|
try {
|
|
@@ -151,19 +152,28 @@ public class SliderAppsViewControllerImpl implements SliderAppsViewController {
|
|
} else {
|
|
} else {
|
|
sliderUser = UserGroupInformation.getBestUGI(null, getUserToRunAs());
|
|
sliderUser = UserGroupInformation.getBestUGI(null, getUserToRunAs());
|
|
}
|
|
}
|
|
- T value = sliderUser.doAs(
|
|
|
|
- new PrivilegedExceptionAction<T>() {
|
|
|
|
- @Override
|
|
|
|
- public T run() throws Exception {
|
|
|
|
- final SliderClient sliderClient = createSliderClient();
|
|
|
|
- try{
|
|
|
|
- return runnable.run(sliderClient);
|
|
|
|
- }finally{
|
|
|
|
- destroySliderClient(sliderClient);
|
|
|
|
|
|
+ try{
|
|
|
|
+ T value = sliderUser.doAs(
|
|
|
|
+ new PrivilegedExceptionAction<T>() {
|
|
|
|
+ @Override
|
|
|
|
+ public T run() throws Exception {
|
|
|
|
+ final SliderClient sliderClient = createSliderClient();
|
|
|
|
+ try{
|
|
|
|
+ return runnable.run(sliderClient);
|
|
|
|
+ }finally{
|
|
|
|
+ destroySliderClient(sliderClient);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
- });
|
|
|
|
- return value;
|
|
|
|
|
|
+ });
|
|
|
|
+ return value;
|
|
|
|
+ } catch (UndeclaredThrowableException e) {
|
|
|
|
+ Throwable cause = e.getCause();
|
|
|
|
+ if (cause instanceof YarnException) {
|
|
|
|
+ YarnException ye = (YarnException) cause;
|
|
|
|
+ throw ye;
|
|
|
|
+ }
|
|
|
|
+ throw e;
|
|
|
|
+ }
|
|
} finally {
|
|
} finally {
|
|
Thread.currentThread().setContextClassLoader(currentClassLoader);
|
|
Thread.currentThread().setContextClassLoader(currentClassLoader);
|
|
}
|
|
}
|
|
@@ -782,7 +792,9 @@ public class SliderAppsViewControllerImpl implements SliderAppsViewController {
|
|
resourcesObj.addProperty("schema",
|
|
resourcesObj.addProperty("schema",
|
|
"http://example.org/specification/v2.0.0");
|
|
"http://example.org/specification/v2.0.0");
|
|
resourcesObj.add("metadata", new JsonObject());
|
|
resourcesObj.add("metadata", new JsonObject());
|
|
- resourcesObj.add("global", clientResourcesObj.get("global").getAsJsonObject());
|
|
|
|
|
|
+ resourcesObj.add("global",
|
|
|
|
+ clientResourcesObj.has("global") ? clientResourcesObj.get("global")
|
|
|
|
+ .getAsJsonObject() : new JsonObject());
|
|
JsonObject componentsObj = new JsonObject();
|
|
JsonObject componentsObj = new JsonObject();
|
|
if (clientComponentsArray != null) {
|
|
if (clientComponentsArray != null) {
|
|
for (int i = 0; i < clientComponentsArray.size(); i++) {
|
|
for (int i = 0; i < clientComponentsArray.size(); i++) {
|