1 /* |
1 /* |
2 * Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
120 */ |
120 */ |
121 public class CorbaClientRequestDispatcherImpl |
121 public class CorbaClientRequestDispatcherImpl |
122 implements |
122 implements |
123 ClientRequestDispatcher |
123 ClientRequestDispatcher |
124 { |
124 { |
125 // Used for locking |
|
126 private Object lock = new Object(); |
|
127 |
|
128 public OutputObject beginRequest(Object self, String opName, |
125 public OutputObject beginRequest(Object self, String opName, |
129 boolean isOneWay, ContactInfo contactInfo) |
126 boolean isOneWay, ContactInfo contactInfo) |
130 { |
127 { |
131 ORB orb = null; |
128 ORB orb = null; |
132 try { |
129 try { |
149 |
146 |
150 CorbaConnection connection = null; |
147 CorbaConnection connection = null; |
151 |
148 |
152 // This locking is done so that multiple connections are not created |
149 // This locking is done so that multiple connections are not created |
153 // for the same endpoint |
150 // for the same endpoint |
154 synchronized (lock) { |
151 //6929137 - Synchronized on contactInfo to avoid blocking across multiple endpoints |
|
152 synchronized (contactInfo) { |
155 if (contactInfo.isConnectionBased()) { |
153 if (contactInfo.isConnectionBased()) { |
156 if (contactInfo.shouldCacheConnection()) { |
154 if (contactInfo.shouldCacheConnection()) { |
157 connection = (CorbaConnection) |
155 connection = (CorbaConnection) |
158 orb.getTransportManager() |
156 orb.getTransportManager() |
159 .getOutboundConnectionCache(contactInfo).get(contactInfo); |
157 .getOutboundConnectionCache(contactInfo).get(contactInfo); |
254 // This must be done BEFORE message initialization since fragments |
252 // This must be done BEFORE message initialization since fragments |
255 // may be sent at that time. |
253 // may be sent at that time. |
256 registerWaiter(messageMediator); |
254 registerWaiter(messageMediator); |
257 |
255 |
258 // Do connection reclaim now |
256 // Do connection reclaim now |
259 synchronized (lock) { |
257 synchronized (contactInfo) { |
260 if (contactInfo.isConnectionBased()) { |
258 if (contactInfo.isConnectionBased()) { |
261 if (contactInfo.shouldCacheConnection()) { |
259 if (contactInfo.shouldCacheConnection()) { |
262 OutboundConnectionCache connectionCache = |
260 OutboundConnectionCache connectionCache = |
263 orb.getTransportManager() |
261 orb.getTransportManager() |
264 .getOutboundConnectionCache(contactInfo); |
262 .getOutboundConnectionCache(contactInfo); |