The PartitionHandlerLocal interface defines callback methods that enable your application to receive specific partition lifecycle events from the partitioning facility runtime. There are four methods on this interface.
PartitionDefinition[] getPartitions()
public PartitionDefinition[] getPartitions() { PartitionDefinition[] rc = new PartitionDefinition[10]; for(int i = 0; i < rc.length; ++i) { rc[i] = ivRuntime.createPartitionDefinition("" + i); } return rc;This returns 10 partitions to the runtime. The partitions are named:
{0,1,2,3,4,5,6,7,8,9}They are all created using the default classification.
boolean partitionLoadEvent(String partitionName)
The following sentence does not apply in z/OS.
The method should return true if the cluster member is ready to accept work for the specified partition.
Once the method returns, the IIOP routing tables are updated and incoming IIOP requests will be delivered to this cluster member for the specified partition.
If the method returns false, then the HA manager disables the cluster member for this partition and will try to activate the partition on a different cluster member based upon the current policy. This disabling only applies to the partition passed to the method, other partitions may still be activated on this cluster member. Applications that return false should ensure that adequate trace is enabled to allow the administrator to diagnose the problem. If the problem is determined to be transient in nature, then the administrator can use JMX to enable the cluster member again for that specific partition.
If an application is using messaging to accept incoming requests for a partition (as opposed to direct IIOP routing) then the application should subscribe at this time to the topics or queues on which the requests can arrive.
void partitionUnloadEvent(String partitionName)
If an application is using messaging to accept incoming requests (as opposed to direct IIOP routing) then it should unsubscribe to the topics/queues on which those requests arrive. The HA manager will not activate a replacement cluster member until this method returns.
The isPartitionAlive method is only called when the policy controlling the partition has the isAlive attribute set to true in the CoreGroup Policy in effect for this partition set (see wpfadmin policy overview and policy command examples).
The default partitioning facility partition policies disable this call back, and as for many partitions, the overall cluster performance can be affected. For very tightly managed environments, they may wish to manage this attribute in an active manner.
boolean isPartitionAlive(String partitionName)
If the method returns false then the JVM is 'panicked', or the JVM is halted, and another cluster member is chosen to host the partition. The application can use this method to verify that the partition is operating correctly, perhaps by asking a peer cluster member to invoke a partition method to perform a ping type operation or sanity check from a remote JVM.