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.
|
BearerTokenWithPayload |
findFirst(java.util.function.Predicate<BearerTokenWithPayload> filter)
Iterate over sessions, and find the first element matching the filter.
|
void |
put(BearerTokenWithPayload token)
Put a new token object into sessions cache
|
void |
remove(BearerTokenWithPayload token)
Remove a token from sessions cache
|
public void put(BearerTokenWithPayload token)
token - A token to addpublic void remove(BearerTokenWithPayload token)
token - A token to removepublic 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 BearerTokenWithPayload findFirst(java.util.function.Predicate<BearerTokenWithPayload> filter)
filter - A filter to applyCopyright © 2023. All rights reserved.