How to design an execution engine for a sequence of tasks

前端 未结 10 1989
南方客
南方客 2021-02-01 17:16

I am trying to code a problem in Java where I have to execute a bunch of tasks.

Problem

Execute a job which consists of multiple tasks and thos

10条回答
  •  清歌不尽
    2021-02-01 17:31

    Abstracting from the multithreading

    class TaskA{
        SimpleTask Y;
        SimpleTask Z;
    
        SimpleTask PJ;
        SimpleTask RJ;
    
        Run(){
            // do the partial job
            PJ.Run();
            Y.Run();
            // do the remaining job
            RJ.Run();
            Z.Run();
            // return;
        }
    } 
    
    class TaskB{
        TaskA P;
        SimpleTask J;
    
        Run(){
            // do the job
            J.Run();
            P.Run();
            // return;
        }
    }
    

提交回复
热议问题