Interface BeanFactoryReference
- All Known Implementing Classes:
ContextBeanFactoryReference
public interface BeanFactoryReference
Used to track a reference to aBeanFactory
obtained through aBeanFactoryLocator
.It is safe to call
release()
multiple times, butgetFactory()
must not be called after calling release.- Author:
- Colin Sampaleanu
- See Also:
BeanFactoryLocator
,ContextBeanFactoryReference
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description BeanFactory
getFactory()
Return theBeanFactory
instance held by this reference.void
release()
Indicate that theBeanFactory
instance referred to by this object is not needed any longer by the client code which obtained theBeanFactoryReference
.
Method Detail
getFactory
BeanFactory getFactory()
Return theBeanFactory
instance held by this reference.- Throws:
IllegalStateException
- if invoked afterrelease()
has been called
release
void release()
Indicate that theBeanFactory
instance referred to by this object is not needed any longer by the client code which obtained theBeanFactoryReference
.Depending on the actual implementation of
BeanFactoryLocator
, and the actual type ofBeanFactory
, this may possibly not actually do anything; alternately in the case of a 'closeable'BeanFactory
or derived class (such asApplicationContext
) may 'close' it, or may 'close' it once no more references remain.In an EJB usage scenario this would normally be called from
ejbRemove()
andejbPassivate()
.This is safe to call multiple times.