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


Update the getPartitions method

setPartitionAlias

WebSphere Extended Deployment Version 6.0 supports partitionAlias context-based routing. After following the next step to update the getPartitions method, you can add:
 PartitionDefinition p = ivRuntime.createPartitionDefinition(pName)  
p.setPartitionAlias(pAlias) 

This will enable you to use either pName or pAlias context to do routing.

Update the getPartitions method as follows:
	public PartitionDefinition[] getPartitions() 
	{
		ArrayList partitions = new ArrayList();
		
		// first add some key based partitions. These are static here but could
		// just as easily be loaded from a database when the application starts.
		String[] keys = new String[] {"IBM", "CSCO", "SUNW", "BEAS", "ORCL", 
"MSFT", "GE"};
		for(int i = 0; i < keys.length; ++i)
		{
			PartitionDefinition p = ivRuntime.createPartitionDefinition("K_" + 
keys[i], 
					"KEYS", PartitionScope.K_CLUSTER);
			partitions.add(p);
		}
		// now add some partitions for our hash test. We'll have a hash space
     of 16 slots
		// thus allowing us to scale to 16 JVMs. We can easily use a larger 
     number but 16
		// is sufficient for this sample.
		for(int i = 0; i < 16; ++i)
		{
			PartitionDefinition p = ivRuntime.createPartitionDefinition
     ("H_" + i, 
					"HASH", PartitionScope.K_CLUSTER);
			partitions.add(p);
		}
		PartitionDefinition p = ivRuntime.createPartitionDefinition
    ("SINGLETON");
		partitions.add(p);
		return (PartitionDefinition[])partitions.toArray();
	}

This method shows an example of three types of partitioning schemes.

The first scheme creates a partition per key. The keys here are stock symbols. You can load the list of stock symbols (there are usually thousands) and return partition definitions for each. The next scheme shows how partitions can be created to hash a set of keys onto a fixed set of partitions using a hashing scheme. The sample uses sixteen partitions. Finally, the last scheme shows how to make a singleton service for the cluster by giving it a single partition.

The purpose of the partition stateless session bean (PSSB) is to support the application specification of the set partitions at startup time. With each partition that is specified, the cluster member can be a potential activation member for the partition. Each cluster member normally returns the same set of partitions, and the customer can use the HA manager and its policies to determine partition placement. This scheme offers both flexibility and simplicity by separating the concerns of partition definition versus partition placement. There is no need to implement complicated application logic returning different partition sets for each cluster member. When the cluster starts, each partition is activated on one of the cluster members.




Related tasks
Adding sample partitions
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/rwpgetPartitions.html