In jave i have a state machine which i need to migrate to automated state changes, in this i mean i need state changes to occur after certan intervals.. for instance after 5 seconds state one, after 10 seconds state 2.
I was thinking of using ;
ScheduledExecutorService executor = new ScheduledThreadPoolExecutor(1);
Schedule a task that basically calls a method, which would change state and then schedule another task to change to next state, and so on.
Any ideas?
Need code similar to this:
You could also look into scheduleAtFixedRate().