From 8e68e44e01d27f305b0a60a8cc847f20ab29a655 Mon Sep 17 00:00:00 2001 From: Alex Heneveld Date: Mon, 11 Nov 2013 14:44:27 +0000 Subject: [PATCH] JCLOUDS-372: changing OAuth timeout from MINUTES to SECONDS --- oauth/src/main/java/org/jclouds/oauth/v2/config/OAuthModule.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/oauth/src/main/java/org/jclouds/oauth/v2/config/OAuthModule.java b/oauth/src/main/java/org/jclouds/oauth/v2/config/OAuthModule.java index 11c33bf..cc99444 100644 --- a/oauth/src/main/java/org/jclouds/oauth/v2/config/OAuthModule.java +++ b/oauth/src/main/java/org/jclouds/oauth/v2/config/OAuthModule.java @@ -66,9 +66,12 @@ protected void configure() { } /** - * 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 provideAccessCache(Function getAccess, @@ -78,7 +81,7 @@ protected void configure() { // 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)); } -- 1.8.4