DisposableBean and Runnable
interfaces performing various destruction steps on a given bean instance:
AbstractBeanFactory, org.springframework.beans.factory.DisposableBean , org.springframework.beans.factory.config.DestructionAwareBeanPostProcessor , AbstractBeanDefinition#getDestroyMethodNames()
| Modifier and Type | Class and Description |
|---|---|
| private class | DisposableBeanAdapter.DestroyMethodSubscriber
Reactive Streams Subscriber for destroy method completion. |
| private class | DisposableBeanAdapter.ReactiveDestroyMethodHandler
Inner class to avoid a hard dependency on the Reactive Streams API at runtime. |
| Modifier and Type | Field and Description |
|---|---|
| private final Object | |
| private final String | |
| private final List | |
| private static final String | |
| private static final String | |
| private String[] | |
| private transient Method[] | |
| private boolean | |
| private final boolean | |
| private static final Log | |
| private final boolean | |
| private static final boolean | |
| private static final String |
| Access | Constructor and Description |
|---|---|
| public | DisposableBeanAdapter(Object
the bean instance (never bean, String null)the name of the bean beanName, RootBeanDefinition the merged bean definition beanDefinition, List<DestructionAwareBeanPostProcessor> the List of BeanPostProcessors
(potentially DestructionAwareBeanPostProcessor), if any postProcessors)Create a new DisposableBeanAdapter for the given bean. |
| public | DisposableBeanAdapter(Object
the bean instance (never bean, List<DestructionAwareBeanPostProcessor> null)the List of BeanPostProcessors
(potentially DestructionAwareBeanPostProcessor), if any postProcessors)Create a new DisposableBeanAdapter for the given bean. |
| private | DisposableBeanAdapter(Object bean, String beanName, boolean nonPublicAccessAllowed, boolean invokeDisposableBean, boolean invokeAutoCloseable, String[] destroyMethodNames, List<DestructionAwareBeanPostProcessor> postProcessors)
Create a new DisposableBeanAdapter for the given bean. |
| Modifier and Type | Method and Description |
|---|---|
| public void | destroy()
Implements org. BeanFactory on destruction of a bean.
|
| private Method | |
| private static List | Returns: the filtered List of DestructionAwareBeanPostProcessorsthe List to search processors, Object bean)Search for all DestructionAwareBeanPostProcessors in the List. |
| private Method | |
| public static boolean | hasApplicableProcessors(Object
the bean instance bean, List<DestructionAwareBeanPostProcessor> the post-processor candidates postProcessors)Check whether the given bean has destruction-aware post-processors applying to it. |
| public static boolean | hasDestroyMethod(Object
the bean instance bean, RootBeanDefinition the corresponding bean definition beanDefinition)Check whether the given bean has any kind of destroy method to call. |
| pack-priv static String[] | inferDestroyMethodsIfNecessary(Class<?> target, RootBeanDefinition beanDefinition)
If the current value of the given beanDefinition's "destroyMethodName" property is
|
| private void | invokeCustomDestroyMethod(Method destroyMethod)
Invoke the specified custom destroy method on the given bean. |
| pack-priv void | |
| pack-priv void | |
| public void | |
| protected Object | writeReplace()
Serializes a copy of the state of this class, filtering out non-serializable BeanPostProcessors. |
| bean | back to summary |
|---|---|
| private final Object bean | |
| beanName | back to summary |
|---|---|
| private final String beanName | |
| beanPostProcessors | back to summary |
|---|---|
| private final List<DestructionAwareBeanPostProcessor> beanPostProcessors
| |
| CLOSE_METHOD_NAME | back to summary |
|---|---|
| private static final String CLOSE_METHOD_NAME | |
| DESTROY_METHOD_NAME | back to summary |
|---|---|
| private static final String DESTROY_METHOD_NAME | |
| destroyMethodNames | back to summary |
|---|---|
| private String[] destroyMethodNames
| |
| destroyMethods | back to summary |
|---|---|
| private transient Method[] destroyMethods
| |
| invokeAutoCloseable | back to summary |
|---|---|
| private boolean invokeAutoCloseable | |
| invokeDisposableBean | back to summary |
|---|---|
| private final boolean invokeDisposableBean | |
| logger | back to summary |
|---|---|
| private static final Log logger | |
| nonPublicAccessAllowed | back to summary |
|---|---|
| private final boolean nonPublicAccessAllowed | |
| reactiveStreamsPresent | back to summary |
|---|---|
| private static final boolean reactiveStreamsPresent | |
| SHUTDOWN_METHOD_NAME | back to summary |
|---|---|
| private static final String SHUTDOWN_METHOD_NAME | |
| DisposableBeanAdapter | back to summary |
|---|---|
| public DisposableBeanAdapter(Object bean, String beanName, RootBeanDefinition beanDefinition, List<DestructionAwareBeanPostProcessor> postProcessors) Create a new DisposableBeanAdapter for the given bean.
| |
| DisposableBeanAdapter | back to summary |
|---|---|
| public DisposableBeanAdapter(Object bean, List<DestructionAwareBeanPostProcessor> postProcessors) Create a new DisposableBeanAdapter for the given bean.
| |
| DisposableBeanAdapter | back to summary |
|---|---|
| private DisposableBeanAdapter(Object bean, String beanName, boolean nonPublicAccessAllowed, boolean invokeDisposableBean, boolean invokeAutoCloseable, String[] destroyMethodNames, List<DestructionAwareBeanPostProcessor> postProcessors) Create a new DisposableBeanAdapter for the given bean. | |
| destroy | back to summary |
|---|---|
| public void destroy() Implements org. Doc from org. Invoked by the containing
| |
| determineDestroyMethod | back to summary |
|---|---|
private Method determineDestroyMethod(String destroyMethodName)
| |
| filterPostProcessors | back to summary |
|---|---|
| private static List Search for all DestructionAwareBeanPostProcessors in the List.
| |
| findDestroyMethod | back to summary |
|---|---|
private Method findDestroyMethod(Class<?> clazz, String name)
| |
| hasApplicableProcessors | back to summary |
|---|---|
| public static boolean hasApplicableProcessors(Object bean, List<DestructionAwareBeanPostProcessor> postProcessors) Check whether the given bean has destruction-aware post-processors applying to it.
| |
| hasDestroyMethod | back to summary |
|---|---|
| public static boolean hasDestroyMethod(Object bean, RootBeanDefinition beanDefinition) Check whether the given bean has any kind of destroy method to call.
| |
| inferDestroyMethodsIfNecessary | back to summary |
|---|---|
| pack-priv static String[] inferDestroyMethodsIfNecessary(Class<?> target, RootBeanDefinition beanDefinition) If the current value of the given beanDefinition's "destroyMethodName" property is
Also processes the
| |
| invokeCustomDestroyMethod | back to summary |
|---|---|
| private void invokeCustomDestroyMethod(Method destroyMethod) Invoke the specified custom destroy method on the given bean. This implementation invokes a no-arg method if found, else checking for a method with a single boolean argument (passing in "true", assuming a "force" parameter), else logging an error. | |
| logDestroyMethodCompletion | back to summary |
|---|---|
| pack-priv void logDestroyMethodCompletion(Method destroyMethod, boolean async) | |
| logDestroyMethodException | back to summary |
|---|---|
| pack-priv void logDestroyMethodException(Method destroyMethod, Throwable ex) | |
| run | back to summary |
|---|---|
| public void run() Implements java. Doc from java. Runs this operation.
| |
| writeReplace | back to summary |
|---|---|
| protected Object writeReplace() Serializes a copy of the state of this class, filtering out non-serializable BeanPostProcessors. | |
| Modifier and Type | Field and Description |
|---|---|
| private final Method | |
| private final CountDownLatch |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | onError(Throwable
the throwable signaled t)Implements org. |
| public void | onNext(Object
the element signaled o)Implements org. Publisher in response to requests to Subscription#request(long).
|
| public void | onSubscribe(Subscription
the s)Subscription that allows requesting data via Subscription#request(long)Implements org. Publisher#subscribe(Subscriber).
|
| destroyMethod | back to summary |
|---|---|
| private final Method destroyMethod | |
| latch | back to summary |
|---|---|
| private final CountDownLatch latch | |
| DestroyMethodSubscriber | back to summary |
|---|---|
| public DestroyMethodSubscriber(Method destroyMethod, CountDownLatch latch) | |
| onComplete | back to summary |
|---|---|
| public void onComplete() Implements org. Doc from org. Successful terminal state.
No further events will be sent even if
| |
| onError | back to summary |
|---|---|
| public void onError(Throwable t) Implements org. Doc from org. Failed terminal state.
No further events will be sent even if | |
| onNext | back to summary |
|---|---|
| public void onNext(Object o) Implements org. Doc from org. Data notification sent by the | |
| onSubscribe | back to summary |
|---|---|
| public void onSubscribe(Subscription s) Implements org. Doc from org. Invoked after calling
No data will start flowing until
It is the responsibility of this
The
| |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public boolean |
| ReactiveDestroyMethodHandler | back to summary |
|---|---|
| private ReactiveDestroyMethodHandler() | |
| await | back to summary |
|---|---|
| public boolean await(Method destroyMethod, Object returnValue) throws InterruptedException | |