|
@@ -80,6 +80,7 @@ public class LocalContainerLauncher extends AbstractService implements
|
|
|
private final HashSet<File> localizedFiles;
|
|
|
private final AppContext context;
|
|
|
private final TaskUmbilicalProtocol umbilical;
|
|
|
+ private final ClassLoader jobClassLoader;
|
|
|
private ExecutorService taskRunner;
|
|
|
private Thread eventHandler;
|
|
|
private BlockingQueue<ContainerLauncherEvent> eventQueue =
|
|
@@ -87,6 +88,12 @@ public class LocalContainerLauncher extends AbstractService implements
|
|
|
|
|
|
public LocalContainerLauncher(AppContext context,
|
|
|
TaskUmbilicalProtocol umbilical) {
|
|
|
+ this(context, umbilical, null);
|
|
|
+ }
|
|
|
+
|
|
|
+ public LocalContainerLauncher(AppContext context,
|
|
|
+ TaskUmbilicalProtocol umbilical,
|
|
|
+ ClassLoader jobClassLoader) {
|
|
|
super(LocalContainerLauncher.class.getName());
|
|
|
this.context = context;
|
|
|
this.umbilical = umbilical;
|
|
@@ -94,6 +101,7 @@ public class LocalContainerLauncher extends AbstractService implements
|
|
|
// (TODO/FIXME: pointless to use RPC to talk to self; should create
|
|
|
// LocalTaskAttemptListener or similar: implement umbilical protocol
|
|
|
// but skip RPC stuff)
|
|
|
+ this.jobClassLoader = jobClassLoader;
|
|
|
|
|
|
try {
|
|
|
curFC = FileContext.getFileContext(curDir.toURI());
|
|
@@ -133,6 +141,18 @@ public class LocalContainerLauncher extends AbstractService implements
|
|
|
setDaemon(true).setNameFormat("uber-SubtaskRunner").build());
|
|
|
// create and start an event handling thread
|
|
|
eventHandler = new Thread(new EventHandler(), "uber-EventHandler");
|
|
|
+ // if the job classloader is specified, set it onto the event handler as the
|
|
|
+ // thread context classloader so that it can be used by the event handler
|
|
|
+ // as well as the subtask runner threads
|
|
|
+ if (jobClassLoader != null) {
|
|
|
+ LOG.info("Setting " + jobClassLoader +
|
|
|
+ " as the context classloader of thread " + eventHandler.getName());
|
|
|
+ eventHandler.setContextClassLoader(jobClassLoader);
|
|
|
+ } else {
|
|
|
+ // note the current TCCL
|
|
|
+ LOG.info("Context classloader of thread " + eventHandler.getName() +
|
|
|
+ ": " + eventHandler.getContextClassLoader());
|
|
|
+ }
|
|
|
eventHandler.start();
|
|
|
super.serviceStart();
|
|
|
}
|