Single thread pool vs one thread pool per task

后端 未结 3 996
有刺的猬
有刺的猬 2021-01-20 04:39

I want to use concurrency in Java to make requests to an online API, download and parse the response documents, and load the resulting data into a database.

Is it st

3条回答
  •  没有蜡笔的小新
    2021-01-20 05:07

    I don't believe there is a standard approach, it depends on your requirements.

    If you are writing something quick and dirty then you're best having one pool.

    If you're looking for something more resilient and where recovery is required then you may opt for several pools. Eg. if you persist the responses and if your app dies then when it restarts you can just re-queue the responses without having to fetch them again.

提交回复
热议问题