Package com.atlassian.bamboo.osgi
Class ReloadableBeanFactoryImpl
java.lang.Object
com.atlassian.bamboo.osgi.ReloadableBeanFactoryImpl
- All Implemented Interfaces:
Resettable
,org.springframework.beans.factory.FactoryBean
public class ReloadableBeanFactoryImpl
extends Object
implements Resettable, org.springframework.beans.factory.FactoryBean
This factory wraps a FactoryBean delegate. Instead of returning the produced object directly, it wraps that object in
a proxy. Under normal circumstances, this will be transparent to the user and the class will behave like a regular
FactoryBean (and the returned object like a regular object).
The difference is that the proxies returned from this factory can be made to point to a different object, freshly retrieved from the FactoryBean. This lets us reload OSGi services without touching existing references to old services in Spring beans that are already wired.
If factory is created using ReloadableBeanFactoryImpl(Class, Object...)
constructor, the new bean will be retrieved from a new FactoryBean object (it's the recommended way of using this
class, because it will deal with stateful FactoryBeans).
ReloadableBeanFactoriesImpl
bean processor automatically registers all instances of Resettable
and will call reload on each of them when asked. This happens during hotswap import.
-
Field Summary
Modifier and TypeFieldDescriptionprotected final io.atlassian.util.concurrent.ResettableLazyReference<Object>
protected org.springframework.beans.factory.FactoryBean
protected final io.atlassian.util.concurrent.ResettableLazyReference<Object>
Fields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTE
-
Constructor Summary
ConstructorDescriptionReloadableBeanFactoryImpl
(Class<?> cls, Object... args) Use this one to be able to reload bean and factory that will be created from class constructor with provided arguments -
Method Summary
-
Field Details
-
bean
-
factoryBean
protected volatile org.springframework.beans.factory.FactoryBean factoryBean -
proxyReference
-
-
Constructor Details
-
ReloadableBeanFactoryImpl
Use this one to be able to reload bean and factory that will be created from class constructor with provided arguments- Parameters:
cls
- factory bean classargs
- constructor arguments to create factory bean
-
-
Method Details
-
getObject
- Specified by:
getObject
in interfaceorg.springframework.beans.factory.FactoryBean
- Throws:
Exception
-
getObjectType
- Specified by:
getObjectType
in interfaceorg.springframework.beans.factory.FactoryBean
-
isSingleton
public boolean isSingleton()- Specified by:
isSingleton
in interfaceorg.springframework.beans.factory.FactoryBean
-
reset
public void reset()- Specified by:
reset
in interfaceResettable
-