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 ofResettable
and will call reload on each of them when asked. This happens during hotswap import.
-
-
Field Summary
Fields Modifier and Type Field Description protected io.atlassian.util.concurrent.ResettableLazyReference<Object>
bean
protected org.springframework.beans.factory.FactoryBean
factoryBean
protected io.atlassian.util.concurrent.ResettableLazyReference<Object>
proxyReference
-
Constructor Summary
Constructors Constructor Description ReloadableBeanFactoryImpl(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
getObject()
Class
getObjectType()
boolean
isSingleton()
void
reset()
-
-
-
Method Detail
-
getObject
public Object getObject() throws Exception
- Specified by:
getObject
in interfaceorg.springframework.beans.factory.FactoryBean
- Throws:
Exception
-
getObjectType
public Class 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
-
-