You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by na...@apache.org on 2015/04/15 21:41:15 UTC

[10/39] jclouds git commit: JCLOUDS-372: changing OAuth timeout from MINUTES to SECONDS

JCLOUDS-372: changing OAuth timeout from MINUTES to SECONDS


Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/f6f90106
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/f6f90106
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/f6f90106

Branch: refs/heads/master
Commit: f6f901065e3bf088fd9459c3c370484e3cb0bcf3
Parents: 7e2ceba
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Mon Nov 11 14:44:27 2013 +0000
Committer: Andrew Phillips <an...@apache.org>
Committed: Tue Nov 12 12:06:19 2013 +0100

----------------------------------------------------------------------
 .../main/java/org/jclouds/oauth/v2/config/OAuthModule.java  | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/f6f90106/apis/oauth/src/main/java/org/jclouds/oauth/v2/config/OAuthModule.java
----------------------------------------------------------------------
diff --git a/apis/oauth/src/main/java/org/jclouds/oauth/v2/config/OAuthModule.java b/apis/oauth/src/main/java/org/jclouds/oauth/v2/config/OAuthModule.java
index 11c33bf..cc99444 100644
--- a/apis/oauth/src/main/java/org/jclouds/oauth/v2/config/OAuthModule.java
+++ b/apis/oauth/src/main/java/org/jclouds/oauth/v2/config/OAuthModule.java
@@ -66,9 +66,12 @@ public class OAuthModule extends AbstractModule {
    }
 
    /**
-    * Provides a cache for tokens. Cache is time based and expires after 59 minutes (the maximum time a token is
-    * valid is 60 minutes)
+    * Provides a cache for tokens. Cache is time based and by default expires after 59 minutes 
+    * (the maximum time a token is valid is 60 minutes).
+    * This cache and expiry period is system-wide and does not attend to per-instance expiry time
+    * (e.g. "expires_in" from Google Compute -- which is set to the standard 3600 seconds).
     */
+   // NB: If per-instance expiry time is required, significant refactoring will be needed.
    @Provides
    @Singleton
    public LoadingCache<TokenRequest, Token> provideAccessCache(Function<TokenRequest, Token> getAccess,
@@ -78,7 +81,7 @@ public class OAuthModule extends AbstractModule {
       // bit before the deadline to make sure there aren't session expiration exceptions
       sessionIntervalInSeconds = sessionIntervalInSeconds > 30 ? sessionIntervalInSeconds - 30 :
               sessionIntervalInSeconds;
-      return CacheBuilder.newBuilder().expireAfterWrite(sessionIntervalInSeconds, TimeUnit.MINUTES).build(CacheLoader
+      return CacheBuilder.newBuilder().expireAfterWrite(sessionIntervalInSeconds, TimeUnit.SECONDS).build(CacheLoader
               .from(getAccess));
    }