Skip to content

Commit

Permalink
[#1740] play.Cache.init() is called before the GAE plugin starts patch
Browse files Browse the repository at this point in the history
The ticket
https://play.lighthouseapp.com/projects/57987/tickets/1740-playcacheinit-is-called-before-the-gae-plugin-starts 
was raised for Play itself but the fix is made in play-gae module.
Gae cached is now initiated onLoad and onApplicationStart
  • Loading branch information
mstepien committed Apr 17, 2016
1 parent 3ff6b70 commit fa29190
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/play/modules/gae/GAEPlugin.java
Expand Up @@ -59,6 +59,7 @@ public void onLoad() {
// Force to PROD mode when hosted on production GAE
Play.mode = Play.Mode.PROD;
prodGAE = true;
wrapGAECache();
}
}

Expand All @@ -74,16 +75,19 @@ public void onRoutesLoaded() {

@Override
public void onApplicationStart() {
// Wrap the GAE cache
if (devEnvironment == null) {
Cache.forcedCacheImpl = new GAECache();
}

wrapGAECache();
// Provide the correct JavaMail session
Mail.session = Session.getDefaultInstance(new Properties(), null);
Mail.asynchronousSend = false;
}

private void wrapGAECache() {
// Wrap the GAE cache
if (devEnvironment == null && Cache.forcedCacheImpl == null) {
Cache.forcedCacheImpl = new GAECache();
}
}

@Override
public void beforeInvocation() {
// Set the current development environment if needed
Expand Down

0 comments on commit fa29190

Please sign in to comment.