4
|
1 |
/*
|
5555
|
2 |
* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
|
4
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 |
*
|
|
5 |
* This code is free software; you can redistribute it and/or modify it
|
|
6 |
* under the terms of the GNU General Public License version 2 only, as
|
5555
|
7 |
* published by the Free Software Foundation. Oracle designates this
|
4
|
8 |
* particular file as subject to the "Classpath" exception as provided
|
5555
|
9 |
* by Oracle in the LICENSE file that accompanied this code.
|
4
|
10 |
*
|
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that
|
|
15 |
* accompanied this code).
|
|
16 |
*
|
|
17 |
* You should have received a copy of the GNU General Public License version
|
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
20 |
*
|
5555
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
22 |
* or visit www.oracle.com if you need additional information or have any
|
|
23 |
* questions.
|
4
|
24 |
*/
|
|
25 |
|
|
26 |
/**
|
|
27 |
*/
|
|
28 |
package com.sun.corba.se.impl.ior.iiop;
|
|
29 |
|
|
30 |
import org.omg.CORBA_2_3.portable.OutputStream;
|
|
31 |
|
|
32 |
import com.sun.corba.se.spi.ior.TaggedComponentBase;
|
|
33 |
import com.sun.corba.se.spi.ior.iiop.RequestPartitioningComponent;
|
|
34 |
import com.sun.corba.se.spi.logging.CORBALogDomains ;
|
|
35 |
|
|
36 |
import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
|
|
37 |
import com.sun.corba.se.impl.orbutil.ORBConstants;
|
|
38 |
|
|
39 |
|
|
40 |
public class RequestPartitioningComponentImpl extends TaggedComponentBase
|
|
41 |
implements RequestPartitioningComponent
|
|
42 |
{
|
|
43 |
private static ORBUtilSystemException wrapper =
|
|
44 |
ORBUtilSystemException.get( CORBALogDomains.OA_IOR ) ;
|
|
45 |
|
|
46 |
private int partitionToUse;
|
|
47 |
|
|
48 |
public boolean equals(Object obj)
|
|
49 |
{
|
|
50 |
if (!(obj instanceof RequestPartitioningComponentImpl))
|
|
51 |
return false ;
|
|
52 |
|
|
53 |
RequestPartitioningComponentImpl other =
|
|
54 |
(RequestPartitioningComponentImpl)obj ;
|
|
55 |
|
|
56 |
return partitionToUse == other.partitionToUse ;
|
|
57 |
}
|
|
58 |
|
|
59 |
public int hashCode()
|
|
60 |
{
|
|
61 |
return partitionToUse;
|
|
62 |
}
|
|
63 |
|
|
64 |
public String toString()
|
|
65 |
{
|
|
66 |
return "RequestPartitioningComponentImpl[partitionToUse=" + partitionToUse + "]" ;
|
|
67 |
}
|
|
68 |
|
|
69 |
public RequestPartitioningComponentImpl()
|
|
70 |
{
|
|
71 |
partitionToUse = 0;
|
|
72 |
}
|
|
73 |
|
|
74 |
public RequestPartitioningComponentImpl(int thePartitionToUse) {
|
|
75 |
if (thePartitionToUse < ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID ||
|
|
76 |
thePartitionToUse > ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID) {
|
|
77 |
throw wrapper.invalidRequestPartitioningComponentValue(
|
|
78 |
new Integer(thePartitionToUse),
|
|
79 |
new Integer(ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID),
|
|
80 |
new Integer(ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID));
|
|
81 |
}
|
|
82 |
partitionToUse = thePartitionToUse;
|
|
83 |
}
|
|
84 |
|
|
85 |
public int getRequestPartitioningId()
|
|
86 |
{
|
|
87 |
return partitionToUse;
|
|
88 |
}
|
|
89 |
|
|
90 |
public void writeContents(OutputStream os)
|
|
91 |
{
|
|
92 |
os.write_ulong(partitionToUse);
|
|
93 |
}
|
|
94 |
|
|
95 |
public int getId()
|
|
96 |
{
|
|
97 |
return ORBConstants.TAG_REQUEST_PARTITIONING_ID;
|
|
98 |
}
|
|
99 |
}
|