threadpool - ScheduledExecutorService: modify one or more running tasks -


i have program, loads few tasks file prepared user , start executing them according scheduling shown in file.

example: taskfile.txt

task1: run every hour task2: run every 2 seconds ... taskn: run every monday @ 10:00 

this first part ok, solved using scheduledexecutorservice , satisfied. tasks load , run should.

now, let's image user, gui (at runtime), decides task2 should run every minute, , wants remove task3. cannot find way access 1 specific task in pool, in order remove/modify it.

so cannot update tasks @ runtime. when user changes task, can modify taskfile.txt , restart application, in order reload tasks according newly updated taskfile.txt.

do know way access single task in order modify/delete it?

or even, way remove 1 given task, can insert new 1 in pool, modifications wanted user.

thanks

this not elegant, works.

let's suppose need 10 threads, , need manage specific thread.

instead have pool 10 thread, use 10 pools 1 thread each, keep them in favourite data structure, , act on pool_1 when want modify thread_1. it's possible remove older runnable pool , put new 1 needed changes.

otherways, put in pool became anonymous , not directly manageable.

if has better solution...


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -