WebSphere Extended Deployment, Version 6.0.x
             Operating Systems: AIX, HP-UX, Linux, Solaris, Windows


The notification interface

The servlet API consists of a method for receiving partition callbacks (regarding partition events) using the HttpPartitionNotification interface. The notification interface is as follows:
public interface HttpPartitionNotification {
	    /* 
	     * Fetch the vector of partition strings from the web module.
	     */
	    public Vector getPartitions();
	
	    /* 
	     * Fetch the array of expressions from the web module.
	     */
	    public HttpPartitionExpression[] getExpressions();
	
	    /* 
	     * Queries the web module to determine if the specified partition 
      is still alive.
	     */
	    public boolean isPartitionAlive(String partitionName);
	
	    /* 
	     * Indicates that this partition has been loaded by WPF.
	     */
	    public boolean loadEvent(String partitionName);
	
	    /* 
	     * Indicates that this partition has been loaded by WPF.
	     */
	    public void unloadEvent(String partitionName);
	}
Though this interface is very similar to that supported by the partitioning facility function, there are some minor differences. The most notable of these is the inclusion of a getExpressions() method that is used by the HTTP partitioning function to gather the request expressions that will be used with this application. A servlet can register itself (or some other class) to receive notifications by invoking the HttpPartitionManager.registerNotfication() method, for example, in its init() method:
public void init() throws ServletException {
    	System.out.println(className+": Registering notification ");
		httpPartitionManager.registerNotification(appName, this);
	  }
	
    public void destroy() {
   	System.out.println(className+": Deregistering notification ");
		httpPartitionManager.deregisterNotification(appName, this);
	    }

This example also illustrates the use of the HttpPartitionManager.deregisterNotfication() method in the servlet's destroy() method. For correctness, all registered notifications must be deregistered.



Related concepts
HTTP programming interfaces
Reference topic    

Terms of Use | Feedback

Last updated: Oct 16, 2009 11:11:31 AM EDT
http://publib.boulder.ibm.com/infocenter/wxdinfo/v6r0/index.jsp?topic=/com.ibm.websphere.xd.doc/info/WPF51/rwpfNotificationInterface.html