public class ThreadLocalFeatureManagerProvider extends Object implements FeatureManagerProvider
FeatureManagerProvider
allows to store the FeatureManager
in a ThreadLocal
for
the current thread.
Please note that it is very important to cleanup the ThreadLocal
by calling release()
before the thread is
put back into a thread pool.Weighted.WeightedComparator
Constructor and Description |
---|
ThreadLocalFeatureManagerProvider() |
Modifier and Type | Method and Description |
---|---|
static void |
bind(FeatureManager featureManager)
Store the supplied
FeatureManager in the thread context. |
FeatureManager |
getFeatureManager() |
int |
priority()
Low priorities are processed first.
|
static void |
release()
Removes the
FeatureManager associated with the current thread from the thread's context. |
public static void bind(FeatureManager featureManager)
FeatureManager
in the thread context. After calling this method all calls of
getFeatureManager()
from the active thread will return this feature manager. Please don't forget to call
release()
before the thread is put back to a thread pool to prevent memory leaks.featureManager
- The FeatureManager
to storepublic static void release()
FeatureManager
associated with the current thread from the thread's context. It's required to always
call this method before a thread is put back to a thread pool.public int priority()
Weighted
public FeatureManager getFeatureManager()
getFeatureManager
in interface FeatureManagerProvider
Copyright © 2015. All Rights Reserved.