KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > corba > se > spi > extension > RequestPartitioningPolicy


1 /*
2  * @(#)RequestPartitioningPolicy.java 1.2 04/06/04
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package com.sun.corba.se.spi.extension ;
9
10 import org.omg.CORBA.Policy JavaDoc ;
11 import org.omg.CORBA.LocalObject JavaDoc ;
12
13 import com.sun.corba.se.spi.logging.CORBALogDomains ;
14
15 import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
16 import com.sun.corba.se.impl.orbutil.ORBConstants ;
17
18 /** Policy used to support the request partitioning feature and to
19  * specify the partition to use.
20 */

21 public class RequestPartitioningPolicy extends LocalObject JavaDoc implements Policy JavaDoc
22 {
23     private static ORBUtilSystemException wrapper =
24     ORBUtilSystemException.get( CORBALogDomains.OA_IOR ) ;
25     public final static int DEFAULT_VALUE = 0;
26     private final int value;
27
28     public RequestPartitioningPolicy( int value )
29     {
30     if (value < ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID ||
31         value > ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID) {
32         throw wrapper.invalidRequestPartitioningPolicyValue(
33           new Integer JavaDoc(value),
34               new Integer JavaDoc(
35               ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID),
36               new Integer JavaDoc(
37               ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID));
38     }
39     this.value = value;
40     }
41
42     public int getValue()
43     {
44     return value;
45     }
46
47     public int policy_type()
48     {
49     return ORBConstants.REQUEST_PARTITIONING_POLICY;
50     }
51
52     public org.omg.CORBA.Policy JavaDoc copy()
53     {
54     return this;
55     }
56
57     public void destroy()
58     {
59     // NO-OP
60
}
61
62     public String JavaDoc toString()
63     {
64     return "RequestPartitioningPolicy[" + value + "]" ;
65     }
66 }
67
Popular Tags