public class StandardBeanLifecycleDecorator extends Object implements BeanLifecycleDecorator<ReadWriteLock>
BeanLifecycleDecorator
that tries to protect against concurrent access to a bean during its own destruction.
A read-write lock is used, and method access is protected using the read lock, while the destruction callback is
protected more strictly with the write lock. In this way concurrent access is possible to the bean as long as it is
not being destroyed, in which case only one thread has access. If the bean has no destruction callback the lock and
associated proxies are never created.BeanLifecycleDecorator.Context<T>
Constructor and Description |
---|
StandardBeanLifecycleDecorator(boolean proxyTargetClass) |
Modifier and Type | Method and Description |
---|---|
Object |
decorateBean(Object bean,
BeanLifecycleDecorator.Context<ReadWriteLock> context)
Optionally decorate and provide a new instance of a compatible bean for
the caller to use instead of the input.
|
BeanLifecycleDecorator.Context<ReadWriteLock> |
decorateDestructionCallback(Runnable callback)
Optionally decorate the destruction callback provided, and also return
some context that can be used later by the
BeanLifecycleDecorator.decorateBean(Object, Context) method. |
public StandardBeanLifecycleDecorator(boolean proxyTargetClass)
public Object decorateBean(Object bean, BeanLifecycleDecorator.Context<ReadWriteLock> context)
BeanLifecycleDecorator
decorateBean
in interface BeanLifecycleDecorator<ReadWriteLock>
bean
- the bean to optionally decoratecontext
- the context as created by
BeanLifecycleDecorator.decorateDestructionCallback(Runnable)
public BeanLifecycleDecorator.Context<ReadWriteLock> decorateDestructionCallback(Runnable callback)
BeanLifecycleDecorator
BeanLifecycleDecorator.decorateBean(Object, Context)
method.decorateDestructionCallback
in interface BeanLifecycleDecorator<ReadWriteLock>
callback
- the destruction callback that will be used by the containerCopyright © 2016 Pivotal Software, Inc.. All rights reserved.