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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user