JPPF Issue Tracker
Please log in to bookmark issues
CLOSED  Bug report JPPF-227  -  JobListener concurrency issues
Posted Feb 27, 2014 - updated Oct 26, 2014
icon_info.png This issue has been closed with status "Not a bug" and resolution "NOT AN ISSUE".
Issue details
  • Type of issue
    Bug report
  • Status
    Not a bug
  • 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
    Not determined
  • Severity
    Not determined
  • Targetted for
    icon_milestones.png JPPF 4.2
Issue description
When a job A contains 10 tasks but is split up by a JPPFClient instance, because of only one allowed tasks, then JobListener are not correctly handle. All 10 job B,C,D,E... share the JobListener registered with A.

As a consequence the JobListener is not thread-safe.
Steps to reproduce this issue
  1. Use Bundler with bundle size 1
  2. Create a Job with 10 tasks.
  3. Register a JobListener with that job. JobListener should contain a private variable e.g. counter = 1
  4. the method jobReturned should decrease the counter by 1
  5. the method jobEnded should output the result of counter

Expected Output: 10 times zero

Current Output: Some odd number < 0

Comment posted by
Feb 27, 20:30
This is the intended and expected behavior. The documentation on job listeners explicitely states that they are not thread safe and the user should handle synchronization within the listener's methods:
Please note that jobDispatched() and jobReturned() may be called in parallel by multiple threads, in the case where the JPPF client has multiple connections in its configuration. This happens if the client uses multiple connections to the same server, connections to multiple servers, or a mix of connections to remote servers and a local executor. You will need to synchronize any operations that is not thread-safe within these methods.

Also it seems there is a misunderstanding of how the JobListener works. The job listener is not shared by the tasks, nor should there be one instance per task, it is simply assigned to a job and will receive all notifications for this job. Some of these notifications may occur in parallel, some won't.

Hence I'will close this issue as 'not a bug'