JPPF Issue Tracker
star_faded.png
Please log in to bookmark issues
bug_report_small.png
CLOSED  Bug report JPPF-259  -  JPPFResultCollector.getAllResults() returns null at the time JobListener.jobEnded() is called
Posted May 10, 2014 - updated Mar 28, 2016
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
    Client
  • Resolution
    RESOLVED
  • Priority
    Normal
  • Reproducability
    Always
  • Severity
    Normal
  • Targetted for
    icon_milestones.png JPPF 4.1.x
Issue description
The 'results' field in JPPFResultCollector, which holds the completed tasks of a job, is null at the time a JobListner's jobEnded() method is called. It is only computed when the status of the JPPFResultCollector is set to COMPLETE, which occus after that. This is not a good idea and will cause NPEs in users code.

To fix this, we propose to update the results map incrementally, every time the JPPFResultCollector's resultsReceived() method is called.
Steps to reproduce this issue
Add a job listener to the job with the following:
@Override
public void jobEnded(final JobEvent event) {
  JPPFResultCollector collector = (JPPFResultCollector) event.getJob().getResultslistener();
  System.out.println("jobEnded() called : results = " + collector.getAllResults());
}
==> this will print null results

#3
Comment posted by
 lolo4j
May 11, 09:39
Fixed in: