Allow ShutdownComponent to be registered after init() has been called.

git-svn-id: https://samskivert.googlecode.com/svn/trunk@2560 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
samskivert
2009-05-27 22:06:48 +00:00
parent 68900548c1
commit 38f1ab2e1e
+6 -3
View File
@@ -60,13 +60,16 @@ public class Lifecycle
*/
public void addComponent (BaseComponent comp)
{
if (_initers == null || _downers == null) {
throw new IllegalStateException("Too late to register component.");
}
if (comp instanceof InitComponent) {
if (_initers == null) {
throw new IllegalStateException("Too late to register InitComponent.");
}
_initers.add((InitComponent)comp);
}
if (comp instanceof ShutdownComponent) {
if (_downers == null) {
throw new IllegalStateException("Too late to register ShutdownComponent.");
}
_downers.add((ShutdownComponent)comp);
}
}