Class TokenCache


  • public class TokenCache
    extends Object
    Token Cache Implementation Tokens will be invalidate after a interval of TOKEN_CACHE_TIMEOUT minutes
    • Method Detail

      • getInstance

        public static TokenCache getInstance()
        Get TokenCache Instance
        Returns:
        TokenCache
      • getToken

        public String getToken​(String id,
                               Callable<String> callable)
                        throws ExecutionException
        This method returns the value in the cache, or computes it from the specified Callable
        Parameters:
        id - id of the oauth handler
        callable - to generate a new token by calling oauth server
        Returns:
        Token object
        Throws:
        ExecutionException
      • removeToken

        public void removeToken​(String id)
        This method is called to remove the token from the cache when the endpoint is destroyed
        Parameters:
        id - id of the endpoint