hibernate - How to use same database transaction in separate thread with Play Framework 2.2 -


from play's documentation:

because of way play 2.0 works, action code must fast possible (ie. non blocking). should return result if not yet able generate it? response promise of result!

so shouldn't doing database calls directly inside of action. confuses me when @ plays jpa documentation:

every jpa call must done in transaction so, enable jpa particular action, annotate @play.db.jpa.transactional. compose action method jpa action manages transaction you

this leaves me little bit confused. if follow documentation, shouldn't block action thread database call. if action what's creating , managing database transaction, aren't losing transaction sending work actor, or somehow offloading work thread? mean, i'm new scala , play, don't see how transaction follow separate threads. have explanation, or way should doing this? i'm confused.

you missing piece of puzzle, read under "highly synchronous" here: http://www.playframework.com/documentation/2.2.x/threadpools

so, yes, want non-blocking if cannot have because of jpa/jdbc etc. can configure play regular java web containers - thread pool lots of threads. won't give play can give might enough you.

you create specific thread pool/execution context , run jpa/jdbc stuff on , keep rest of server non blocking.


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -