ffmpeg-cli-wrapper icon indicating copy to clipboard operation
ffmpeg-cli-wrapper copied to clipboard

FFmpegJob running. how to do force stop job?

Open 13330863440 opened this issue 1 year ago • 1 comments
trafficstars

public  static Set<String> closeIdSet = new HashSet<>();
executor.execute(() -> {
    // thread
     Thread currentThread = Thread.currentThread();
    String currentJobId="xxxx";
   ScheduledExecutorService sche= new ScheduledThreadPoolExecutor(1);
                    sche.scheduleAtFixedRate(() -> {
                       if(closeIdSet.contains(currentJobId)){
                          //force stop thread and stop job  !!  . how to do force stop job?
                           currentThread.stop();
                       }
                    }, 0, 1, TimeUnit.SECONDS);
    
    
    FFmpegJob job = executor.createJob(builder)
    job.run();  // job running.  need force stop running
    
    next steps
    xxxx
    xxxx
    xxxx
});
//add closeIdSet  "xxxx" in  other thread 

13330863440 avatar Dec 13 '23 22:12 13330863440

just stop job.run(). like as

Process p = runFunc.run(path(args));
assert (p != null);
p.destroyForcibly()

Can this be done without modifying the source code

13330863440 avatar Dec 13 '23 22:12 13330863440