The com.nomagic.magicdraw.job.IdleJobService allows to add com.nomagic.magicdraw.job.Job(s) which can be executed when a program is idle. The program decides when it is the most appropriate to execute the Job without getting the program into an inconsistent state. The example of usage:

Job job = new Job()
{  
    public boolean needsExecute()
    {
        return true;
    }
   
    public void execute(ProgressStatus progressStatus) throws Exception
    {
        // Do necessary work in the session.
    }
  
    public void finished()
    {
        // Cleanup after job is finished.
    }
   
    public String getName()
    {
        return "My Job";
    }
};
  
IdleJobService.getInstance().addJob(job);
  
// Remove the job when it is no longer necessary.
IdleJobService.getInstance().removeJob(job);

For more information please refer to <installation_directory>\openapi\examples\JobExample.

Related pages