playframework / play-plugins

CachePlugin
444 stars 161 forks source link

Use def for jedis pol #124

Closed angeloh closed 10 years ago

angeloh commented 10 years ago

Tests will fail if run together. To fix, use def for jedis pool instead of val.

lightbend-cla-validator commented 10 years ago

Hi @angeloh,

Thank you for your contribution! We really value the time you've taken to put this together.

Before we proceed with reviewing this pull request, please sign the Typesafe Contributors License Agreement:

http://www.typesafe.com/contribute/cla

jroper commented 10 years ago

No, this causes connection leaks, each time you access jedisPool, it creates a new one, which means in the onStop method, instead of shutting down the existing pool, a new one is created, only to be shut down again, leaving the existing one open.

Play's global state means tests can't be run concurrently. This will be fixed in Play 3, for now, you must ensure that a) each test uses its own FakeApplication, ie you don't reuse the same FakeApplication between tests, and b) tests don't run in parallel.