Play framework job queue
How does play handle asynchronous job开发者_开发百科s when they are called using the now() method?
Are they executed immediately, or are they stored in a queue and processed by a fixed number of threads? What sort of control do we have over that?
When you call now()
, your job is put into a ScheduledThreadPoolExecutor via submit()
. Since the executor uses a fixed-size pool, your job may end up being queued. Also, the pool is shared with your scheduled jobs , so you may have contention with them in addition to any jobs you spawned on demand.
You can adjust the size of the pool in your application's configuration, using the play.jobs.pool
setting. The default value is 10.
精彩评论