The following features are expected
- Retain stateful session bean state during redeployment if keepstate option is true
- Retain EJB timers during redeployment if keepstate option is true
Feature decription This will allow Stateful session bean instances and persistently created EJB timers to be retained between redeployments. A similar feature was added in GlassFish V3 for HTTP Session retention. The existing default behavior of no retention will still apply in GlassFish V3. Certain restrictions governing the allowable changes to an application between redeployments will need to be put in place for this feature to work. For example, no changes to the set of instance variables in the SFSB bean class. There are 2 ways to specify the option to retain stateful session bean and EJB timer state: (1) --keepstate option in asadmin redeploy command. Its value can be true or false, and the default value is null (not specified). For example, asadmin redeploy --keepstate=true hello.ear (2) <keep-state> element in glassfish-specific descriptors. This is suitable for auto-deploy, where there is no way to specify redeploy options. Its value can be true or false, and the default value is false. (2.1) If EAR, specify it in glassfish-application.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE sun-application PUBLIC "-//Sun Microsystems, Inc.//DTD GlassFish Application Server 3.0 Java EE Application 6.0//EN" "http://www.sun.com/software/appserver/dtds/sun-application_6_0-0.dtd"> <sun-application> <keep-state>true</keep-state> </sun-application> (2.2) If WAR, specify it in glassfish-web.xml <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd"> <glassfish-web-app> <keep-state>false</keep-state> </glassfish-web-app> (2.3) If ejb jar, specify it in glassfish-ejb-jar.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE glassfish-ejb-jar PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 EJB 3.1//EN" "http://glassfish.org/dtds/glassfish-ejb-jar_3_1-1.dtd"> <glassfish-ejb-jar> <enterprise-beans> <ejb> <ejb-name>FooBean</ejb-name> <jndi-name>ejb/FooBeanGlobal</jndi-name> </ejb> </enterprise-beans> <keep-state>true</keep-state> </glassfish-ejb-jar> If both specified, --keepstate option in command line overrides <keep-state> in descriptor. Test Description Test execution
- cd v2/appserv-tests/
- svn update
- cd devtests/ejb/ejb31/timer31/keepstate
- ant all
What does the test do
- build
- builds a test EAR that contains an ejb jar and appclient. The ejb jar contains a singleton bean, with @Schedule to create auto timers for every second.
- deploy
- deploys the test EAR without specifying --keepstate option
- run
- modify the timer info in ejb/KeepStateIF.java, so that any newly-created timers will have the new info value
- build test EAR again
- redeploy test EAR with --keepstate=true
- run appclient with appclient.application.args true, expecting:
- old timers created in the first deployment were retained
- no new auto timers were created during redeploy
- existing timers all have the old timer info
- redeploy test EAR with --keepstate=false
- run appclient with appclient.application.args false, expecting:
- old timers created in the first deployment were not retained
- new auto timers were created during redeploy
- existing timers all have the new timer info
- unmodify the test files
- undeploy the test EAR
-
To manually verify if keepstate option is processed, search "keepstate" in server.log. If keepstate is true, there should be log entries about keepstate. manual testing of --keepstate with Web & Ejb states
- cd appserv-tests/devtests/ejb/ee/cluster-tests/simple-failover/SFSBDriver
- asadmin deploy --force dist/SFSBDriver.war
- Open a browser and go to: localhost:8080/SFSBDriver/SFSBDriverServlet
- Access the url a few times and check that the counters (web and ejb) are identical
- asadmin deploy --force --keepstate=true dist/SFSBDriver.war
- Again access the url a few times and check that the counters (web and ejb) are identical
(semi) manual testing of --keepstate with Web & Ejb states
- cd appserv-tests/devtests/ejb/sfsb/keepstate
- From one terminal do
- ant all
- You will see the following output from the test
- exec keepstateClient doTest()...
- exec keepstateClient Inside init....
- exec Oct 6, 2010 10:19:09 AM com.sun.logging.LogDomains$1 log
- exec WARNING: gf.counterpart.configdd.exists
- exec keepstate Initalization done
- exec Value of key is: initSFSBList
- exec Waiting for 15 seconds before accessing...
- exec 15 seconds left...
- exec 14 seconds left...
- Now go to another terminal window
- cd appserv-tests/devtests/ejb/sfsb/keepstate
- asadmin --host localhost --port 4848 --user admin --passwordfile /space/work/v3/appserv-tests/config/adminpassword.txt --interactive=false --echo=true --terse=true deploy --keepstate=true --force=true --precompilejsp=false --verify=false --retrieve /space/work/v3/appserv-tests/build/module/archive --generatermistubs=false --availabilityenabled=false --asyncreplication=true --target server --keepreposdir=false --keepfailedstubs=false --logreportederrors=true <APS_HOME>/build/module/archive/ejb-sfsb-keepstateApp.ear
- Now go back to terminal window 1 and the test that is running there must pass
Unit Testing |
Completed? (Y/N) |
Comments |
Unit tests automated and 100% complete (for this milestone) |
Y |
|
Have unit tests been run against a promoted build? |
Y |
|
Are the total Unit Tests (UT's) 90% passing? |
Y |
|
Were known open defects listed and discussed at the meeting? |
N |
|
Design Specifications |
Completed |
|
Do Functional one pagers accurately reflect functionality to be released? |
Y |
|
Have they been shared with QA and Doc PoCs 3 days prior to Demo? |
Y |
|
Are there requirements documented outside Design Spec in BugDB or another system of record? |
N |
|
Demonstration Environment |
Completed |
Comments |
Was demonstration conducted on an unpatched build? |
N |
Not yet |
If No, please list justification and mitigation strategy |
- |
|
DHQA Discussion/Topics |
Completed? (Y/N) |
Comments |
Meeting topics were: |
- |
|
List attendees: |
- |
|
QA Acceptance |
Y/N |
(QA Rep) |
Doc. Acceptance |
Y/N |
(Doc Rep) |
|