author | tbell |
Mon, 20 Apr 2009 00:12:19 -0700 | |
changeset 2664 | a0a22a8f16bd |
parent 4 | 02bb8761fcce |
child 3291 | 805a72a26925 |
permissions | -rw-r--r-- |
4 | 1 |
/* |
2664
a0a22a8f16bd
6372405: Server thread hangs when fragments don't complete because of connection abort
tbell
parents:
4
diff
changeset
|
2 |
* Copyright 2001-2007 Sun Microsystems, Inc. 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 |
|
7 |
* published by the Free Software Foundation. Sun designates this |
|
8 |
* particular file as subject to the "Classpath" exception as provided |
|
9 |
* by Sun in the LICENSE file that accompanied this code. |
|
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 |
* |
|
21 |
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
|
22 |
* CA 95054 USA or visit www.sun.com if you need additional information or |
|
23 |
* have any questions. |
|
24 |
*/ |
|
25 |
||
26 |
package com.sun.corba.se.impl.transport; |
|
27 |
||
28 |
import java.io.IOException; |
|
29 |
import java.net.InetSocketAddress; |
|
30 |
import java.net.Socket; |
|
31 |
import java.nio.ByteBuffer; |
|
32 |
import java.nio.channels.SelectableChannel; |
|
33 |
import java.nio.channels.SelectionKey; |
|
34 |
import java.nio.channels.SocketChannel; |
|
35 |
import java.security.AccessController; |
|
36 |
import java.security.PrivilegedAction; |
|
37 |
import java.util.Collections; |
|
38 |
import java.util.Hashtable; |
|
39 |
import java.util.HashMap; |
|
40 |
import java.util.Map; |
|
41 |
||
42 |
import org.omg.CORBA.COMM_FAILURE; |
|
43 |
import org.omg.CORBA.CompletionStatus; |
|
44 |
import org.omg.CORBA.DATA_CONVERSION; |
|
45 |
import org.omg.CORBA.INTERNAL; |
|
46 |
import org.omg.CORBA.MARSHAL; |
|
47 |
import org.omg.CORBA.OBJECT_NOT_EXIST; |
|
48 |
import org.omg.CORBA.SystemException; |
|
49 |
||
50 |
import com.sun.org.omg.SendingContext.CodeBase; |
|
51 |
||
52 |
import com.sun.corba.se.pept.broker.Broker; |
|
53 |
import com.sun.corba.se.pept.encoding.InputObject; |
|
54 |
import com.sun.corba.se.pept.encoding.OutputObject; |
|
55 |
import com.sun.corba.se.pept.protocol.MessageMediator; |
|
56 |
import com.sun.corba.se.pept.transport.Acceptor; |
|
57 |
import com.sun.corba.se.pept.transport.Connection; |
|
58 |
import com.sun.corba.se.pept.transport.ConnectionCache; |
|
59 |
import com.sun.corba.se.pept.transport.ContactInfo; |
|
60 |
import com.sun.corba.se.pept.transport.EventHandler; |
|
61 |
import com.sun.corba.se.pept.transport.InboundConnectionCache; |
|
62 |
import com.sun.corba.se.pept.transport.OutboundConnectionCache; |
|
63 |
import com.sun.corba.se.pept.transport.ResponseWaitingRoom; |
|
64 |
import com.sun.corba.se.pept.transport.Selector; |
|
65 |
||
66 |
import com.sun.corba.se.spi.ior.IOR; |
|
67 |
import com.sun.corba.se.spi.ior.iiop.GIOPVersion; |
|
68 |
import com.sun.corba.se.spi.logging.CORBALogDomains; |
|
69 |
import com.sun.corba.se.spi.orb.ORB ; |
|
70 |
import com.sun.corba.se.spi.orbutil.threadpool.NoSuchThreadPoolException; |
|
71 |
import com.sun.corba.se.spi.orbutil.threadpool.NoSuchWorkQueueException; |
|
72 |
import com.sun.corba.se.spi.orbutil.threadpool.Work; |
|
73 |
import com.sun.corba.se.spi.protocol.CorbaMessageMediator; |
|
74 |
import com.sun.corba.se.spi.transport.CorbaContactInfo; |
|
75 |
import com.sun.corba.se.spi.transport.CorbaConnection; |
|
76 |
import com.sun.corba.se.spi.transport.CorbaResponseWaitingRoom; |
|
77 |
import com.sun.corba.se.spi.transport.ReadTimeouts; |
|
78 |
||
79 |
import com.sun.corba.se.impl.encoding.CachedCodeBase; |
|
80 |
import com.sun.corba.se.impl.encoding.CDRInputStream_1_0; |
|
81 |
import com.sun.corba.se.impl.encoding.CDROutputObject; |
|
82 |
import com.sun.corba.se.impl.encoding.CDROutputStream_1_0; |
|
83 |
import com.sun.corba.se.impl.encoding.CodeSetComponentInfo; |
|
84 |
import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry; |
|
85 |
import com.sun.corba.se.impl.logging.ORBUtilSystemException; |
|
86 |
import com.sun.corba.se.impl.orbutil.ORBConstants; |
|
87 |
import com.sun.corba.se.impl.orbutil.ORBUtility; |
|
88 |
import com.sun.corba.se.impl.protocol.giopmsgheaders.Message; |
|
89 |
import com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase; |
|
90 |
import com.sun.corba.se.impl.transport.CorbaResponseWaitingRoomImpl; |
|
91 |
||
92 |
/** |
|
93 |
* @author Harold Carr |
|
94 |
*/ |
|
95 |
public class SocketOrChannelConnectionImpl |
|
96 |
extends |
|
97 |
EventHandlerBase |
|
98 |
implements |
|
99 |
CorbaConnection, |
|
100 |
Work |
|
101 |
{ |
|
102 |
public static boolean dprintWriteLocks = false; |
|
103 |
||
104 |
// |
|
105 |
// New transport. |
|
106 |
// |
|
107 |
||
108 |
protected long enqueueTime; |
|
109 |
||
110 |
protected SocketChannel socketChannel; |
|
111 |
public SocketChannel getSocketChannel() |
|
112 |
{ |
|
113 |
return socketChannel; |
|
114 |
} |
|
115 |
||
116 |
// REVISIT: |
|
117 |
// protected for test: genericRPCMSGFramework.IIOPConnection constructor. |
|
118 |
protected CorbaContactInfo contactInfo; |
|
119 |
protected Acceptor acceptor; |
|
120 |
protected ConnectionCache connectionCache; |
|
121 |
||
122 |
// |
|
123 |
// From iiop.Connection.java |
|
124 |
// |
|
125 |
||
126 |
protected Socket socket; // The socket used for this connection. |
|
127 |
protected long timeStamp = 0; |
|
128 |
protected boolean isServer = false; |
|
129 |
||
130 |
// Start at some value other than zero since this is a magic |
|
131 |
// value in some protocols. |
|
132 |
protected int requestId = 5; |
|
133 |
protected CorbaResponseWaitingRoom responseWaitingRoom; |
|
134 |
protected int state; |
|
135 |
protected java.lang.Object stateEvent = new java.lang.Object(); |
|
136 |
protected java.lang.Object writeEvent = new java.lang.Object(); |
|
137 |
protected boolean writeLocked; |
|
138 |
protected int serverRequestCount = 0; |
|
139 |
||
140 |
// Server request map: used on the server side of Connection |
|
141 |
// Maps request ID to IIOPInputStream. |
|
142 |
Map serverRequestMap = null; |
|
143 |
||
144 |
// This is a flag associated per connection telling us if the |
|
145 |
// initial set of sending contexts were sent to the receiver |
|
146 |
// already... |
|
147 |
protected boolean postInitialContexts = false; |
|
148 |
||
149 |
// Remote reference to CodeBase server (supplies |
|
150 |
// FullValueDescription, among other things) |
|
151 |
protected IOR codeBaseServerIOR; |
|
152 |
||
153 |
// CodeBase cache for this connection. This will cache remote operations, |
|
154 |
// handle connecting, and ensure we don't do any remote operations until |
|
155 |
// necessary. |
|
156 |
protected CachedCodeBase cachedCodeBase = new CachedCodeBase(this); |
|
157 |
||
158 |
protected ORBUtilSystemException wrapper ; |
|
159 |
||
160 |
// transport read timeout values |
|
161 |
protected ReadTimeouts readTimeouts; |
|
162 |
||
163 |
protected boolean shouldReadGiopHeaderOnly; |
|
164 |
||
165 |
// A message mediator used when shouldReadGiopHeaderOnly is |
|
166 |
// true to maintain request message state across execution in a |
|
167 |
// SelectorThread and WorkerThread. |
|
168 |
protected CorbaMessageMediator partialMessageMediator = null; |
|
169 |
||
170 |
// Used in genericRPCMSGFramework test. |
|
171 |
protected SocketOrChannelConnectionImpl(ORB orb) |
|
172 |
{ |
|
173 |
this.orb = orb; |
|
174 |
wrapper = ORBUtilSystemException.get( orb, |
|
175 |
CORBALogDomains.RPC_TRANSPORT ) ; |
|
176 |
||
177 |
setWork(this); |
|
178 |
responseWaitingRoom = new CorbaResponseWaitingRoomImpl(orb, this); |
|
179 |
setReadTimeouts(orb.getORBData().getTransportTCPReadTimeouts()); |
|
180 |
} |
|
181 |
||
182 |
// Both client and servers. |
|
183 |
protected SocketOrChannelConnectionImpl(ORB orb, |
|
184 |
boolean useSelectThreadToWait, |
|
185 |
boolean useWorkerThread) |
|
186 |
{ |
|
187 |
this(orb) ; |
|
188 |
setUseSelectThreadToWait(useSelectThreadToWait); |
|
189 |
setUseWorkerThreadForEvent(useWorkerThread); |
|
190 |
} |
|
191 |
||
192 |
// Client constructor. |
|
193 |
public SocketOrChannelConnectionImpl(ORB orb, |
|
194 |
CorbaContactInfo contactInfo, |
|
195 |
boolean useSelectThreadToWait, |
|
196 |
boolean useWorkerThread, |
|
197 |
String socketType, |
|
198 |
String hostname, |
|
199 |
int port) |
|
200 |
{ |
|
201 |
this(orb, useSelectThreadToWait, useWorkerThread); |
|
202 |
||
203 |
this.contactInfo = contactInfo; |
|
204 |
||
205 |
try { |
|
206 |
socket = orb.getORBData().getSocketFactory() |
|
207 |
.createSocket(socketType, |
|
208 |
new InetSocketAddress(hostname, port)); |
|
209 |
socketChannel = socket.getChannel(); |
|
210 |
||
211 |
if (socketChannel != null) { |
|
212 |
boolean isBlocking = !useSelectThreadToWait; |
|
213 |
socketChannel.configureBlocking(isBlocking); |
|
214 |
} else { |
|
215 |
// IMPORTANT: non-channel-backed sockets must use |
|
216 |
// dedicated reader threads. |
|
217 |
setUseSelectThreadToWait(false); |
|
218 |
} |
|
219 |
if (orb.transportDebugFlag) { |
|
220 |
dprint(".initialize: connection created: " + socket); |
|
221 |
} |
|
222 |
} catch (Throwable t) { |
|
223 |
throw wrapper.connectFailure(t, socketType, hostname, |
|
224 |
Integer.toString(port)); |
|
225 |
} |
|
226 |
state = OPENING; |
|
227 |
} |
|
228 |
||
229 |
// Client-side convenience. |
|
230 |
public SocketOrChannelConnectionImpl(ORB orb, |
|
231 |
CorbaContactInfo contactInfo, |
|
232 |
String socketType, |
|
233 |
String hostname, |
|
234 |
int port) |
|
235 |
{ |
|
236 |
this(orb, contactInfo, |
|
237 |
orb.getORBData().connectionSocketUseSelectThreadToWait(), |
|
238 |
orb.getORBData().connectionSocketUseWorkerThreadForEvent(), |
|
239 |
socketType, hostname, port); |
|
240 |
} |
|
241 |
||
242 |
// Server-side constructor. |
|
243 |
public SocketOrChannelConnectionImpl(ORB orb, |
|
244 |
Acceptor acceptor, |
|
245 |
Socket socket, |
|
246 |
boolean useSelectThreadToWait, |
|
247 |
boolean useWorkerThread) |
|
248 |
{ |
|
249 |
this(orb, useSelectThreadToWait, useWorkerThread); |
|
250 |
||
251 |
this.socket = socket; |
|
252 |
socketChannel = socket.getChannel(); |
|
253 |
if (socketChannel != null) { |
|
254 |
// REVISIT |
|
255 |
try { |
|
256 |
boolean isBlocking = !useSelectThreadToWait; |
|
257 |
socketChannel.configureBlocking(isBlocking); |
|
258 |
} catch (IOException e) { |
|
259 |
RuntimeException rte = new RuntimeException(); |
|
260 |
rte.initCause(e); |
|
261 |
throw rte; |
|
262 |
} |
|
263 |
} |
|
264 |
this.acceptor = acceptor; |
|
265 |
||
266 |
serverRequestMap = Collections.synchronizedMap(new HashMap()); |
|
267 |
isServer = true; |
|
268 |
||
269 |
state = ESTABLISHED; |
|
270 |
} |
|
271 |
||
272 |
// Server-side convenience |
|
273 |
public SocketOrChannelConnectionImpl(ORB orb, |
|
274 |
Acceptor acceptor, |
|
275 |
Socket socket) |
|
276 |
{ |
|
277 |
this(orb, acceptor, socket, |
|
278 |
(socket.getChannel() == null |
|
279 |
? false |
|
280 |
: orb.getORBData().connectionSocketUseSelectThreadToWait()), |
|
281 |
(socket.getChannel() == null |
|
282 |
? false |
|
283 |
: orb.getORBData().connectionSocketUseWorkerThreadForEvent())); |
|
284 |
} |
|
285 |
||
286 |
//////////////////////////////////////////////////// |
|
287 |
// |
|
288 |
// framework.transport.Connection |
|
289 |
// |
|
290 |
||
291 |
public boolean shouldRegisterReadEvent() |
|
292 |
{ |
|
293 |
return true; |
|
294 |
} |
|
295 |
||
296 |
public boolean shouldRegisterServerReadEvent() |
|
297 |
{ |
|
298 |
return true; |
|
299 |
} |
|
300 |
||
301 |
public boolean read() |
|
302 |
{ |
|
303 |
try { |
|
304 |
if (orb.transportDebugFlag) { |
|
305 |
dprint(".read->: " + this); |
|
306 |
} |
|
307 |
CorbaMessageMediator messageMediator = readBits(); |
|
308 |
if (messageMediator != null) { |
|
309 |
// Null can happen when client closes stream |
|
310 |
// causing purgecalls. |
|
311 |
return dispatch(messageMediator); |
|
312 |
} |
|
313 |
return true; |
|
314 |
} finally { |
|
315 |
if (orb.transportDebugFlag) { |
|
316 |
dprint(".read<-: " + this); |
|
317 |
} |
|
318 |
} |
|
319 |
} |
|
320 |
||
321 |
protected CorbaMessageMediator readBits() |
|
322 |
{ |
|
323 |
try { |
|
324 |
||
325 |
if (orb.transportDebugFlag) { |
|
326 |
dprint(".readBits->: " + this); |
|
327 |
} |
|
328 |
||
329 |
MessageMediator messageMediator; |
|
330 |
// REVISIT - use common factory base class. |
|
331 |
if (contactInfo != null) { |
|
332 |
messageMediator = |
|
333 |
contactInfo.createMessageMediator(orb, this); |
|
334 |
} else if (acceptor != null) { |
|
335 |
messageMediator = acceptor.createMessageMediator(orb, this); |
|
336 |
} else { |
|
337 |
throw |
|
338 |
new RuntimeException("SocketOrChannelConnectionImpl.readBits"); |
|
339 |
} |
|
340 |
return (CorbaMessageMediator) messageMediator; |
|
341 |
||
342 |
} catch (ThreadDeath td) { |
|
343 |
if (orb.transportDebugFlag) { |
|
344 |
dprint(".readBits: " + this + ": ThreadDeath: " + td, td); |
|
345 |
} |
|
346 |
try { |
|
347 |
purgeCalls(wrapper.connectionAbort(td), false, false); |
|
348 |
} catch (Throwable t) { |
|
349 |
if (orb.transportDebugFlag) { |
|
350 |
dprint(".readBits: " + this + ": purgeCalls: Throwable: " + t, t); |
|
351 |
} |
|
352 |
} |
|
353 |
throw td; |
|
354 |
} catch (Throwable ex) { |
|
355 |
if (orb.transportDebugFlag) { |
|
356 |
dprint(".readBits: " + this + ": Throwable: " + ex, ex); |
|
357 |
} |
|
358 |
||
359 |
try { |
|
360 |
if (ex instanceof INTERNAL) { |
|
361 |
sendMessageError(GIOPVersion.DEFAULT_VERSION); |
|
362 |
} |
|
363 |
} catch (IOException e) { |
|
364 |
if (orb.transportDebugFlag) { |
|
365 |
dprint(".readBits: " + this + |
|
366 |
": sendMessageError: IOException: " + e, e); |
|
367 |
} |
|
368 |
} |
|
369 |
// REVISIT - make sure reader thread is killed. |
|
370 |
orb.getTransportManager().getSelector(0).unregisterForEvent(this); |
|
371 |
// Notify anyone waiting. |
|
372 |
purgeCalls(wrapper.connectionAbort(ex), true, false); |
|
373 |
// REVISIT |
|
374 |
//keepRunning = false; |
|
375 |
// REVISIT - if this is called after purgeCalls then |
|
376 |
// the state of the socket is ABORT so the writeLock |
|
377 |
// in close throws an exception. It is ignored but |
|
378 |
// causes IBM (screen scraping) tests to fail. |
|
379 |
//close(); |
|
380 |
} finally { |
|
381 |
if (orb.transportDebugFlag) { |
|
382 |
dprint(".readBits<-: " + this); |
|
383 |
} |
|
384 |
} |
|
385 |
return null; |
|
386 |
} |
|
387 |
||
388 |
protected CorbaMessageMediator finishReadingBits(MessageMediator messageMediator) |
|
389 |
{ |
|
390 |
try { |
|
391 |
||
392 |
if (orb.transportDebugFlag) { |
|
393 |
dprint(".finishReadingBits->: " + this); |
|
394 |
} |
|
395 |
||
396 |
// REVISIT - use common factory base class. |
|
397 |
if (contactInfo != null) { |
|
398 |
messageMediator = |
|
399 |
contactInfo.finishCreatingMessageMediator(orb, this, messageMediator); |
|
400 |
} else if (acceptor != null) { |
|
401 |
messageMediator = |
|
402 |
acceptor.finishCreatingMessageMediator(orb, this, messageMediator); |
|
403 |
} else { |
|
404 |
throw |
|
405 |
new RuntimeException("SocketOrChannelConnectionImpl.finishReadingBits"); |
|
406 |
} |
|
407 |
return (CorbaMessageMediator) messageMediator; |
|
408 |
||
409 |
} catch (ThreadDeath td) { |
|
410 |
if (orb.transportDebugFlag) { |
|
411 |
dprint(".finishReadingBits: " + this + ": ThreadDeath: " + td, td); |
|
412 |
} |
|
413 |
try { |
|
414 |
purgeCalls(wrapper.connectionAbort(td), false, false); |
|
415 |
} catch (Throwable t) { |
|
416 |
if (orb.transportDebugFlag) { |
|
417 |
dprint(".finishReadingBits: " + this + ": purgeCalls: Throwable: " + t, t); |
|
418 |
} |
|
419 |
} |
|
420 |
throw td; |
|
421 |
} catch (Throwable ex) { |
|
422 |
if (orb.transportDebugFlag) { |
|
423 |
dprint(".finishReadingBits: " + this + ": Throwable: " + ex, ex); |
|
424 |
} |
|
425 |
||
426 |
try { |
|
427 |
if (ex instanceof INTERNAL) { |
|
428 |
sendMessageError(GIOPVersion.DEFAULT_VERSION); |
|
429 |
} |
|
430 |
} catch (IOException e) { |
|
431 |
if (orb.transportDebugFlag) { |
|
432 |
dprint(".finishReadingBits: " + this + |
|
433 |
": sendMessageError: IOException: " + e, e); |
|
434 |
} |
|
435 |
} |
|
436 |
// REVISIT - make sure reader thread is killed. |
|
437 |
orb.getTransportManager().getSelector(0).unregisterForEvent(this); |
|
438 |
// Notify anyone waiting. |
|
439 |
purgeCalls(wrapper.connectionAbort(ex), true, false); |
|
440 |
// REVISIT |
|
441 |
//keepRunning = false; |
|
442 |
// REVISIT - if this is called after purgeCalls then |
|
443 |
// the state of the socket is ABORT so the writeLock |
|
444 |
// in close throws an exception. It is ignored but |
|
445 |
// causes IBM (screen scraping) tests to fail. |
|
446 |
//close(); |
|
447 |
} finally { |
|
448 |
if (orb.transportDebugFlag) { |
|
449 |
dprint(".finishReadingBits<-: " + this); |
|
450 |
} |
|
451 |
} |
|
452 |
return null; |
|
453 |
} |
|
454 |
||
455 |
protected boolean dispatch(CorbaMessageMediator messageMediator) |
|
456 |
{ |
|
457 |
try { |
|
458 |
if (orb.transportDebugFlag) { |
|
459 |
dprint(".dispatch->: " + this); |
|
460 |
} |
|
461 |
||
462 |
// |
|
463 |
// NOTE: |
|
464 |
// |
|
465 |
// This call is the transition from the tranport block |
|
466 |
// to the protocol block. |
|
467 |
// |
|
468 |
||
469 |
boolean result = |
|
470 |
messageMediator.getProtocolHandler() |
|
471 |
.handleRequest(messageMediator); |
|
472 |
||
473 |
return result; |
|
474 |
||
475 |
} catch (ThreadDeath td) { |
|
476 |
if (orb.transportDebugFlag) { |
|
477 |
dprint(".dispatch: ThreadDeath", td ); |
|
478 |
} |
|
479 |
try { |
|
480 |
purgeCalls(wrapper.connectionAbort(td), false, false); |
|
481 |
} catch (Throwable t) { |
|
482 |
if (orb.transportDebugFlag) { |
|
483 |
dprint(".dispatch: purgeCalls: Throwable", t); |
|
484 |
} |
|
485 |
} |
|
486 |
throw td; |
|
487 |
} catch (Throwable ex) { |
|
488 |
if (orb.transportDebugFlag) { |
|
489 |
dprint(".dispatch: Throwable", ex ) ; |
|
490 |
} |
|
491 |
||
492 |
try { |
|
493 |
if (ex instanceof INTERNAL) { |
|
494 |
sendMessageError(GIOPVersion.DEFAULT_VERSION); |
|
495 |
} |
|
496 |
} catch (IOException e) { |
|
497 |
if (orb.transportDebugFlag) { |
|
498 |
dprint(".dispatch: sendMessageError: IOException", e); |
|
499 |
} |
|
500 |
} |
|
501 |
purgeCalls(wrapper.connectionAbort(ex), false, false); |
|
502 |
// REVISIT |
|
503 |
//keepRunning = false; |
|
504 |
} finally { |
|
505 |
if (orb.transportDebugFlag) { |
|
506 |
dprint(".dispatch<-: " + this); |
|
507 |
} |
|
508 |
} |
|
509 |
||
510 |
return true; |
|
511 |
} |
|
512 |
||
513 |
public boolean shouldUseDirectByteBuffers() |
|
514 |
{ |
|
515 |
return getSocketChannel() != null; |
|
516 |
} |
|
517 |
||
518 |
public ByteBuffer read(int size, int offset, int length, long max_wait_time) |
|
519 |
throws IOException |
|
520 |
{ |
|
521 |
if (shouldUseDirectByteBuffers()) { |
|
522 |
||
523 |
ByteBuffer byteBuffer = |
|
524 |
orb.getByteBufferPool().getByteBuffer(size); |
|
525 |
||
526 |
if (orb.transportDebugFlag) { |
|
527 |
// print address of ByteBuffer gotten from pool |
|
528 |
int bbAddress = System.identityHashCode(byteBuffer); |
|
529 |
StringBuffer sb = new StringBuffer(80); |
|
530 |
sb.append(".read: got ByteBuffer id ("); |
|
531 |
sb.append(bbAddress).append(") from ByteBufferPool."); |
|
532 |
String msgStr = sb.toString(); |
|
533 |
dprint(msgStr); |
|
534 |
} |
|
535 |
||
536 |
byteBuffer.position(offset); |
|
537 |
byteBuffer.limit(size); |
|
538 |
||
539 |
readFully(byteBuffer, length, max_wait_time); |
|
540 |
||
541 |
return byteBuffer; |
|
542 |
} |
|
543 |
||
544 |
byte[] buf = new byte[size]; |
|
545 |
readFully(getSocket().getInputStream(), buf, |
|
546 |
offset, length, max_wait_time); |
|
547 |
ByteBuffer byteBuffer = ByteBuffer.wrap(buf); |
|
548 |
byteBuffer.limit(size); |
|
549 |
return byteBuffer; |
|
550 |
} |
|
551 |
||
552 |
public ByteBuffer read(ByteBuffer byteBuffer, int offset, |
|
553 |
int length, long max_wait_time) |
|
554 |
throws IOException |
|
555 |
{ |
|
556 |
int size = offset + length; |
|
557 |
if (shouldUseDirectByteBuffers()) { |
|
558 |
||
559 |
if (! byteBuffer.isDirect()) { |
|
560 |
throw wrapper.unexpectedNonDirectByteBufferWithChannelSocket(); |
|
561 |
} |
|
562 |
if (size > byteBuffer.capacity()) { |
|
563 |
if (orb.transportDebugFlag) { |
|
564 |
// print address of ByteBuffer being released |
|
565 |
int bbAddress = System.identityHashCode(byteBuffer); |
|
566 |
StringBuffer bbsb = new StringBuffer(80); |
|
567 |
bbsb.append(".read: releasing ByteBuffer id (") |
|
568 |
.append(bbAddress).append(") to ByteBufferPool."); |
|
569 |
String bbmsg = bbsb.toString(); |
|
570 |
dprint(bbmsg); |
|
571 |
} |
|
572 |
orb.getByteBufferPool().releaseByteBuffer(byteBuffer); |
|
573 |
byteBuffer = orb.getByteBufferPool().getByteBuffer(size); |
|
574 |
} |
|
575 |
byteBuffer.position(offset); |
|
576 |
byteBuffer.limit(size); |
|
577 |
readFully(byteBuffer, length, max_wait_time); |
|
578 |
byteBuffer.position(0); |
|
579 |
byteBuffer.limit(size); |
|
580 |
return byteBuffer; |
|
581 |
} |
|
582 |
if (byteBuffer.isDirect()) { |
|
583 |
throw wrapper.unexpectedDirectByteBufferWithNonChannelSocket(); |
|
584 |
} |
|
585 |
byte[] buf = new byte[size]; |
|
586 |
readFully(getSocket().getInputStream(), buf, |
|
587 |
offset, length, max_wait_time); |
|
588 |
return ByteBuffer.wrap(buf); |
|
589 |
} |
|
590 |
||
591 |
public void readFully(ByteBuffer byteBuffer, int size, long max_wait_time) |
|
592 |
throws IOException |
|
593 |
{ |
|
594 |
int n = 0; |
|
595 |
int bytecount = 0; |
|
596 |
long time_to_wait = readTimeouts.get_initial_time_to_wait(); |
|
597 |
long total_time_in_wait = 0; |
|
598 |
||
599 |
// The reading of data incorporates a strategy to detect a |
|
600 |
// rogue client. The strategy is implemented as follows. As |
|
601 |
// long as data is being read, at least 1 byte or more, we |
|
602 |
// assume we have a well behaved client. If no data is read, |
|
603 |
// then we sleep for a time to wait, re-calculate a new time to |
|
604 |
// wait which is lengthier than the previous time spent waiting. |
|
605 |
// Then, if the total time spent waiting does not exceed a |
|
606 |
// maximum time we are willing to wait, we attempt another |
|
607 |
// read. If the maximum amount of time we are willing to |
|
608 |
// spend waiting for more data is exceeded, we throw an |
|
609 |
// IOException. |
|
610 |
||
611 |
// NOTE: Reading of GIOP headers are treated with a smaller |
|
612 |
// maximum time to wait threshold. Based on extensive |
|
613 |
// performance testing, all GIOP headers are being |
|
614 |
// read in 1 read access. |
|
615 |
||
616 |
do { |
|
617 |
bytecount = getSocketChannel().read(byteBuffer); |
|
618 |
||
619 |
if (bytecount < 0) { |
|
620 |
throw new IOException("End-of-stream"); |
|
621 |
} |
|
622 |
else if (bytecount == 0) { |
|
623 |
try { |
|
624 |
Thread.sleep(time_to_wait); |
|
625 |
total_time_in_wait += time_to_wait; |
|
626 |
time_to_wait = |
|
627 |
(long)(time_to_wait*readTimeouts.get_backoff_factor()); |
|
628 |
} |
|
629 |
catch (InterruptedException ie) { |
|
630 |
// ignore exception |
|
631 |
if (orb.transportDebugFlag) { |
|
632 |
dprint("readFully(): unexpected exception " |
|
633 |
+ ie.toString()); |
|
634 |
} |
|
635 |
} |
|
636 |
} |
|
637 |
else { |
|
638 |
n += bytecount; |
|
639 |
} |
|
640 |
} |
|
641 |
while (n < size && total_time_in_wait < max_wait_time); |
|
642 |
||
643 |
if (n < size && total_time_in_wait >= max_wait_time) |
|
644 |
{ |
|
645 |
// failed to read entire message |
|
646 |
throw wrapper.transportReadTimeoutExceeded(new Integer(size), |
|
647 |
new Integer(n), new Long(max_wait_time), |
|
648 |
new Long(total_time_in_wait)); |
|
649 |
} |
|
650 |
||
651 |
getConnectionCache().stampTime(this); |
|
652 |
} |
|
653 |
||
654 |
// To support non-channel connections. |
|
655 |
public void readFully(java.io.InputStream is, byte[] buf, |
|
656 |
int offset, int size, long max_wait_time) |
|
657 |
throws IOException |
|
658 |
{ |
|
659 |
int n = 0; |
|
660 |
int bytecount = 0; |
|
661 |
long time_to_wait = readTimeouts.get_initial_time_to_wait(); |
|
662 |
long total_time_in_wait = 0; |
|
663 |
||
664 |
// The reading of data incorporates a strategy to detect a |
|
665 |
// rogue client. The strategy is implemented as follows. As |
|
666 |
// long as data is being read, at least 1 byte or more, we |
|
667 |
// assume we have a well behaved client. If no data is read, |
|
668 |
// then we sleep for a time to wait, re-calculate a new time to |
|
669 |
// wait which is lengthier than the previous time spent waiting. |
|
670 |
// Then, if the total time spent waiting does not exceed a |
|
671 |
// maximum time we are willing to wait, we attempt another |
|
672 |
// read. If the maximum amount of time we are willing to |
|
673 |
// spend waiting for more data is exceeded, we throw an |
|
674 |
// IOException. |
|
675 |
||
676 |
// NOTE: Reading of GIOP headers are treated with a smaller |
|
677 |
// maximum time to wait threshold. Based on extensive |
|
678 |
// performance testing, all GIOP headers are being |
|
679 |
// read in 1 read access. |
|
680 |
||
681 |
do { |
|
682 |
bytecount = is.read(buf, offset + n, size - n); |
|
683 |
if (bytecount < 0) { |
|
684 |
throw new IOException("End-of-stream"); |
|
685 |
} |
|
686 |
else if (bytecount == 0) { |
|
687 |
try { |
|
688 |
Thread.sleep(time_to_wait); |
|
689 |
total_time_in_wait += time_to_wait; |
|
690 |
time_to_wait = |
|
691 |
(long)(time_to_wait*readTimeouts.get_backoff_factor()); |
|
692 |
} |
|
693 |
catch (InterruptedException ie) { |
|
694 |
// ignore exception |
|
695 |
if (orb.transportDebugFlag) { |
|
696 |
dprint("readFully(): unexpected exception " |
|
697 |
+ ie.toString()); |
|
698 |
} |
|
699 |
} |
|
700 |
} |
|
701 |
else { |
|
702 |
n += bytecount; |
|
703 |
} |
|
704 |
} |
|
705 |
while (n < size && total_time_in_wait < max_wait_time); |
|
706 |
||
707 |
if (n < size && total_time_in_wait >= max_wait_time) |
|
708 |
{ |
|
709 |
// failed to read entire message |
|
710 |
throw wrapper.transportReadTimeoutExceeded(new Integer(size), |
|
711 |
new Integer(n), new Long(max_wait_time), |
|
712 |
new Long(total_time_in_wait)); |
|
713 |
} |
|
714 |
||
715 |
getConnectionCache().stampTime(this); |
|
716 |
} |
|
717 |
||
718 |
public void write(ByteBuffer byteBuffer) |
|
719 |
throws IOException |
|
720 |
{ |
|
721 |
if (shouldUseDirectByteBuffers()) { |
|
722 |
/* NOTE: cannot perform this test. If one ask for a |
|
723 |
ByteBuffer from the pool which is bigger than the size |
|
724 |
of ByteBuffers managed by the pool, then the pool will |
|
725 |
return a HeapByteBuffer. |
|
726 |
if (byteBuffer.hasArray()) { |
|
727 |
throw wrapper.unexpectedNonDirectByteBufferWithChannelSocket(); |
|
728 |
} |
|
729 |
*/ |
|
730 |
// IMPORTANT: For non-blocking SocketChannels, there's no guarantee |
|
731 |
// all bytes are written on first write attempt. |
|
732 |
do { |
|
733 |
getSocketChannel().write(byteBuffer); |
|
734 |
} |
|
735 |
while (byteBuffer.hasRemaining()); |
|
736 |
||
737 |
} else { |
|
738 |
if (! byteBuffer.hasArray()) { |
|
739 |
throw wrapper.unexpectedDirectByteBufferWithNonChannelSocket(); |
|
740 |
} |
|
741 |
byte[] tmpBuf = byteBuffer.array(); |
|
742 |
getSocket().getOutputStream().write(tmpBuf, 0, byteBuffer.limit()); |
|
743 |
getSocket().getOutputStream().flush(); |
|
744 |
} |
|
745 |
||
746 |
// TimeStamp connection to indicate it has been used |
|
747 |
// Note granularity of connection usage is assumed for |
|
748 |
// now to be that of a IIOP packet. |
|
749 |
getConnectionCache().stampTime(this); |
|
750 |
} |
|
751 |
||
752 |
/** |
|
753 |
* Note:it is possible for this to be called more than once |
|
754 |
*/ |
|
755 |
public synchronized void close() |
|
756 |
{ |
|
757 |
try { |
|
758 |
if (orb.transportDebugFlag) { |
|
759 |
dprint(".close->: " + this); |
|
760 |
} |
|
761 |
writeLock(); |
|
762 |
||
763 |
// REVISIT It will be good to have a read lock on the reader thread |
|
764 |
// before we proceed further, to avoid the reader thread (server side) |
|
765 |
// from processing requests. This avoids the risk that a new request |
|
766 |
// will be accepted by ReaderThread while the ListenerThread is |
|
767 |
// attempting to close this connection. |
|
768 |
||
769 |
if (isBusy()) { // we are busy! |
|
770 |
writeUnlock(); |
|
771 |
if (orb.transportDebugFlag) { |
|
772 |
dprint(".close: isBusy so no close: " + this); |
|
773 |
} |
|
774 |
return; |
|
775 |
} |
|
776 |
||
777 |
try { |
|
778 |
try { |
|
779 |
sendCloseConnection(GIOPVersion.V1_0); |
|
780 |
} catch (Throwable t) { |
|
781 |
wrapper.exceptionWhenSendingCloseConnection(t); |
|
782 |
} |
|
783 |
||
784 |
synchronized ( stateEvent ){ |
|
785 |
state = CLOSE_SENT; |
|
786 |
stateEvent.notifyAll(); |
|
787 |
} |
|
788 |
||
789 |
// stop the reader without causing it to do purgeCalls |
|
790 |
//Exception ex = new Exception(); |
|
791 |
//reader.stop(ex); // REVISIT |
|
792 |
||
793 |
// NOTE: !!!!!! |
|
794 |
// This does writeUnlock(). |
|
795 |
purgeCalls(wrapper.connectionRebind(), false, true); |
|
796 |
||
797 |
} catch (Exception ex) { |
|
798 |
if (orb.transportDebugFlag) { |
|
799 |
dprint(".close: exception: " + this, ex); |
|
800 |
} |
|
801 |
} |
|
802 |
try { |
|
803 |
Selector selector = orb.getTransportManager().getSelector(0); |
|
804 |
selector.unregisterForEvent(this); |
|
805 |
if (socketChannel != null) { |
|
806 |
socketChannel.close(); |
|
807 |
} |
|
808 |
socket.close(); |
|
809 |
} catch (IOException e) { |
|
810 |
if (orb.transportDebugFlag) { |
|
811 |
dprint(".close: " + this, e); |
|
812 |
} |
|
813 |
} |
|
814 |
} finally { |
|
815 |
if (orb.transportDebugFlag) { |
|
816 |
dprint(".close<-: " + this); |
|
817 |
} |
|
818 |
} |
|
819 |
} |
|
820 |
||
821 |
public Acceptor getAcceptor() |
|
822 |
{ |
|
823 |
return acceptor; |
|
824 |
} |
|
825 |
||
826 |
public ContactInfo getContactInfo() |
|
827 |
{ |
|
828 |
return contactInfo; |
|
829 |
} |
|
830 |
||
831 |
public EventHandler getEventHandler() |
|
832 |
{ |
|
833 |
return this; |
|
834 |
} |
|
835 |
||
836 |
public OutputObject createOutputObject(MessageMediator messageMediator) |
|
837 |
{ |
|
838 |
// REVISIT - remove this method from Connection and all it subclasses. |
|
839 |
throw new RuntimeException("*****SocketOrChannelConnectionImpl.createOutputObject - should not be called."); |
|
840 |
} |
|
841 |
||
842 |
// This is used by the GIOPOutputObject in order to |
|
843 |
// throw the correct error when handling code sets. |
|
844 |
// Can we determine if we are on the server side by |
|
845 |
// other means? XREVISIT |
|
846 |
public boolean isServer() |
|
847 |
{ |
|
848 |
return isServer; |
|
849 |
} |
|
850 |
||
851 |
public boolean isBusy() |
|
852 |
{ |
|
853 |
if (serverRequestCount > 0 || |
|
854 |
getResponseWaitingRoom().numberRegistered() > 0) |
|
855 |
{ |
|
856 |
return true; |
|
857 |
} else { |
|
858 |
return false; |
|
859 |
} |
|
860 |
} |
|
861 |
||
862 |
public long getTimeStamp() |
|
863 |
{ |
|
864 |
return timeStamp; |
|
865 |
} |
|
866 |
||
867 |
public void setTimeStamp(long time) |
|
868 |
{ |
|
869 |
timeStamp = time; |
|
870 |
} |
|
871 |
||
872 |
public void setState(String stateString) |
|
873 |
{ |
|
874 |
synchronized (stateEvent) { |
|
875 |
if (stateString.equals("ESTABLISHED")) { |
|
876 |
state = ESTABLISHED; |
|
877 |
stateEvent.notifyAll(); |
|
878 |
} else { |
|
879 |
// REVISIT: ASSERT |
|
880 |
} |
|
881 |
} |
|
882 |
} |
|
883 |
||
884 |
/** |
|
885 |
* Sets the writeLock for this connection. |
|
886 |
* If the writeLock is already set by someone else, block till the |
|
887 |
* writeLock is released and can set by us. |
|
888 |
* IMPORTANT: this connection's lock must be acquired before |
|
889 |
* setting the writeLock and must be unlocked after setting the writeLock. |
|
890 |
*/ |
|
891 |
public void writeLock() |
|
892 |
{ |
|
893 |
try { |
|
894 |
if (dprintWriteLocks && orb.transportDebugFlag) { |
|
895 |
dprint(".writeLock->: " + this); |
|
896 |
} |
|
897 |
// Keep looping till we can set the writeLock. |
|
898 |
while ( true ) { |
|
899 |
int localState = state; |
|
900 |
switch ( localState ) { |
|
901 |
||
902 |
case OPENING: |
|
903 |
synchronized (stateEvent) { |
|
904 |
if (state != OPENING) { |
|
905 |
// somebody has changed 'state' so be careful |
|
906 |
break; |
|
907 |
} |
|
908 |
try { |
|
909 |
stateEvent.wait(); |
|
910 |
} catch (InterruptedException ie) { |
|
911 |
if (orb.transportDebugFlag) { |
|
912 |
dprint(".writeLock: OPENING InterruptedException: " + this); |
|
913 |
} |
|
914 |
} |
|
915 |
} |
|
916 |
// Loop back |
|
917 |
break; |
|
918 |
||
919 |
case ESTABLISHED: |
|
920 |
synchronized (writeEvent) { |
|
921 |
if (!writeLocked) { |
|
922 |
writeLocked = true; |
|
923 |
return; |
|
924 |
} |
|
925 |
||
926 |
try { |
|
927 |
// do not stay here too long if state != ESTABLISHED |
|
928 |
// Bug 4752117 |
|
929 |
while (state == ESTABLISHED && writeLocked) { |
|
930 |
writeEvent.wait(100); |
|
931 |
} |
|
932 |
} catch (InterruptedException ie) { |
|
933 |
if (orb.transportDebugFlag) { |
|
934 |
dprint(".writeLock: ESTABLISHED InterruptedException: " + this); |
|
935 |
} |
|
936 |
} |
|
937 |
} |
|
938 |
// Loop back |
|
939 |
break; |
|
940 |
||
941 |
// |
|
942 |
// XXX |
|
943 |
// Need to distinguish between client and server roles |
|
944 |
// here probably. |
|
945 |
// |
|
946 |
case ABORT: |
|
947 |
synchronized ( stateEvent ){ |
|
948 |
if (state != ABORT) { |
|
949 |
break; |
|
950 |
} |
|
951 |
throw wrapper.writeErrorSend() ; |
|
952 |
} |
|
953 |
||
954 |
case CLOSE_RECVD: |
|
955 |
// the connection has been closed or closing |
|
956 |
// ==> throw rebind exception |
|
957 |
synchronized ( stateEvent ){ |
|
958 |
if (state != CLOSE_RECVD) { |
|
959 |
break; |
|
960 |
} |
|
961 |
throw wrapper.connectionCloseRebind() ; |
|
962 |
} |
|
963 |
||
964 |
default: |
|
965 |
if (orb.transportDebugFlag) { |
|
966 |
dprint(".writeLock: default: " + this); |
|
967 |
} |
|
968 |
// REVISIT |
|
969 |
throw new RuntimeException(".writeLock: bad state"); |
|
970 |
} |
|
971 |
} |
|
972 |
} finally { |
|
973 |
if (dprintWriteLocks && orb.transportDebugFlag) { |
|
974 |
dprint(".writeLock<-: " + this); |
|
975 |
} |
|
976 |
} |
|
977 |
} |
|
978 |
||
979 |
public void writeUnlock() |
|
980 |
{ |
|
981 |
try { |
|
982 |
if (dprintWriteLocks && orb.transportDebugFlag) { |
|
983 |
dprint(".writeUnlock->: " + this); |
|
984 |
} |
|
985 |
synchronized (writeEvent) { |
|
986 |
writeLocked = false; |
|
987 |
writeEvent.notify(); // wake up one guy waiting to write |
|
988 |
} |
|
989 |
} finally { |
|
990 |
if (dprintWriteLocks && orb.transportDebugFlag) { |
|
991 |
dprint(".writeUnlock<-: " + this); |
|
992 |
} |
|
993 |
} |
|
994 |
} |
|
995 |
||
996 |
// Assumes the caller handles writeLock and writeUnlock |
|
997 |
public void sendWithoutLock(OutputObject outputObject) |
|
998 |
{ |
|
999 |
// Don't we need to check for CloseConnection |
|
1000 |
// here? REVISIT |
|
1001 |
||
1002 |
// XREVISIT - Shouldn't the MessageMediator |
|
1003 |
// be the one to handle writing the data here? |
|
1004 |
||
1005 |
try { |
|
1006 |
||
1007 |
// Write the fragment/message |
|
1008 |
||
1009 |
CDROutputObject cdrOutputObject = (CDROutputObject) outputObject; |
|
1010 |
cdrOutputObject.writeTo(this); |
|
1011 |
// REVISIT - no flush? |
|
1012 |
//socket.getOutputStream().flush(); |
|
1013 |
||
1014 |
} catch (IOException e1) { |
|
1015 |
||
1016 |
/* |
|
1017 |
* ADDED(Ram J) 10/13/2000 In the event of an IOException, try |
|
1018 |
* sending a CancelRequest for regular requests / locate requests |
|
1019 |
*/ |
|
1020 |
||
1021 |
// Since IIOPOutputStream's msgheader is set only once, and not |
|
1022 |
// altered during sending multiple fragments, the original |
|
1023 |
// msgheader will always have the requestId. |
|
1024 |
// REVISIT This could be optimized to send a CancelRequest only |
|
1025 |
// if any fragments had been sent already. |
|
1026 |
||
1027 |
/* REVISIT: MOVE TO SUBCONTRACT |
|
1028 |
Message msg = os.getMessage(); |
|
1029 |
if (msg.getType() == Message.GIOPRequest || |
|
1030 |
msg.getType() == Message.GIOPLocateRequest) { |
|
1031 |
GIOPVersion requestVersion = msg.getGIOPVersion(); |
|
1032 |
int requestId = MessageBase.getRequestId(msg); |
|
1033 |
try { |
|
1034 |
sendCancelRequest(requestVersion, requestId); |
|
1035 |
} catch (IOException e2) { |
|
1036 |
// most likely an abortive connection closure. |
|
1037 |
// ignore, since nothing more can be done. |
|
1038 |
if (orb.transportDebugFlag) { |
|
1039 |
||
1040 |
} |
|
1041 |
} |
|
1042 |
*/ |
|
1043 |
||
1044 |
// REVISIT When a send failure happens, purgeCalls() need to be |
|
1045 |
// called to ensure that the connection is properly removed from |
|
1046 |
// further usage (ie., cancelling pending requests with COMM_FAILURE |
|
1047 |
// with an appropriate minor_code CompletionStatus.MAY_BE). |
|
1048 |
||
1049 |
// Relying on the IIOPOutputStream (as noted below) is not |
|
1050 |
// sufficient as it handles COMM_FAILURE only for the final |
|
1051 |
// fragment (during invoke processing). Note that COMM_FAILURE could |
|
1052 |
// happen while sending the initial fragments. |
|
1053 |
// Also the IIOPOutputStream does not properly close the connection. |
|
1054 |
// It simply removes the connection from the table. An orderly |
|
1055 |
// closure is needed (ie., cancel pending requests on the connection |
|
1056 |
// COMM_FAILURE as well. |
|
1057 |
||
1058 |
// IIOPOutputStream will cleanup the connection info when it |
|
1059 |
// sees this exception. |
|
2664
a0a22a8f16bd
6372405: Server thread hangs when fragments don't complete because of connection abort
tbell
parents:
4
diff
changeset
|
1060 |
SystemException exc = wrapper.writeErrorSend(e1); |
a0a22a8f16bd
6372405: Server thread hangs when fragments don't complete because of connection abort
tbell
parents:
4
diff
changeset
|
1061 |
purgeCalls(exc, false, true); |
a0a22a8f16bd
6372405: Server thread hangs when fragments don't complete because of connection abort
tbell
parents:
4
diff
changeset
|
1062 |
throw exc; |
4 | 1063 |
} |
1064 |
} |
|
1065 |
||
1066 |
public void registerWaiter(MessageMediator messageMediator) |
|
1067 |
{ |
|
1068 |
responseWaitingRoom.registerWaiter(messageMediator); |
|
1069 |
} |
|
1070 |
||
1071 |
public void unregisterWaiter(MessageMediator messageMediator) |
|
1072 |
{ |
|
1073 |
responseWaitingRoom.unregisterWaiter(messageMediator); |
|
1074 |
} |
|
1075 |
||
1076 |
public InputObject waitForResponse(MessageMediator messageMediator) |
|
1077 |
{ |
|
1078 |
return responseWaitingRoom.waitForResponse(messageMediator); |
|
1079 |
} |
|
1080 |
||
1081 |
public void setConnectionCache(ConnectionCache connectionCache) |
|
1082 |
{ |
|
1083 |
this.connectionCache = connectionCache; |
|
1084 |
} |
|
1085 |
||
1086 |
public ConnectionCache getConnectionCache() |
|
1087 |
{ |
|
1088 |
return connectionCache; |
|
1089 |
} |
|
1090 |
||
1091 |
//////////////////////////////////////////////////// |
|
1092 |
// |
|
1093 |
// EventHandler methods |
|
1094 |
// |
|
1095 |
||
1096 |
public void setUseSelectThreadToWait(boolean x) |
|
1097 |
{ |
|
1098 |
useSelectThreadToWait = x; |
|
1099 |
// REVISIT - Reading of a GIOP header only is information |
|
1100 |
// that should be passed into the constructor |
|
1101 |
// from the SocketOrChannelConnection factory. |
|
1102 |
setReadGiopHeaderOnly(shouldUseSelectThreadToWait()); |
|
1103 |
} |
|
1104 |
||
1105 |
public void handleEvent() |
|
1106 |
{ |
|
1107 |
if (orb.transportDebugFlag) { |
|
1108 |
dprint(".handleEvent->: " + this); |
|
1109 |
} |
|
1110 |
getSelectionKey().interestOps(getSelectionKey().interestOps() & |
|
1111 |
(~ getInterestOps())); |
|
1112 |
||
1113 |
if (shouldUseWorkerThreadForEvent()) { |
|
1114 |
Throwable throwable = null; |
|
1115 |
try { |
|
1116 |
int poolToUse = 0; |
|
1117 |
if (shouldReadGiopHeaderOnly()) { |
|
1118 |
partialMessageMediator = readBits(); |
|
1119 |
poolToUse = |
|
1120 |
partialMessageMediator.getThreadPoolToUse(); |
|
1121 |
} |
|
1122 |
||
1123 |
if (orb.transportDebugFlag) { |
|
1124 |
dprint(".handleEvent: addWork to pool: " + poolToUse); |
|
1125 |
} |
|
1126 |
orb.getThreadPoolManager().getThreadPool(poolToUse) |
|
1127 |
.getWorkQueue(0).addWork(getWork()); |
|
1128 |
} catch (NoSuchThreadPoolException e) { |
|
1129 |
throwable = e; |
|
1130 |
} catch (NoSuchWorkQueueException e) { |
|
1131 |
throwable = e; |
|
1132 |
} |
|
1133 |
// REVISIT: need to close connection. |
|
1134 |
if (throwable != null) { |
|
1135 |
if (orb.transportDebugFlag) { |
|
1136 |
dprint(".handleEvent: " + throwable); |
|
1137 |
} |
|
1138 |
INTERNAL i = new INTERNAL("NoSuchThreadPoolException"); |
|
1139 |
i.initCause(throwable); |
|
1140 |
throw i; |
|
1141 |
} |
|
1142 |
} else { |
|
1143 |
if (orb.transportDebugFlag) { |
|
1144 |
dprint(".handleEvent: doWork"); |
|
1145 |
} |
|
1146 |
getWork().doWork(); |
|
1147 |
} |
|
1148 |
if (orb.transportDebugFlag) { |
|
1149 |
dprint(".handleEvent<-: " + this); |
|
1150 |
} |
|
1151 |
} |
|
1152 |
||
1153 |
public SelectableChannel getChannel() |
|
1154 |
{ |
|
1155 |
return socketChannel; |
|
1156 |
} |
|
1157 |
||
1158 |
public int getInterestOps() |
|
1159 |
{ |
|
1160 |
return SelectionKey.OP_READ; |
|
1161 |
} |
|
1162 |
||
1163 |
// public Acceptor getAcceptor() - already defined above. |
|
1164 |
||
1165 |
public Connection getConnection() |
|
1166 |
{ |
|
1167 |
return this; |
|
1168 |
} |
|
1169 |
||
1170 |
//////////////////////////////////////////////////// |
|
1171 |
// |
|
1172 |
// Work methods. |
|
1173 |
// |
|
1174 |
||
1175 |
public String getName() |
|
1176 |
{ |
|
1177 |
return this.toString(); |
|
1178 |
} |
|
1179 |
||
1180 |
public void doWork() |
|
1181 |
{ |
|
1182 |
try { |
|
1183 |
if (orb.transportDebugFlag) { |
|
1184 |
dprint(".doWork->: " + this); |
|
1185 |
} |
|
1186 |
||
1187 |
// IMPORTANT: Sanity checks on SelectionKeys such as |
|
1188 |
// SelectorKey.isValid() should not be done |
|
1189 |
// here. |
|
1190 |
// |
|
1191 |
||
1192 |
if (!shouldReadGiopHeaderOnly()) { |
|
1193 |
read(); |
|
1194 |
} |
|
1195 |
else { |
|
1196 |
// get the partialMessageMediator |
|
1197 |
// created by SelectorThread |
|
1198 |
CorbaMessageMediator messageMediator = |
|
1199 |
this.getPartialMessageMediator(); |
|
1200 |
||
1201 |
// read remaining info needed in a MessageMediator |
|
1202 |
messageMediator = finishReadingBits(messageMediator); |
|
1203 |
||
1204 |
if (messageMediator != null) { |
|
1205 |
// Null can happen when client closes stream |
|
1206 |
// causing purgecalls. |
|
1207 |
dispatch(messageMediator); |
|
1208 |
} |
|
1209 |
} |
|
1210 |
} catch (Throwable t) { |
|
1211 |
if (orb.transportDebugFlag) { |
|
1212 |
dprint(".doWork: ignoring Throwable: " |
|
1213 |
+ t |
|
1214 |
+ " " + this); |
|
1215 |
} |
|
1216 |
} finally { |
|
1217 |
if (orb.transportDebugFlag) { |
|
1218 |
dprint(".doWork<-: " + this); |
|
1219 |
} |
|
1220 |
} |
|
1221 |
} |
|
1222 |
||
1223 |
public void setEnqueueTime(long timeInMillis) |
|
1224 |
{ |
|
1225 |
enqueueTime = timeInMillis; |
|
1226 |
} |
|
1227 |
||
1228 |
public long getEnqueueTime() |
|
1229 |
{ |
|
1230 |
return enqueueTime; |
|
1231 |
} |
|
1232 |
||
1233 |
//////////////////////////////////////////////////// |
|
1234 |
// |
|
1235 |
// spi.transport.CorbaConnection. |
|
1236 |
// |
|
1237 |
||
1238 |
// IMPORTANT: Reader Threads must NOT read Giop header only. |
|
1239 |
public boolean shouldReadGiopHeaderOnly() { |
|
1240 |
return shouldReadGiopHeaderOnly; |
|
1241 |
} |
|
1242 |
||
1243 |
protected void setReadGiopHeaderOnly(boolean shouldReadHeaderOnly) { |
|
1244 |
shouldReadGiopHeaderOnly = shouldReadHeaderOnly; |
|
1245 |
} |
|
1246 |
||
1247 |
public ResponseWaitingRoom getResponseWaitingRoom() |
|
1248 |
{ |
|
1249 |
return responseWaitingRoom; |
|
1250 |
} |
|
1251 |
||
1252 |
// REVISIT - inteface defines isServer but already defined in |
|
1253 |
// higher interface. |
|
1254 |
||
1255 |
public void serverRequestMapPut(int requestId, |
|
1256 |
CorbaMessageMediator messageMediator) |
|
1257 |
{ |
|
1258 |
serverRequestMap.put(new Integer(requestId), messageMediator); |
|
1259 |
} |
|
1260 |
||
1261 |
public CorbaMessageMediator serverRequestMapGet(int requestId) |
|
1262 |
{ |
|
1263 |
return (CorbaMessageMediator) |
|
1264 |
serverRequestMap.get(new Integer(requestId)); |
|
1265 |
} |
|
1266 |
||
1267 |
public void serverRequestMapRemove(int requestId) |
|
1268 |
{ |
|
1269 |
serverRequestMap.remove(new Integer(requestId)); |
|
1270 |
} |
|
1271 |
||
1272 |
||
1273 |
// REVISIT: this is also defined in: |
|
1274 |
// com.sun.corba.se.spi.legacy.connection.Connection |
|
1275 |
public java.net.Socket getSocket() |
|
1276 |
{ |
|
1277 |
return socket; |
|
1278 |
} |
|
1279 |
||
1280 |
/** It is possible for a Close Connection to have been |
|
1281 |
** sent here, but we will not check for this. A "lazy" |
|
1282 |
** Exception will be thrown in the Worker thread after the |
|
1283 |
** incoming request has been processed even though the connection |
|
1284 |
** is closed before the request is processed. This is o.k because |
|
1285 |
** it is a boundary condition. To prevent it we would have to add |
|
1286 |
** more locks which would reduce performance in the normal case. |
|
1287 |
**/ |
|
1288 |
public synchronized void serverRequestProcessingBegins() |
|
1289 |
{ |
|
1290 |
serverRequestCount++; |
|
1291 |
} |
|
1292 |
||
1293 |
public synchronized void serverRequestProcessingEnds() |
|
1294 |
{ |
|
1295 |
serverRequestCount--; |
|
1296 |
} |
|
1297 |
||
1298 |
// |
|
1299 |
// |
|
1300 |
// |
|
1301 |
||
1302 |
public synchronized int getNextRequestId() |
|
1303 |
{ |
|
1304 |
return requestId++; |
|
1305 |
} |
|
1306 |
||
1307 |
// Negotiated code sets for char and wchar data |
|
1308 |
protected CodeSetComponentInfo.CodeSetContext codeSetContext = null; |
|
1309 |
||
1310 |
public ORB getBroker() |
|
1311 |
{ |
|
1312 |
return orb; |
|
1313 |
} |
|
1314 |
||
1315 |
public CodeSetComponentInfo.CodeSetContext getCodeSetContext() { |
|
1316 |
// Needs to be synchronized for the following case when the client |
|
1317 |
// doesn't send the code set context twice, and we have two threads |
|
1318 |
// in ServerRequestDispatcher processCodeSetContext. |
|
1319 |
// |
|
1320 |
// Thread A checks to see if there is a context, there is none, so |
|
1321 |
// it calls setCodeSetContext, getting the synch lock. |
|
1322 |
// Thread B checks to see if there is a context. If we didn't synch, |
|
1323 |
// it might decide to outlaw wchar/wstring. |
|
1324 |
if (codeSetContext == null) { |
|
1325 |
synchronized(this) { |
|
1326 |
return codeSetContext; |
|
1327 |
} |
|
1328 |
} |
|
1329 |
||
1330 |
return codeSetContext; |
|
1331 |
} |
|
1332 |
||
1333 |
public synchronized void setCodeSetContext(CodeSetComponentInfo.CodeSetContext csc) { |
|
1334 |
// Double check whether or not we need to do this |
|
1335 |
if (codeSetContext == null) { |
|
1336 |
||
1337 |
if (OSFCodeSetRegistry.lookupEntry(csc.getCharCodeSet()) == null || |
|
1338 |
OSFCodeSetRegistry.lookupEntry(csc.getWCharCodeSet()) == null) { |
|
1339 |
// If the client says it's negotiated a code set that |
|
1340 |
// isn't a fallback and we never said we support, then |
|
1341 |
// it has a bug. |
|
1342 |
throw wrapper.badCodesetsFromClient() ; |
|
1343 |
} |
|
1344 |
||
1345 |
codeSetContext = csc; |
|
1346 |
} |
|
1347 |
} |
|
1348 |
||
1349 |
// |
|
1350 |
// from iiop.IIOPConnection.java |
|
1351 |
// |
|
1352 |
||
1353 |
// Map request ID to an InputObject. |
|
1354 |
// This is so the client thread can start unmarshaling |
|
1355 |
// the reply and remove it from the out_calls map while the |
|
1356 |
// ReaderThread can still obtain the input stream to give |
|
1357 |
// new fragments. Only the ReaderThread touches the clientReplyMap, |
|
1358 |
// so it doesn't incur synchronization overhead. |
|
1359 |
||
1360 |
public MessageMediator clientRequestMapGet(int requestId) |
|
1361 |
{ |
|
1362 |
return responseWaitingRoom.getMessageMediator(requestId); |
|
1363 |
} |
|
1364 |
||
1365 |
protected MessageMediator clientReply_1_1; |
|
1366 |
||
1367 |
public void clientReply_1_1_Put(MessageMediator x) |
|
1368 |
{ |
|
1369 |
clientReply_1_1 = x; |
|
1370 |
} |
|
1371 |
||
1372 |
public MessageMediator clientReply_1_1_Get() |
|
1373 |
{ |
|
1374 |
return clientReply_1_1; |
|
1375 |
} |
|
1376 |
||
1377 |
public void clientReply_1_1_Remove() |
|
1378 |
{ |
|
1379 |
clientReply_1_1 = null; |
|
1380 |
} |
|
1381 |
||
1382 |
protected MessageMediator serverRequest_1_1; |
|
1383 |
||
1384 |
public void serverRequest_1_1_Put(MessageMediator x) |
|
1385 |
{ |
|
1386 |
serverRequest_1_1 = x; |
|
1387 |
} |
|
1388 |
||
1389 |
public MessageMediator serverRequest_1_1_Get() |
|
1390 |
{ |
|
1391 |
return serverRequest_1_1; |
|
1392 |
} |
|
1393 |
||
1394 |
public void serverRequest_1_1_Remove() |
|
1395 |
{ |
|
1396 |
serverRequest_1_1 = null; |
|
1397 |
} |
|
1398 |
||
1399 |
protected String getStateString( int state ) |
|
1400 |
{ |
|
1401 |
synchronized ( stateEvent ){ |
|
1402 |
switch (state) { |
|
1403 |
case OPENING : return "OPENING" ; |
|
1404 |
case ESTABLISHED : return "ESTABLISHED" ; |
|
1405 |
case CLOSE_SENT : return "CLOSE_SENT" ; |
|
1406 |
case CLOSE_RECVD : return "CLOSE_RECVD" ; |
|
1407 |
case ABORT : return "ABORT" ; |
|
1408 |
default : return "???" ; |
|
1409 |
} |
|
1410 |
} |
|
1411 |
} |
|
1412 |
||
1413 |
public synchronized boolean isPostInitialContexts() { |
|
1414 |
return postInitialContexts; |
|
1415 |
} |
|
1416 |
||
1417 |
// Can never be unset... |
|
1418 |
public synchronized void setPostInitialContexts(){ |
|
1419 |
postInitialContexts = true; |
|
1420 |
} |
|
1421 |
||
1422 |
/** |
|
1423 |
* Wake up the outstanding requests on the connection, and hand them |
|
1424 |
* COMM_FAILURE exception with a given minor code. |
|
1425 |
* |
|
1426 |
* Also, delete connection from connection table and |
|
1427 |
* stop the reader thread. |
|
1428 |
||
1429 |
* Note that this should only ever be called by the Reader thread for |
|
1430 |
* this connection. |
|
1431 |
* |
|
1432 |
* @param minor_code The minor code for the COMM_FAILURE major code. |
|
1433 |
* @param die Kill the reader thread (this thread) before exiting. |
|
1434 |
*/ |
|
1435 |
public void purgeCalls(SystemException systemException, |
|
1436 |
boolean die, boolean lockHeld) |
|
1437 |
{ |
|
1438 |
int minor_code = systemException.minor; |
|
1439 |
||
1440 |
try{ |
|
1441 |
if (orb.transportDebugFlag) { |
|
1442 |
dprint(".purgeCalls->: " |
|
1443 |
+ minor_code + "/" + die + "/" + lockHeld |
|
1444 |
+ " " + this); |
|
1445 |
} |
|
1446 |
||
1447 |
// If this invocation is a result of ThreadDeath caused |
|
1448 |
// by a previous execution of this routine, just exit. |
|
1449 |
||
1450 |
synchronized ( stateEvent ){ |
|
1451 |
if ((state == ABORT) || (state == CLOSE_RECVD)) { |
|
1452 |
if (orb.transportDebugFlag) { |
|
1453 |
dprint(".purgeCalls: exiting since state is: " |
|
1454 |
+ getStateString(state) |
|
1455 |
+ " " + this); |
|
1456 |
} |
|
1457 |
return; |
|
1458 |
} |
|
1459 |
} |
|
1460 |
||
1461 |
// Grab the writeLock (freeze the calls) |
|
1462 |
try { |
|
1463 |
if (!lockHeld) { |
|
1464 |
writeLock(); |
|
1465 |
} |
|
1466 |
} catch (SystemException ex) { |
|
1467 |
if (orb.transportDebugFlag) |
|
1468 |
dprint(".purgeCalls: SystemException" + ex |
|
1469 |
+ "; continuing " + this); |
|
1470 |
} |
|
1471 |
||
1472 |
// Mark the state of the connection |
|
1473 |
// and determine the request status |
|
1474 |
org.omg.CORBA.CompletionStatus completion_status; |
|
1475 |
synchronized ( stateEvent ){ |
|
1476 |
if (minor_code == ORBUtilSystemException.CONNECTION_REBIND) { |
|
1477 |
state = CLOSE_RECVD; |
|
1478 |
systemException.completed = CompletionStatus.COMPLETED_NO; |
|
1479 |
} else { |
|
1480 |
state = ABORT; |
|
1481 |
systemException.completed = CompletionStatus.COMPLETED_MAYBE; |
|
1482 |
} |
|
1483 |
stateEvent.notifyAll(); |
|
1484 |
} |
|
1485 |
||
1486 |
try { |
|
1487 |
socket.getInputStream().close(); |
|
1488 |
socket.getOutputStream().close(); |
|
1489 |
socket.close(); |
|
1490 |
} catch (Exception ex) { |
|
1491 |
if (orb.transportDebugFlag) { |
|
1492 |
dprint(".purgeCalls: Exception closing socket: " + ex |
|
1493 |
+ " " + this); |
|
1494 |
} |
|
1495 |
} |
|
1496 |
||
1497 |
// Signal all threads with outstanding requests on this |
|
1498 |
// connection and give them the SystemException; |
|
1499 |
||
1500 |
responseWaitingRoom.signalExceptionToAllWaiters(systemException); |
|
1501 |
||
1502 |
if (contactInfo != null) { |
|
1503 |
((OutboundConnectionCache)getConnectionCache()).remove(contactInfo); |
|
1504 |
} else if (acceptor != null) { |
|
1505 |
((InboundConnectionCache)getConnectionCache()).remove(this); |
|
1506 |
} |
|
1507 |
||
1508 |
// |
|
1509 |
// REVISIT: Stop the reader thread |
|
1510 |
// |
|
1511 |
||
1512 |
// Signal all the waiters of the writeLock. |
|
1513 |
// There are 4 types of writeLock waiters: |
|
1514 |
// 1. Send waiters: |
|
1515 |
// 2. SendReply waiters: |
|
1516 |
// 3. cleanUp waiters: |
|
1517 |
// 4. purge_call waiters: |
|
1518 |
// |
|
1519 |
||
1520 |
writeUnlock(); |
|
1521 |
||
1522 |
} finally { |
|
1523 |
if (orb.transportDebugFlag) { |
|
1524 |
dprint(".purgeCalls<-: " |
|
1525 |
+ minor_code + "/" + die + "/" + lockHeld |
|
1526 |
+ " " + this); |
|
1527 |
} |
|
1528 |
} |
|
1529 |
} |
|
1530 |
||
1531 |
/************************************************************************* |
|
1532 |
* The following methods are for dealing with Connection cleaning for |
|
1533 |
* better scalability of servers in high network load conditions. |
|
1534 |
**************************************************************************/ |
|
1535 |
||
1536 |
public void sendCloseConnection(GIOPVersion giopVersion) |
|
1537 |
throws IOException |
|
1538 |
{ |
|
1539 |
Message msg = MessageBase.createCloseConnection(giopVersion); |
|
1540 |
sendHelper(giopVersion, msg); |
|
1541 |
} |
|
1542 |
||
1543 |
public void sendMessageError(GIOPVersion giopVersion) |
|
1544 |
throws IOException |
|
1545 |
{ |
|
1546 |
Message msg = MessageBase.createMessageError(giopVersion); |
|
1547 |
sendHelper(giopVersion, msg); |
|
1548 |
} |
|
1549 |
||
1550 |
/** |
|
1551 |
* Send a CancelRequest message. This does not lock the connection, so the |
|
1552 |
* caller needs to ensure this method is called appropriately. |
|
1553 |
* @exception IOException - could be due to abortive connection closure. |
|
1554 |
*/ |
|
1555 |
public void sendCancelRequest(GIOPVersion giopVersion, int requestId) |
|
1556 |
throws IOException |
|
1557 |
{ |
|
1558 |
||
1559 |
Message msg = MessageBase.createCancelRequest(giopVersion, requestId); |
|
1560 |
sendHelper(giopVersion, msg); |
|
1561 |
} |
|
1562 |
||
1563 |
protected void sendHelper(GIOPVersion giopVersion, Message msg) |
|
1564 |
throws IOException |
|
1565 |
{ |
|
1566 |
// REVISIT: See comments in CDROutputObject constructor. |
|
1567 |
CDROutputObject outputObject = |
|
1568 |
new CDROutputObject((ORB)orb, null, giopVersion, this, msg, |
|
1569 |
ORBConstants.STREAM_FORMAT_VERSION_1); |
|
1570 |
msg.write(outputObject); |
|
1571 |
||
1572 |
outputObject.writeTo(this); |
|
1573 |
} |
|
1574 |
||
1575 |
public void sendCancelRequestWithLock(GIOPVersion giopVersion, |
|
1576 |
int requestId) |
|
1577 |
throws IOException |
|
1578 |
{ |
|
1579 |
writeLock(); |
|
1580 |
try { |
|
1581 |
sendCancelRequest(giopVersion, requestId); |
|
1582 |
} finally { |
|
1583 |
writeUnlock(); |
|
1584 |
} |
|
1585 |
} |
|
1586 |
||
1587 |
// Begin Code Base methods --------------------------------------- |
|
1588 |
// |
|
1589 |
// Set this connection's code base IOR. The IOR comes from the |
|
1590 |
// SendingContext. This is an optional service context, but all |
|
1591 |
// JavaSoft ORBs send it. |
|
1592 |
// |
|
1593 |
// The set and get methods don't need to be synchronized since the |
|
1594 |
// first possible get would occur during reading a valuetype, and |
|
1595 |
// that would be after the set. |
|
1596 |
||
1597 |
// Sets this connection's code base IOR. This is done after |
|
1598 |
// getting the IOR out of the SendingContext service context. |
|
1599 |
// Our ORBs always send this, but it's optional in CORBA. |
|
1600 |
||
1601 |
public final void setCodeBaseIOR(IOR ior) { |
|
1602 |
codeBaseServerIOR = ior; |
|
1603 |
} |
|
1604 |
||
1605 |
public final IOR getCodeBaseIOR() { |
|
1606 |
return codeBaseServerIOR; |
|
1607 |
} |
|
1608 |
||
1609 |
// Get a CodeBase stub to use in unmarshaling. The CachedCodeBase |
|
1610 |
// won't connect to the remote codebase unless it's necessary. |
|
1611 |
public final CodeBase getCodeBase() { |
|
1612 |
return cachedCodeBase; |
|
1613 |
} |
|
1614 |
||
1615 |
// End Code Base methods ----------------------------------------- |
|
1616 |
||
1617 |
// set transport read thresholds |
|
1618 |
protected void setReadTimeouts(ReadTimeouts readTimeouts) { |
|
1619 |
this.readTimeouts = readTimeouts; |
|
1620 |
} |
|
1621 |
||
1622 |
protected void setPartialMessageMediator(CorbaMessageMediator messageMediator) { |
|
1623 |
partialMessageMediator = messageMediator; |
|
1624 |
} |
|
1625 |
||
1626 |
protected CorbaMessageMediator getPartialMessageMediator() { |
|
1627 |
return partialMessageMediator; |
|
1628 |
} |
|
1629 |
||
1630 |
public String toString() |
|
1631 |
{ |
|
1632 |
synchronized ( stateEvent ){ |
|
1633 |
return |
|
1634 |
"SocketOrChannelConnectionImpl[" + " " |
|
1635 |
+ (socketChannel == null ? |
|
1636 |
socket.toString() : socketChannel.toString()) + " " |
|
1637 |
+ getStateString( state ) + " " |
|
1638 |
+ shouldUseSelectThreadToWait() + " " |
|
1639 |
+ shouldUseWorkerThreadForEvent() + " " |
|
1640 |
+ shouldReadGiopHeaderOnly() |
|
1641 |
+ "]" ; |
|
1642 |
} |
|
1643 |
} |
|
1644 |
||
1645 |
// Must be public - used in encoding. |
|
1646 |
public void dprint(String msg) |
|
1647 |
{ |
|
1648 |
ORBUtility.dprint("SocketOrChannelConnectionImpl", msg); |
|
1649 |
} |
|
1650 |
||
1651 |
protected void dprint(String msg, Throwable t) |
|
1652 |
{ |
|
1653 |
dprint(msg); |
|
1654 |
t.printStackTrace(System.out); |
|
1655 |
} |
|
1656 |
} |
|
1657 |
||
1658 |
// End of file. |