proper usage of synchronized singleton?

前端 未结 10 742
长发绾君心
长发绾君心 2020-12-31 12:09

So I am thinking about building a hobby project, one off kind of thing, just to brush up on my programming/design.

It\'s basically a multi threaded web spider, upda

10条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-31 12:19

    Why don't you create a data structure you pass to each of the threads as dependency injection. That way you don't need a singleton. You still need to make the thread safe.

提交回复
热议问题