Go to main content

Oracle® Solaris Cluster Data Services Developer's Guide

Exit Print View

Updated: September 2015
 
 

Example of Creating a Java Application That Uses the CRNP

The following example illustrates how to develop a simple Java application named CrnpClient that uses the CRNP. The application registers for event callbacks with the CRNP server in the cluster, listens for the event callbacks, and processes the events by printing their contents. Before terminating, the application unregisters its request for event callbacks.

    Note the following points when reviewing this example:

  • The sample application generates and parses XML with the JAXP (Java API for XML Processing). This example does not show you how to use the JAXP. The JAXP is described in more detail at https://jaxp.java.net/.

  • This example presents pieces of an application, which can be found in its entirety in Appendix E, CrnpClient.java Application. To illustrate particular concepts more effectively, the example in this chapter differs slightly from the complete application that is presented in Appendix E, CrnpClient.java Application.

  • For brevity, comments are excluded from the sample code in this chapter. The complete application in Appendix E, CrnpClient.java Application includes comments.

  • The application that is shown in this example handles most error conditions by simply exiting the application. Your actual application needs to handle errors more robustly.