call listenerBus() using reflection

This commit is contained in:
Lee moon soo 2015-08-22 14:29:44 -07:00
parent 62b8c45ceb
commit 0c28561f2c

View file

@ -158,8 +158,9 @@ public class SparkInterpreter extends Interpreter {
private static JobProgressListener setupListeners(SparkContext context) {
JobProgressListener pl = new JobProgressListener(context.getConf());
try {
Method m = context.listenerBus().getClass().getMethod("addListener", pl.getClass());
m.invoke(context.listenerBus(), pl);
Object listenerBus = context.getClass().getMethod("listenerBus").invoke(context);
Method m = listenerBus.getClass().getMethod("addListener", pl.getClass());
m.invoke(listenerBus, pl);
} catch (NoSuchMethodException | SecurityException | IllegalAccessException
| IllegalArgumentException | InvocationTargetException e) {
e.printStackTrace();