Package com.saperion.ws.pool
Class PoolKeyHolder
- java.lang.Object
-
- com.saperion.ws.pool.PoolKeyHolder
-
public final class PoolKeyHolder extends java.lang.Object
The Class PoolKeyHolder is used to store a map of tokens to TokenOrCredentialKey (which is referred to as a session). In addition, a timeout is maintained for each session. If the timeout is reached, the session will be removed from the map.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PoolKeyHolder.Session
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
add(java.lang.String token, com.lexmark.saperion.remote.common.authentication.Credentials key)
Stores the given TokenOrCredentialKey.static PoolKeyHolder.Session
get(java.lang.String token)
Gets the TokenOrCredentialKey by the given token.static void
initSessionCleaner(java.util.Properties properties)
static void
logStatistic()
Logs the current content of the token map to the logger using DEBUG level.static void
remove(java.lang.String token)
Removes the key by the given token.static void
stopSessionCleaner()
-
-
-
Method Detail
-
initSessionCleaner
public static void initSessionCleaner(java.util.Properties properties) throws java.lang.Exception
- Throws:
java.lang.Exception
-
stopSessionCleaner
public static void stopSessionCleaner()
-
add
public static java.lang.String add(java.lang.String token, com.lexmark.saperion.remote.common.authentication.Credentials key)
Stores the given TokenOrCredentialKey. If the given token is already contained in the underlying map, a new token is created. The actual stored token is returned.- Parameters:
token
- the token to identify the given key.key
- the key to store.- Returns:
-
get
public static PoolKeyHolder.Session get(java.lang.String token)
Gets the TokenOrCredentialKey by the given token.- Parameters:
token
- the token to get the key for.- Returns:
- the TokenOrCredentialKey by the given token.
-
remove
public static void remove(java.lang.String token)
Removes the key by the given token.- Parameters:
token
- the token to remove the key for.
-
logStatistic
public static void logStatistic()
Logs the current content of the token map to the logger using DEBUG level.
-
-