JPPF Issue Tracker
Please log in to bookmark issues
CLOSED  Bug report JPPF-48  -  Impossible to get the class loader of a Runnable submitted via JPPFExecutorService
Posted Aug 25, 2012 - updated Dec 27, 2014
icon_info.png This issue has been closed with status "Closed" and resolution "RESOLVED".
Issue details
  • Type of issue
    Bug report
  • Status
  • Assigned to
  • Progress
  • Type of bug
    Not triaged
  • Likelihood
    Not triaged
  • Effect
    Not triaged
  • Posted by
  • Owned by
    Not owned by anyone
  • Category
  • Resolution
  • Priority
  • Reproducability
  • Severity
  • Targetted for
    icon_milestones.png JPPF 3.1.x
Issue description
When a Runnable is submitted via JPPFExecutorService.submit(Runnable), it is not possible to get the corresponding class loader on the node side using a public API. For instance, this happens from a NodeLifeCycleListener implementation.

Steps to reproduce this issue
Using this NodeLifeCycleListener implementation:
public class NodeListener implements NodeLifeCycleListener {
  public void nodeStarting(final NodeLifeCycleEvent event) { }
  public void nodeEnding(final NodeLifeCycleEvent event) { }
  public void jobStarting(final NodeLifeCycleEvent event) {
    System.out.println("test.NodeListener: job starting");
    JPPFTask task = (JPPFTask) event.getTasks().get(0);
    Class c = task.getClass();
    System.out.println("task=" + task + ", class=" + c + ", classloader=" + c.getClassLoader());
    System.out.println("task object=" + task.getTaskObject());
  public void jobEnding(final NodeLifeCycleEvent event) { }
and this client-side implementation:
public class Main {
  public static void main(final String[] args) {
    JPPFClient client = new JPPFClient();
    JPPFExecutorService executor = new JPPFExecutorService(client);
    try {
      while (!client.hasAvailableConnection()) Thread.sleep(10L);
      List<Future<?>> futures = new ArrayList<Future<?>>();
      futures.add(executor.submit(new MyRunnableTask()));
    } catch (Exception e) {
    } finally {
  public static class MyRunnableTask implements Runnable, Serializable {
    public void run() {
      System.out.println("running MyRunnableTask");
When the Runnable is submmitted, it is wrapped into a RunnableWrapper. When the NodeListener attempts to print JPPFTask.getObject(), this will show the RunnableWrapper<T> instance. The problem is that RunnableWrapper doesn't have a public method to get the underlying Runnable, which is the real task submitted by the user.

Comment posted by
Aug 26, 10:24
Fixed. Changes committed to SVN:

The issue was updated with the following change(s):
  • This issue has been closed
  • The status has been updated, from New to Closed.
  • This issue's progression has been updated to 100 percent completed.
  • The resolution has been updated, from Not determined to RESOLVED.
  • Information about the user working on this issue has been changed, from lolo4j to Not being worked on.