public class DefaultThreadPoolPluginManager extends Object implements ThreadPoolPluginManager
The default implementation of ThreadPoolPluginManager.
Provide basic ThreadPoolPlugin registration, logout and acquisition functions.
Most APIs ensure limited thread-safe.
Usually registered to ExtensibleThreadPoolExecutor,
or bound to an ThreadPoolExecutor instance through ThreadPoolPluginSupport
to support its plugin based extension functions.
NOTE:
When the list of plugins is obtained through the getXXX method of manager, the list is not immutable.
This means that until actually start iterating over the list,
registering or unregistering plugins through the manager will affect the results of the iteration.
Therefore, we should try to ensure that get the latest plugin list from the manager before each use.
| 构造器和说明 |
|---|
DefaultThreadPoolPluginManager() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
clear()
Clear all.
|
Collection<ThreadPoolPlugin> |
getAllPlugins()
Get all registered plugins.
|
Collection<ExecuteAwarePlugin> |
getExecuteAwarePluginList()
Get execute plugin list.
|
<A extends ThreadPoolPlugin> |
getPlugin(String pluginId)
Get
ThreadPoolPlugin. |
Collection<RejectedAwarePlugin> |
getRejectedAwarePluginList()
Get rejected plugin list.
|
Collection<ShutdownAwarePlugin> |
getShutdownAwarePluginList()
Get shutdown plugin list.
|
Collection<TaskAwarePlugin> |
getTaskAwarePluginList()
Get shutdown plugin list.
|
boolean |
isRegistered(String pluginId)
Whether the
ThreadPoolPlugin has been registered. |
void |
register(@NonNull ThreadPoolPlugin plugin)
Register a
ThreadPoolPlugin |
boolean |
tryRegister(ThreadPoolPlugin plugin)
Register plugin if it's not registered.
|
void |
unregister(String pluginId)
Unregister
ThreadPoolPlugin |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitempty, getAllPluginRuntimes, getAllPluginsOfType, getPluginOfType, getRuntimepublic void clear()
clear 在接口中 ThreadPoolPluginManagerpublic void register(@NonNull
@NonNull ThreadPoolPlugin plugin)
ThreadPoolPluginregister 在接口中 ThreadPoolPluginManagerplugin - pluginIllegalArgumentException - thrown when a plugin with the same ThreadPoolPlugin.getId() already exists in the registryThreadPoolPlugin.getId()public boolean tryRegister(ThreadPoolPlugin plugin)
tryRegister 在接口中 ThreadPoolPluginManagerplugin - pluginpublic void unregister(String pluginId)
ThreadPoolPluginunregister 在接口中 ThreadPoolPluginManagerpluginId - plugin idpublic Collection<ThreadPoolPlugin> getAllPlugins()
getAllPlugins 在接口中 ThreadPoolPluginManagerpublic boolean isRegistered(String pluginId)
ThreadPoolPlugin has been registered.isRegistered 在接口中 ThreadPoolPluginManagerpluginId - plugin idpublic <A extends ThreadPoolPlugin> Optional<A> getPlugin(String pluginId)
ThreadPoolPlugin.getPlugin 在接口中 ThreadPoolPluginManagerA - plugin typepluginId - plugin idThreadPoolPlugin, null if unregisterpublic Collection<ExecuteAwarePlugin> getExecuteAwarePluginList()
public Collection<RejectedAwarePlugin> getRejectedAwarePluginList()
public Collection<ShutdownAwarePlugin> getShutdownAwarePluginList()
public Collection<TaskAwarePlugin> getTaskAwarePluginList()
getTaskAwarePluginList 在接口中 ThreadPoolPluginManagerShutdownAwarePluginCopyright © 2022. All rights reserved.