Java Doc for DefaultSingletonBeanRegistry.java in  » J2EE » spring-framework-2.0.6 » org » springframework » beans » factory » support » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » spring framework 2.0.6 » org.springframework.beans.factory.support 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.springframework.beans.factory.support.DefaultSingletonBeanRegistry

All known Subclasses:   org.springframework.beans.factory.support.AbstractBeanFactory,
DefaultSingletonBeanRegistry
public class DefaultSingletonBeanRegistry implements SingletonBeanRegistry(Code)
Generic registry for shared bean instances, implementing the org.springframework.beans.factory.config.SingletonBeanRegistry . Allows for registering singleton instances that should be shared for all callers of the registry, to be obtained via bean name.

Also supports registration of org.springframework.beans.factory.DisposableBean instances, (which might or might not correspond to registered singletons), to be destroyed on shutdown of the registry. Dependencies between beans can be registered to enforce an appropriate shutdown order.

This class mainly serves as base class for org.springframework.beans.factory.BeanFactory implementations, factoring out the common management of singleton bean instances. Note that the org.springframework.beans.factory.config.ConfigurableBeanFactory interface extends the SingletonBeanRegistry interface.

Note that this class assumes neither a bean definition concept nor a specific creation process for bean instances, in contrast to AbstractBeanFactory and DefaultListableBeanFactory (which inherit from it). Can alternatively also be used as a nested helper to delegate to.
author:
   Juergen Hoeller
since:
   2.0
See Also:   DefaultSingletonBeanRegistry.registerSingleton
See Also:   DefaultSingletonBeanRegistry.registerDisposableBean
See Also:   org.springframework.beans.factory.DisposableBean
See Also:   org.springframework.beans.factory.config.ConfigurableBeanFactory



Field Summary
final protected  Loglogger
    


Method Summary
protected  voidaddSingleton(String beanName, Object singletonObject)
     Add the given singleton object to the singleton cache of this factory.

To be called for eager registration of singletons, e.g.

protected  voidafterSingletonCreation(String beanName)
     Callback after singleton creation.
protected  voidbeforeSingletonCreation(String beanName)
     Callback before singleton creation.
public  booleancontainsSingleton(String beanName)
    
protected  voiddestroyBean(String beanName, DisposableBean bean)
     Destroy the given bean.
public  voiddestroySingleton(String beanName)
     Destroy the given bean.
public  voiddestroySingletons()
    
protected  SetgetDependentBeans(String beanName)
     Return whether a dependent bean has been registered under the given name.
public  ObjectgetSingleton(String beanName)
    
public  ObjectgetSingleton(String beanName, ObjectFactory singletonFactory)
     Return the (raw) singleton object registered under the given name, creating and registering a new one if none registered yet.
public  intgetSingletonCount()
    
final protected  ObjectgetSingletonMutex()
     Expose the singleton mutex to subclasses.

Subclasses should synchronize on the given Object if they perform any sort of extended singleton creation phase.

public  String[]getSingletonNames()
    
protected  booleanhasDependentBean(String beanName)
     Return whether a dependent bean has been registered under the given name.
final public  booleanisSingletonCurrentlyInCreation(String beanName)
     Return whether the specified singleton bean is currently in creation (within the entire factory).
public  voidregisterDependentBean(String beanName, String dependentBeanName)
     Register a dependent bean for the given bean, to be destroyed before the given bean is destroyed.
public  voidregisterDisposableBean(String beanName, DisposableBean bean)
     Add the given bean to the list of disposable beans in this registry.
public  voidregisterSingleton(String beanName, Object singletonObject)
    
protected  voidremoveSingleton(String beanName)
     Remove the bean with the given name from the singleton cache of this factory.

Field Detail
logger
final protected Log logger(Code)
Logger available to subclasses





Method Detail
addSingleton
protected void addSingleton(String beanName, Object singletonObject)(Code)
Add the given singleton object to the singleton cache of this factory.

To be called for eager registration of singletons, e.g. to be able to resolve circular references.
Parameters:
  beanName - the name of the bean
Parameters:
  singletonObject - the singleton object




afterSingletonCreation
protected void afterSingletonCreation(String beanName)(Code)
Callback after singleton creation.

Default implementation marks the singleton as not in creation anymore.
Parameters:
  beanName - the name of the singleton that has been created
See Also:   DefaultSingletonBeanRegistry.isSingletonCurrentlyInCreation




beforeSingletonCreation
protected void beforeSingletonCreation(String beanName)(Code)
Callback before singleton creation.

Default implementation register the singleton as currently in creation.
Parameters:
  beanName - the name of the singleton about to be created
See Also:   DefaultSingletonBeanRegistry.isSingletonCurrentlyInCreation




containsSingleton
public boolean containsSingleton(String beanName)(Code)



destroyBean
protected void destroyBean(String beanName, DisposableBean bean)(Code)
Destroy the given bean. Must destroy beans that depend on the given bean before the bean itself. Should not throw any exceptions.
Parameters:
  beanName - the name of the bean
Parameters:
  bean - the bean instance to destroy



destroySingleton
public void destroySingleton(String beanName)(Code)
Destroy the given bean. Delegates to destroyBean if a corresponding disposable bean instance is found.
Parameters:
  beanName - the name of the bean
See Also:   DefaultSingletonBeanRegistry.destroyBean



destroySingletons
public void destroySingletons()(Code)



getDependentBeans
protected Set getDependentBeans(String beanName)(Code)
Return whether a dependent bean has been registered under the given name.
Parameters:
  beanName - the name of the bean an unmodifiable Set of dependent bean names (as Strings)



getSingleton
public Object getSingleton(String beanName)(Code)



getSingleton
public Object getSingleton(String beanName, ObjectFactory singletonFactory)(Code)
Return the (raw) singleton object registered under the given name, creating and registering a new one if none registered yet.
Parameters:
  beanName - the name of the bean
Parameters:
  singletonFactory - the ObjectFactory to lazily create the singletonwith, if necessary the registered singleton object



getSingletonCount
public int getSingletonCount()(Code)



getSingletonMutex
final protected Object getSingletonMutex()(Code)
Expose the singleton mutex to subclasses.

Subclasses should synchronize on the given Object if they perform any sort of extended singleton creation phase. In particular, subclasses should not have their own mutexes involved in singleton creation, to avoid the potential for deadlocks in lazy-init situations.




getSingletonNames
public String[] getSingletonNames()(Code)



hasDependentBean
protected boolean hasDependentBean(String beanName)(Code)
Return whether a dependent bean has been registered under the given name.
Parameters:
  beanName - the name of the bean



isSingletonCurrentlyInCreation
final public boolean isSingletonCurrentlyInCreation(String beanName)(Code)
Return whether the specified singleton bean is currently in creation (within the entire factory).
Parameters:
  beanName - the name of the bean



registerDependentBean
public void registerDependentBean(String beanName, String dependentBeanName)(Code)
Register a dependent bean for the given bean, to be destroyed before the given bean is destroyed.
Parameters:
  beanName - the name of the bean
Parameters:
  dependentBeanName - the name of the dependent bean



registerDisposableBean
public void registerDisposableBean(String beanName, DisposableBean bean)(Code)
Add the given bean to the list of disposable beans in this registry. Disposable beans usually correspond to registered singletons, matching the bean name but potentially being a different instance (for example, a DisposableBean adapter for a singleton that does not naturally implement Spring's DisposableBean interface).
Parameters:
  beanName - the name of the bean
Parameters:
  bean - the bean instance



registerSingleton
public void registerSingleton(String beanName, Object singletonObject) throws IllegalStateException(Code)



removeSingleton
protected void removeSingleton(String beanName)(Code)
Remove the bean with the given name from the singleton cache of this factory.

To be able to clean up eager registration of a singleton if creation failed.
Parameters:
  beanName - the name of the bean




Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.