|
||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
Interface Summary | |
---|---|
AppStartUp | Startup beans must use this interface for their remote interfaces. |
AppStartUpHome | Any startup beans must use this interface in their J2EE descriptors. |
Provides for applications having business logic invoked when an application is started or stopped.
An ejb jar in an EAR may contain zero or more of these startup beans. When an application is started then WebSphere will find any session beans that specified the AppStartUpHome and AppStartUp interfaces. The start method on these beans is then called. The start method returns a boolean. If the method returns true then the application start proceeds normally. If it returns false then the application start process fails. If the start method throws any exception then the application start process fails also.
When the application is stopped then the stop methods on those beans is invoked. This happens the reverse order to the start methods being invoked. If the JVM stops suddenly then the stop methods will not be invoked. Any exceptions thrown by a stop method are ignored.
The beans are started in numerically ascending order and are stopped in numerically descending order.
Event | What happens |
---|---|
Cluster member on machine #1 starts | The app startup bean start method is executed on machine #1. |
Cluster member on machine #2 starts | The app startup bean start method is executed on machine #2. |
Cluster member on machine #3 starts | The app startup bean start method is executed on machine #3. |
Cluster member on machine #1 stops | The app startup bean stop method is executed on machine #1. |
Cluster member on machine #1 restarts | The app startup bean start method is executed on machine #1. |
Cluster member on machine #4 starts | The app startup bean start method is executed on machine #4. |
If a clustered application needs to execute startup code ONE time before the first cluster member starts then it is best to execute a script that invokes a session bean that contains the start/stop logic. Execute this script prior to starting the clustered application. Likewise, before you stop the clustered application then run another script to execute the application stop code and then shutdown the application. It may be necessary to factor the application into two pieces;
This would allow the 'running code' application to be stopped and then the script can invoke code in the 'start/stop' application. Likewise, at startup then start the 'start/stop' application first, run the script then start the 'running code' application.
|
||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |