Class SolutionProcessor

  • All Implemented Interfaces:
    Runnable

    public class SolutionProcessor
    extends RunnableBase
    This class manges the processing of new a solution produced by the solver.
    • Constructor Detail

      • SolutionProcessor

        public SolutionProcessor​(TaskAssigningRuntimeDelegate delegate,
                                 Consumer<SolutionProcessor.Result> resultConsumer,
                                 String targetUserId,
                                 int publishWindowSize)
        Parameters:
        delegate - a TaskAssigningRuntimeDelegate instance for executing methods into the jBPM runtime.
        resultConsumer - a consumer for processing the results.
        targetUserId - a user identifier for using as the "on behalf of" user when interacting with the jBPM runtime.
        publishWindowSize - Integer value > 0 that indicates the number of tasks to be published.
    • Method Detail

      • isProcessing

        public boolean isProcessing()
        Returns:
        true if a solution is being processed at this time, false in any other case.
      • process

        public void process​(org.kie.server.services.taskassigning.core.model.TaskAssigningSolution solution)
        This method is invoked from a different thread for doing the processing of a solution. If a solution is being processed an exception is thrown, so it's expected that any synchronization required between the isProcessing() and process() methods is performed by the caller. Since only one solution can be processed at time, the caller should typically execute in the following sequence. if (!solutionProcessor.isProcessing()) { solutionProcessor.process(solution); } else { //invoke at a later time. } A null value will throw an exception too.
        Parameters:
        solution - a solution to process.
      • run

        public void run()
      • doProcess

        protected void doProcess​(org.kie.server.services.taskassigning.core.model.TaskAssigningSolution solution)