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 |
protected com.atlassian.util.concurrent.ResettableLazyReference<Object> |
bean
|
protected org.springframework.beans.factory.FactoryBean |
factoryBean
|
protected com.atlassian.util.concurrent.ResettableLazyReference<Object> |
proxyReference
|
Constructor Summary |
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 |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
bean
protected final com.atlassian.util.concurrent.ResettableLazyReference<Object> bean
factoryBean
protected volatile org.springframework.beans.factory.FactoryBean factoryBean
proxyReference
protected final com.atlassian.util.concurrent.ResettableLazyReference<Object> proxyReference
ReloadableBeanFactoryImpl
public 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
- Parameters:
cls
- factory bean classargs
- constructor arguments to create factory bean
getObject
public Object getObject()
throws Exception
- Specified by:
getObject
in interface org.springframework.beans.factory.FactoryBean
- Throws:
Exception
getObjectType
public Class getObjectType()
- Specified by:
getObjectType
in interface org.springframework.beans.factory.FactoryBean
isSingleton
public boolean isSingleton()
- Specified by:
isSingleton
in interface org.springframework.beans.factory.FactoryBean
reset
public void reset()
- Specified by:
reset
in interface Resettable
Copyright © 2015 Atlassian Software Systems Pty Ltd. All rights reserved.