multithreading - Java Executor to execute one Callable after previous has finished? -


i have custom business requirement. need execute series of service calls. each of these call creates new record in database. need execute next service call after previous service call has finished, because new service call use record created in db previous service call, input parameter.

i had decided wrap each of these service calls in future tasks , use executors.newsinglethreadexecutor() execute these tasks in loop.

please suggest suffice , better solution if not ??

also need place task.isdone() before executing next task??

i have decided use executors.newsinglethreadexecutor().

good choice given requirement.

please suggest suffice , better solution if not ??

yes, pretty so. standard jdk libraries, best can find.

also need place task.isdone() before executing next task??

no. javadoc executor explicitly states "[...]tasks guaranteed execute sequentially, , no more 1 task active @ given time."

therefore, no task initiated before active 1 terminates (successfully or not). stuff them executor, handle things you.


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -