KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > activemq > broker > region > group > MessageGroupHashBucketFactory


1 /**
2  *
3  * Copyright 2005-2006 The Apache Software Foundation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17 package org.apache.activemq.broker.region.group;
18
19 /**
20  * A factory to create instances of {@link SimpleMessageGroupMap} when
21  * implementing the <a
22  * HREF="http://activemq.apache.org/message-groups.html">Message
23  * Groups</a> functionality.
24  *
25  * @org.apache.xbean.XBean
26  *
27  * @version $Revision: 511784 $
28  */

29 public class MessageGroupHashBucketFactory implements MessageGroupMapFactory {
30
31     private int bucketCount = 1024;
32
33     public MessageGroupMap createMessageGroupMap() {
34         return new MessageGroupHashBucket(bucketCount);
35     }
36
37     public int getBucketCount() {
38         return bucketCount;
39     }
40
41     /**
42      * Sets the number of hash buckets to use for the message group
43      * functionality. This is only applicable to using message groups to
44      * parallelize processing of a queue while preserving order across an
45      * individual JMSXGroupID header value. This value sets the number of hash
46      * buckets that will be used (i.e. the maximum possible concurrency).
47      */

48     public void setBucketCount(int bucketCount) {
49         this.bucketCount = bucketCount;
50     }
51
52 }
53
Popular Tags