This demo is aimed show casing the high availability features in GlassFish 3.1 open source edition. The demo will show full http session replication as well as transaction check pointing in EJBs. For purpose of this demo the following script will create a 3 instance cluster on the same node.
- Mahesh Kannan
- Rajiv Mordani
- Joe Fialli
The following shell script can be used to create the cluster or the cluster can be created via the Admin Console as is demoed in this milestone (MS3). You must set GF_HOME environment variable before invoking the script below.
Once you have the cluster setup - deploy the attached application to the cluster with the availabilityenabled parameter set to true as shown below.
The application SFSBDriver is what shows the HA features in MS3. To start the demo - point your browser to
http://localhost:18080/SFSBDriver/SFSBDriverServlet (we are pointing to instance 1 but you could use any instance. Also replace localhost appropriately)
The application puts the following attributes in the HTTP session -
an Integer value
and two stateful session bean references.
When the application is loaded on the browser hit refresh a few times and you will see that the counter is incremented.
Now shutdown the instance on which you were loading the page, in our case instance 1 as follows -
Get the session id for the cookie from the browser (on firefox right click on the page and select Page Info and you will get the session id).
Now redirect the browser to go to instance 3 - passing it the JSESSIONID=<session id> in the url.
So the url will be
You will observe that the counter increment continues from where you left off on instance1. The session data is replicated to inst3 and the state is preserved.
The [^SFSBDriver.war] is attached (sources will also be put up shortly). Click on Tools on the top right corner of this page to get to the attachments.