How to integrate and run Shoal (Sample Code)
Simple ExampleTake a look at this simple example code to see how Shoal can be used to get cluster lifecycle notifications in your app. Simple Sample Source Code. Compile and run this class with the shoal-gms.jar and the jxta.jar in your classpath on two or more terminals.
A different example using an Application Server type constructTo view this example and run it, follow these steps:
- checkout the sources from CVS and look for the demo code located at shoal/gms/tests/com/sun/enterprise/ee/cms/tests, or
- browse the demo code in the CVS respository here
- in the demo, an ApplicationServer (named only for demo purposes) starts GMS services, and then starts two other Application Server Components (again simply named as EJBContainer and TransactionService for demo purposes). The components are consumers of GMS events and register for events of their interest.
To run the demo
- On Linux, Unix or MacOs X platforms, run the script "rungmsdemo.sh" located at shoal/gms
- On Windows platform, run the batch script "rungmsdemo.bat" located at shoal/gms
- In order to see this in a group setting, ensure that you start at least two terminals and run the demo code in these terminals.
- The scripts expect on command line, parameters in the following order : <instance_name>, <group_name>, <member_type>(CORE or SPECTATOR), <demo_life_in_milliseconds>, <log_level> (one of INFO, FINE, FINER, FINEST)
- The <instance_name> parameter in each terminal/process should be unique. The <group_name> should be the same in order for members to join the same group and experience Shoal's functionalities