public class Sessions
extends java.lang.Object
| Constructor and Description |
|---|
Sessions() |
| Modifier and Type | Method and Description |
|---|---|
void |
cleanupExpired()
Cleanup the sessions whose lifetime has expired
|
java.util.List<SessionFuture<?>> |
executeTask(java.util.concurrent.ExecutorService executor,
java.util.function.Predicate<BearerTokenWithPayload> filter,
java.util.function.Consumer<BearerTokenWithPayload> task)
Iterate over all active sessions (represented by stored token objects) applying a filter and submit a task to the passed executor for each passing token.
|
<T> java.util.List<T> |
map(java.util.function.Function<BearerTokenWithPayload,T> mapper)
Get a list of objects retrieved by applying the passed mapping function to the current active sessions set.
|
void |
put(BearerTokenWithPayload token)
Put a new token object into sessions cache
|
void |
remove(BearerTokenWithPayload token)
Remove a token from sessions cache
|
void |
removeAllWithMatchingAccessToken(java.lang.String accessToken)
Remove all the active sessions for the passed access token
|
public void put(BearerTokenWithPayload token)
token - A token to addpublic void remove(BearerTokenWithPayload token)
token - A token to removepublic void removeAllWithMatchingAccessToken(java.lang.String accessToken)
accessToken - access token for which to remove the sessionspublic java.util.List<SessionFuture<?>> executeTask(java.util.concurrent.ExecutorService executor, java.util.function.Predicate<BearerTokenWithPayload> filter, java.util.function.Consumer<BearerTokenWithPayload> task)
SessionFuture instances.executor - An Executor to use for submitting tasksfilter - A filter to decide if the task should be submitted for specific tokentask - Logic to run on the tokenpublic void cleanupExpired()
public <T> java.util.List<T> map(java.util.function.Function<BearerTokenWithPayload,T> mapper)
For example, you can get a list of all the princiapl names.
T - A return typemapper - A mapping functionCopyright © 2024. All rights reserved.