WebSphere eXtreme Scale (formerly Data Grid), Version 6.1
             Operating Systems: AIX, HP-UX, Linux, Solaris, Windows, z/OS


Partition grouping programming

In the getPartitions method of partition stateless session bean (PSSB), you assign the same partition alias to multiple partitions, which creates partition group context for a set of partitions.

In the following sample (WPFPartitionGroupingSample.ear), the number of partition groups is one half (1/2) of the number of partitions. Each partition group contains two partitions.

public PartitionDefinition[] getPartitions() {
		try {
          numOfAlias=Math.round(numOfPartitions/2.0f);
			partitionAlias= new String[numOfAlias];
		}
		catch (Exception e) {
……
		}
		PartitionDefinition[] rc = new PartitionDefinition[numOfPartitions];
		for (int i = 1; i <= numOfPartitions; ++i) {
			rc[i - 1] = ivManager.createPartitionDefinition(PartitionGrouping.PARTITION_PREFIX + padZeroToString(i + "", 6));
			int k= Math.round((i-1)/2.0f-0.1f)+1; 
						rc[i-1].setPartitionAlias(PartitionGrouping.PARTITION_ALIAS + padZeroToString(k + "", 6));
		}
	} 

Partition alias runtime

WPFPartitionGroupingSample.ear contains source code. D_WPFPartitionGroupingSample.ear is a deployed ear.

Both are in the directory of [WAS_HOME]/profiles/[PROFILE]/installableApps. Install D_WPFPartitionGroupingSample.ear. Go to the command line and change directories to c:\XD60_install><bin>. Then, type the following command:
launchClient D_WPFPartitionGroupingSample.ear -CCBootstrapPort=9813

The result is the following code:

IBM WebSphere Application Server, Release 6.0
J2EE Application Client Tool
Copyright IBM Corp., 1997-2004
WSCL0012I: Processing command line arguments.
WSCL0013I: Initializing the J2EE Application Client Environment.
****************************************
ClientComponentImpl.initialize()
****************************************
****************************************
ClientComponentImpl.start()
****************************************
WSCL0035I: Initialization of the J2EE Application Client Environment has complet
ed.
WSCL0014I: Invoking the Application Client class com.ibm.websphere.wpf.grouping.
client.WPFPartitionGroupingClient
PartionAlias Context Routing Sample has 10 partitions
PartionAlias Context Routing Sample has 5 alias
Partition alias groups different partitions and router does WLM for each alias t
hat has more than 1 partitions.
This sample shows that alias context will be routed into 2 different (even and o
dd) partitions:
1st call: PG000008->partition=PG000008,server=clusterdevNode01/s1
2nd call: PG000008->partition=PG000008,server=clusterdevNode01/s1
3rd call: PG000008->partition=PG000008,server=clusterdevNode01/s1
Alias 1st call: PGALIAS000001->partitionAlias=PGALIAS000001,server=clusterdevNode
02/s3
Alias 2nd call: PGALIAS000001->partitionAlias=PGALIAS000001,server=clusterdevNode
02/s3
Alias 3rd call: PGALIAS000001->partitionAlias=PGALIAS000001,server=clusterdevNode
02/s3
Alias 4th call: PGALIAS000001->partitionAlias=PGALIAS000001,server=clusterdevNode
02/s3
Alias 5th call: PGALIAS000001->partitionAlias=PGALIAS000001,server=clusterdevNode
02/s3
Alias 6th call: PGALIAS000001->partitionAlias=PGALIAS000001,server=clusterdevNode
02/s3
1st call: PG000006->partition=PG000006,server=clusterdevNode01/s2
2nd call: PG000006->partition=PG000006,server=clusterdevNode01/s2
3rd call: PG000006->partition=PG000006,server=clusterdevNode01/s2
1st call: PG000010->partition=PG000010,server=clusterdevNode01/s1
2nd call: PG000010->partition=PG000010,server=clusterdevNode01/s1
3rd call: PG000010->partition=PG000010,server=clusterdevNode01/s1
Alias 1st call: PGALIAS000002->partitionAlias=PGALIAS000002,server=clusterdevNode
01/s2
Alias 2nd call: PGALIAS000002->partitionAlias=PGALIAS000002,server=clusterdevNode
01/s2
Alias 3rd call: PGALIAS000002->partitionAlias=PGALIAS000002,server=clusterdevNode
02/s3
Alias 4th call: PGALIAS000002->partitionAlias=PGALIAS000002,server=clusterdevNode
02/s3
Alias 5th call: PGALIAS000002->partitionAlias=PGALIAS000002,server=clusterdevNode
01/s2
Alias 6th call: PGALIAS000002->partitionAlias=PGALIAS000002,server=clusterdevNode
02/s3
1st call: PG000001->partition=PG000001,server=clusterdevNode02/s3
2nd call: PG000001->partition=PG000001,server=clusterdevNode02/s3
3rd call: PG000001->partition=PG000001,server=clusterdevNode02/s3
1st call: PG000002->partition=PG000002,server=clusterdevNode02/s3
2nd call: PG000002->partition=PG000002,server=clusterdevNode02/s3
3rd call: PG000002->partition=PG000002,server=clusterdevNode02/s3
Alias 1st call: PGALIAS000003->partitionAlias=PGALIAS000003,server=clusterdevNode
01/s2
Alias 2nd call: PGALIAS000003->partitionAlias=PGALIAS000003,server=clusterdevNode
01/s2
Alias 3rd call: PGALIAS000003->partitionAlias=PGALIAS000003,server=clusterdevNode
01/s2
Alias 4th call: PGALIAS000003->partitionAlias=PGALIAS000003,server=clusterdevNode
01/s2
Alias 5th call: PGALIAS000003->partitionAlias=PGALIAS000003,server=clusterdevNode
01/s2
Alias 6th call: PGALIAS000003->partitionAlias=PGALIAS000003,server=clusterdevNode
01/s2
1st call: PG000004->partition=PG000004,server=clusterdevNode01/s2
2nd call: PG000004->partition=PG000004,server=clusterdevNode01/s2
3rd call: PG000004->partition=PG000004,server=clusterdevNode01/s2
1st call: PG000007->partition=PG000007,server=clusterdevNode01/s1
2nd call: PG000007->partition=PG000007,server=clusterdevNode01/s1
3rd call: PG000007->partition=PG000007,server=clusterdevNode01/s1
Alias 1st call: PGALIAS000004->partitionAlias=PGALIAS000004,server=clusterdevNode
01/s1
Alias 2nd call: PGALIAS000004->partitionAlias=PGALIAS000004,server=clusterdevNode
01/s1
Alias 3rd call: PGALIAS000004->partitionAlias=PGALIAS000004,server=clusterdevNode
01/s1
Alias 4th call: PGALIAS000004->partitionAlias=PGALIAS000004,server=clusterdevNode
01/s1
Alias 5th call: PGALIAS000004->partitionAlias=PGALIAS000004,server=clusterdevNode
01/s1
Alias 6th call: PGALIAS000004->partitionAlias=PGALIAS000004,server=clusterdevNode
01/s1
1st call: PG000003->partition=PG000003,server=clusterdevNode02/s3
2nd call: PG000003->partition=PG000003,server=clusterdevNode02/s3
3rd call: PG000003->partition=PG000003,server=clusterdevNode02/s3
1st call: PG000005->partition=PG000005,server=clusterdevNode01/s2
2nd call: PG000005->partition=PG000005,server=clusterdevNode01/s2
3rd call: PG000005->partition=PG000005,server=clusterdevNode01/s2
Alias 1st call: PGALIAS000005->partitionAlias=PGALIAS000005,server=clusterdevNode
01/s1
Alias 2nd call: PGALIAS000005->partitionAlias=PGALIAS000005,server=clusterdevNode
01/s1
Alias 3rd call: PGALIAS000005->partitionAlias=PGALIAS000005,server=clusterdevNode
01/s1
Alias 4th call: PGALIAS000005->partitionAlias=PGALIAS000005,server=clusterdevNode
01/s1
Alias 5th call: PGALIAS000005->partitionAlias=PGALIAS000005,server=clusterdevNode
01/s1
Alias 6th call: PGALIAS000005->partitionAlias=PGALIAS000005,server=clusterdevNode
01/s1
1st call: PG000009->partition=PG000009,server=clusterdevNode01/s1
2nd call: PG000009->partition=PG000009,server=clusterdevNode01/s1
3rd call: PG000009->partition=PG000009,server=clusterdevNode01/s1
C:\hao\xd6\bin>



Related concepts
What is a partition alias?
Concept topic    

Terms of Use | Feedback

Last updated: Oct 30, 2009 6:09:57 PM EDT
http://publib.boulder.ibm.com/infocenter/wxdinfo/v6r1/index.jsp?topic=/com.ibm.websphere.dataint.doc/info/WPF51/cwpfpagrpr.html