JPPF, java, parallel computing, distributed computing, grid computing, parallel, distributed, cluster, grid, cloud, open source, android, .net

The open source
grid computing

 Home   About   Features   Download   Documentation   On Github   Forums 
June 04, 2023, 09:53:56 AM *
Please login or register.

Login with username, password and session length
Advanced search  
News: New users, please read this message. Thank you!
  Home Help Search Login Register  
Pages: [1]   Go Down

Author Topic: JPPFClient#submitJob throws Exception  (Read 2970 times)


  • JPPF Padawan
  • *
  • Posts: 2
    • Medallia Engineering
JPPFClient#submitJob throws Exception
« on: August 12, 2014, 05:01:17 PM »

Hi all, is there a reason why JPPFClient#submitJob throws a plain Exception?

Looking at the code I couldn't find a reason. I'm using JPPF 4.2.

  public List<Task<?>> submitJob(final JPPFJob job) throws Exception {
    if (job == null) throw new IllegalArgumentException("job cannot be null");
    if (job.client != null) {
      if (!job.isDone()) throw new IllegalStateException("this job is already submitted");
    job.client = this;
    if (job.getJobTasks().isEmpty()) throw new IllegalArgumentException("job cannot be empty");
    if ((job.getResultListener() == null) ||
        (job.isBlocking() && !(job.getResultListener() instanceof JPPFResultCollector))) job.setResultListener(new JPPFResultCollector(job));
    SubmissionManager submissionManager = getSubmissionManager();
    if (job.isBlocking()) return job.awaitResults();
    return null;

All explicitly thrown exceptions seem to be runtime exceptions, and none of the other invoked methods throw Exception. This forces whoever is using the client to either catch Exception or declare to throw it, but in reality this is never happening. Unless there's something I'm not seeing, hence I'm asking.



  • Administrator
  • JPPF Council Member
  • *****
  • Posts: 2272
    • JPPF Web site
Re: JPPFClient#submitJob throws Exception
« Reply #1 on: August 12, 2014, 07:38:53 PM »


You are absolutely right. I suppose we've carried this throws clause out of sheer inertia, as I cannot see any reason for it being there. I registered an enhancement for this: JPPF-305 JPPFClient.submitJob() has a useless throws clause. It will be delivered as part of the upcoming v4.2.1 maintenance release by the end of this week.

Thank you very much for reporting this issue.

Pages: [1]   Go Up
JPPF Powered by SMF 2.0 RC5 | SMF © 2006–2011, Simple Machines LLC Get JPPF at Fast, secure and Free Open Source software downloads