JPPF Issue Tracker
star_faded.png
Please log in to bookmark issues
bug_report_small.png
CLOSED  Bug report JPPF-602  -  AbstractExecutionManager uses the wrong configuration to initialize
Posted Aug 23, 2019 - updated Aug 24, 2019
icon_info.png This issue has been closed with status "Closed" and resolution "RESOLVED".
Issue details
  • Type of issue
    Bug report
  • Status
     
    Closed
  • Assigned to
     lolo4j
  • Progress
       
  • Type of bug
    Not triaged
  • Likelihood
    Not triaged
  • Effect
    Not triaged
  • Posted by
     lolo4j
  • Owned by
    Not owned by anyone
  • Category
    Core
  • Resolution
    RESOLVED
  • Priority
    Normal
  • Reproducability
    Not determined
  • Severity
    Normal
  • Targetted for
    icon_milestones.png JPPF 6.0.4
Issue description
From this forums thread.

The constrcutor for org.jppf.execute.AbstractExecutionManager is as follows:
public AbstractExecutionManager(final JPPFProperty<Integer> nbThreadsProperty) {
  taskNotificationDispatcher = new TaskExecutionDispatcher(getClass().getClassLoader());
  int poolSize = JPPFConfiguration.get(nbThreadsProperty);
  if (poolSize <= 0) poolSize = Runtime.getRuntime().availableProcessors();
  JPPFConfiguration.set(nbThreadsProperty, poolSize);
  log.info("running " + poolSize + " processing thread" + (poolSize > 1 ? "s" : ""));
  threadManager = createThreadManager(poolSize);
}
The problem here is in the statement "poolSize = JPPFConfiguration.get(nbThreadsProperty);", which uses the global configuration instead of the config for the JPPF component (client or node) which initializes the execution manger.

Instead, the constructor should have the following signature:
public AbstractExecutionManager(TypedProperties config, final JPPFProperty<Integer> nbThreadsProperty) { ... }
Steps to reproduce this issue
Run a program that initializes a JPPF client as follows:
public class TestClient {
  public static void main(String[] args) throws Exception {
    TypedProperties properties = new TypedProperties();
    try (InputStream is = new BufferedInputStream(new FileInputStream("config/jppf.properties"))) {
      properties.load(is);
    }
    properties.setBoolean("jppf.remote.execution.enabled", false);
    properties.setBoolean("jppf.local.execution.enabled", true);
    properties.setInt("jppf.local.execution.threads", 13);
    JPPFClient client = new JPPFClient(UUID.randomUUID().toString(), properties, new ConnectionPoolListenerAdapter());
    client.close();
  }
}
The resulting log will show a message like this:
[o.j.e.AbstractExecutionManager.<init>(111)]: running 8 processing threads
This shows the execution manager is using 8 threads (the number of available processors in this test) instead of the 13 that were configured