Juwang-Add RunningTask event handler, bridge classes and methods

When running task event is received from an Evaluator, it will trigger the call at RunningTask Event Handler registered at Java side. We would like to propagate the event to C# cross the bridge so that C# client can have their RunningTask event handler so that to get the task information including the Active Context. 

This PR adds a Java RunningTask event handler, creates bridge classes and methods, handles the calls between Java and C#. 
runningTaskHandler gets its value from the JobDriver code below in reef-bridge-java module, regardless CLR clients provided their handler or not, isn’t it?

runningTaskHandler = handlers[NativeInterop.Handlers.get(NativeInterop.RunningTaskKey);


From: Yingda Chen [mailto:notifications@github.com]
Sent: Monday, June 30, 2014 10:43 PM
To: Microsoft-CISL/REEF
Cc: Julia Wang (QIUHE)
Subject: Re: [REEF] Juwang-Add RunningTask event handler, bridge classes and methods (#887)


In reef-bridge-project/reef-bridge-java/src/main/java/com/microsoft/reef/javabridge/generic/JobDriver.java:

> @@ -371,6 +373,32 @@ public void onNext(final FailedTask task) throws RuntimeException {

>      }

>    }

>

> +  /**

> +   * Receive notification that the Task is running.

> +   */

> +  final class RunningTaskHandler implements EventHandler<RunningTask> {

> +    @Override

> +    public void onNext(final RunningTask task) {

> +

> +      LOG.log(Level.INFO, "RunningTask received, will be handle in CLR handler. Task Id: {0}", task.getId());

> +      if (runningTaskHandler == 0) {

> +        LOG.log(Level.SEVERE, "Running Task Handler not initialized by CLR, fail for real.");

> +        throw new RuntimeException("Running Task Handler not initialized by CLR.");

> +      }

We should not fail here just because the .NET handler is not set.

—
Reply to this email directly or view it on GitHub<https://github.com/Microsoft-CISL/REEF/pull/887/files#r14389368>.