KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > corba > se > impl > ior > iiop > RequestPartitioningComponentImpl


1 /**
2  * @(#)RequestPartitioningComponentImpl.java 1.2 04/06/04
3  */

4 package com.sun.corba.se.impl.ior.iiop;
5
6 import org.omg.CORBA_2_3.portable.OutputStream JavaDoc;
7
8 import com.sun.corba.se.spi.ior.TaggedComponentBase;
9 import com.sun.corba.se.spi.ior.iiop.RequestPartitioningComponent;
10 import com.sun.corba.se.spi.logging.CORBALogDomains ;
11
12 import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
13 import com.sun.corba.se.impl.orbutil.ORBConstants;
14
15
16 public class RequestPartitioningComponentImpl extends TaggedComponentBase
17     implements RequestPartitioningComponent
18 {
19     private static ORBUtilSystemException wrapper =
20     ORBUtilSystemException.get( CORBALogDomains.OA_IOR ) ;
21
22     private int partitionToUse;
23
24     public boolean equals(Object JavaDoc obj)
25     {
26     if (!(obj instanceof RequestPartitioningComponentImpl))
27         return false ;
28
29     RequestPartitioningComponentImpl other =
30         (RequestPartitioningComponentImpl)obj ;
31
32     return partitionToUse == other.partitionToUse ;
33     }
34
35     public int hashCode()
36     {
37     return partitionToUse;
38     }
39
40     public String JavaDoc toString()
41     {
42     return "RequestPartitioningComponentImpl[partitionToUse=" + partitionToUse + "]" ;
43     }
44
45     public RequestPartitioningComponentImpl()
46     {
47         partitionToUse = 0;
48     }
49
50     public RequestPartitioningComponentImpl(int thePartitionToUse) {
51     if (thePartitionToUse < ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID ||
52         thePartitionToUse > ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID) {
53         throw wrapper.invalidRequestPartitioningComponentValue(
54           new Integer JavaDoc(thePartitionToUse),
55           new Integer JavaDoc(ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID),
56           new Integer JavaDoc(ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID));
57     }
58         partitionToUse = thePartitionToUse;
59     }
60
61     public int getRequestPartitioningId()
62     {
63     return partitionToUse;
64     }
65
66     public void writeContents(OutputStream JavaDoc os)
67     {
68         os.write_ulong(partitionToUse);
69     }
70     
71     public int getId()
72     {
73     return ORBConstants.TAG_REQUEST_PARTITIONING_ID;
74     }
75 }
76
Popular Tags