Rand
Rand

Reputation: 1011

Play framework job queue

How does play handle asynchronous jobs 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?

Upvotes: 6

Views: 2724

Answers (1)

Tim Stone
Tim Stone

Reputation: 19169

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.

Upvotes: 6

Related Questions