Java Timer vs ExecutorService?

前端 未结 6 1448
孤独总比滥情好
孤独总比滥情好 2020-11-21 23:51

I have code where I schedule a task using java.util.Timer. I was looking around and saw ExecutorService can do the same. So this question here, hav

6条回答
  •  我寻月下人不归
    2020-11-22 00:40

    Here's some more good practices around Timer use:

    http://tech.puredanger.com/2008/09/22/timer-rules/

    In general, I'd use Timer for quick and dirty stuff and Executor for more robust usage.

提交回复
热议问题