JPPF Issue Tracker
star_faded.png
Please log in to bookmark issues
enhancement_small.png
CLOSED  Enhancement JPPF-552  -  Improve job API to enable tasks as lambdas
Posted Oct 13, 2018 - updated Oct 30, 2018
action_vote_minus_faded.png
0
Votes
action_vote_plus_faded.png
icon_info.png This issue has been closed with status "Closed" and resolution "RESOLVED".
Issue details
  • Type of issue
    Enhancement
  • Status
     
    Closed
  • Assigned to
    Not assigned to anyone
  • 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
    Not determined
  • Targetted for
    icon_milestones.png JPPF 6.1
Issue description
We propose to add APIs to the JPPFJob class, in order to allow tasks as lambda expressions.

For example, for Callable and Runnable tasks:
public Task<?> addRunnable(JPPFRunnableTask task);
 
public <T> Task<?> addCallable(JPPFCallable<T> task);
where JPPFRunnableTask is defined as:
public class JPPFRunnableTask extends Runnable, Serializable { }
and JPPFCallable is defined as:
public class JPPFCallable<T> extends Callable<T>, Serializable { }
We need to ensure the tasks are serializable.

We could then add a callable task as a lambda expression, such as:
JPPFJob job = new JPPFJob();
job.addCallable(() -> "hello, world");