java - executor service with multiple tasks on each thread -
after researching web couldn't find answer hope here can.
i'm running executorservice multiple threads (lets 2 simplification). on each thread i'm submitting runnable has many tests in it. tests use software on computer.
my scenario if test fails on thread - need restart software on computer.
so if test on thread 1 needs restart software - need pause work of second thread (all threads needs pausing including thread one).
on second thread test might using software - want finish running test - pause next tests in line/the thread - restart software - , continue work on both (all) threads.
things i've tried , not quite sure how implement are: offers john these videos: advanced java: multi-threading.
thanks in advance help.
i suggest have scheduledthreadpoolexecutor.
you implement instance of singleton store status (pause / run) software (take care of concurrency), , each of runnable
test, you'll check state @ beginning of execution. if state on hold, re-schedule task small delay (evaluate restart time of software). means, should pass serviceexecutor input parameter of constructor of task (and store variable).
Comments
Post a Comment