Package ubic.gemma.core.context
Interface AsyncFactoryBean<T>
- All Superinterfaces:
org.springframework.beans.factory.FactoryBean<Future<T>>
- All Known Implementing Classes:
AbstractAsyncFactoryBean,OpenApiFactory
public interface AsyncFactoryBean<T>
extends org.springframework.beans.factory.FactoryBean<Future<T>>
Async extension of the
FactoryBean interface.
Limitation:
All beans created by this factory expose the same Future object type, so a Qualifier must be used to
resolve a particular one.
Attempting to inject a List<Future<MyService>> will produce unexpected types in the collections if you have
defined other subclasses of AsyncFactoryBean for other bean types, there is unfortunately no direct
replacement for this, and you will have to filter the beans by type manually by calling BeanFactory.getBean(Class)
with the class of Future.
- Author:
- poirigui
-
Method Summary
Modifier and TypeMethodDescriptionObtain a bean asynchronously.booleanIndicate if this bean has been initialized or if its initialization is pending.static <T> AsyncFactoryBean<T> Factory method to create an async singleton bean with a single-thread executor.Methods inherited from interface org.springframework.beans.factory.FactoryBean
getObjectType, isSingleton
-
Method Details
-
singleton
Factory method to create an async singleton bean with a single-thread executor. -
getObject
Obtain a bean asynchronously.- Specified by:
getObjectin interfaceorg.springframework.beans.factory.FactoryBean<T>- Returns:
- a future that completes when the bean is ready
-
isInitialized
boolean isInitialized()Indicate if this bean has been initialized or if its initialization is pending.This is only meaningful if
FactoryBean.isSingleton()is true as otherwise a new, yet to be initialized bean will be returned everytime and this method will always return false.
-