From 8d72adc52e887b84b2e37d165dfb7a445dc9d7f0 Mon Sep 17 00:00:00 2001 From: Binary Wang Date: Tue, 23 Aug 2016 23:32:48 +0800 Subject: [PATCH] fix javadoc error --- .../weixin/cp/api/WxCpJedisConfigStorage.java | 45 +++++++++---------- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpJedisConfigStorage.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpJedisConfigStorage.java index 2c8e8bb6..8d3b6bbd 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpJedisConfigStorage.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpJedisConfigStorage.java @@ -9,7 +9,7 @@ import redis.clients.jedis.JedisPool; /** * Jedis client implementor for wechat config storage - * + * * @author gaigeshen */ public class WxCpJedisConfigStorage implements WxCpConfigStorage { @@ -41,42 +41,37 @@ public class WxCpJedisConfigStorage implements WxCpConfigStorage { /* Redis clients pool */ private final JedisPool jedisPool; - /** - * - * - * @param jedis - */ public WxCpJedisConfigStorage(String host, int port) { this.jedisPool = new JedisPool(host, port); } - + /** - * + * * This method will be destroy jedis pool */ public void destroy() { this.jedisPool.destroy(); } - + @Override public String getAccessToken() { try (Jedis jedis = this.jedisPool.getResource()) { return jedis.get(ACCESS_TOKEN_KEY); } } - + @Override public boolean isAccessTokenExpired() { try (Jedis jedis = this.jedisPool.getResource()) { String expiresTimeStr = jedis.get(ACCESS_TOKEN_EXPIRES_TIME_KEY); - + if (expiresTimeStr != null) { Long expiresTime = Long.parseLong(expiresTimeStr); return System.currentTimeMillis() > expiresTime; } - + return true; - + } } @@ -96,7 +91,7 @@ public class WxCpJedisConfigStorage implements WxCpConfigStorage { public synchronized void updateAccessToken(String accessToken, int expiresInSeconds) { try (Jedis jedis = this.jedisPool.getResource()) { jedis.set(ACCESS_TOKEN_KEY, accessToken); - + jedis.set(ACCESS_TOKEN_EXPIRES_TIME_KEY, (System.currentTimeMillis() + (expiresInSeconds - 200) * 1000L) + ""); } @@ -111,17 +106,17 @@ public class WxCpJedisConfigStorage implements WxCpConfigStorage { @Override public boolean isJsapiTicketExpired() { - + try (Jedis jedis = this.jedisPool.getResource()) { String expiresTimeStr = jedis.get(JS_API_TICKET_EXPIRES_TIME_KEY); - + if (expiresTimeStr != null) { Long expiresTime = Long.parseLong(expiresTimeStr); return System.currentTimeMillis() > expiresTime; } - + return true; - + } } @@ -134,14 +129,14 @@ public class WxCpJedisConfigStorage implements WxCpConfigStorage { @Override public synchronized void updateJsapiTicket(String jsapiTicket, int expiresInSeconds) { - + try (Jedis jedis = this.jedisPool.getResource()) { jedis.set(JS_API_TICKET_KEY, jsapiTicket); - + jedis.set(JS_API_TICKET_EXPIRES_TIME_KEY, (System.currentTimeMillis() + (expiresInSeconds - 200) * 1000L + "")); } - + } @Override @@ -173,14 +168,14 @@ public class WxCpJedisConfigStorage implements WxCpConfigStorage { public long getExpiresTime() { try (Jedis jedis = this.jedisPool.getResource()) { String expiresTimeStr = jedis.get(ACCESS_TOKEN_EXPIRES_TIME_KEY); - + if (expiresTimeStr != null) { Long expiresTime = Long.parseLong(expiresTimeStr); return expiresTime; } - + return 0L; - + } } @@ -240,7 +235,7 @@ public class WxCpJedisConfigStorage implements WxCpConfigStorage { } // ============================ Setters below - + public void setOauth2redirectUri(String oauth2redirectUri) { this.oauth2redirectUri = oauth2redirectUri; }