PSSB(partition stateless session bean)의 getPartitions 메소드에서, 여러 파티션에 동일 파티션 별명을 지정하여 파티션 세트의 파티션 그룹 텍스트를 작성합니다.
다음 샘플(WPFPartitionGroupingSample.ear)에서, 파티션 그룹 수는 파티션 수의 반(1/2)입니다. 각 파티션 그룹에는 두 개의 파티션이 있습니다.
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)); } }
WPFPartitionGroupingSample.ear에는 소스 코드가 있습니다. D_WPFPartitionGroupingSample.ear은 전개된 ear입니다.
launchClient D_WPFPartitionGroupingSample.ear -CCBootstrapPort=9813
결과는 다음과 코드와 같습니다.
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
파티션 별명의 개념