1
1
// **********************************************************************
3
// Copyright (c) 2003-2010 ZeroC, Inc. All rights reserved.
3
// Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
5
5
// This copy of Ice is licensed to you under the terms described in the
6
6
// ICE_LICENSE file included in this distribution.
1068
1068
info = parseMessage(current.stream); // Optimization: use the thread's stream.
1072
// We increment the dispatch count to prevent the
1073
// communicator destruction during the callback.
1075
if(sentCBs != null || info != null && info.outAsync != null)
1072
1081
catch(DatagramLimitException ex) // Expected.
1214
// Decrease dispatch count.
1216
if(sentCBs != null || info != null && info.outAsync != null)
1220
if(--_dispatchCount == 0)
1222
if(_state == StateClosing)
1228
catch(LocalException ex)
1230
setState(StateClosed, ex);
1233
else if(_state == StateFinished)
1263
1301
_startCallback = null;
1267
// NOTE: for twoway requests which are not sent, finished can be called twice: the
1268
// first time because the outgoing is in the _sendStreams set and the second time
1269
// because it's either in the _requests/_asyncRequests set. This is fine, only the
1270
// first call should be taken into account by the implementation of finished.
1273
for(OutgoingMessage p : _sendStreams)
1304
if(!_sendStreams.isEmpty())
1307
// Return the stream to the outgoing call. This is important for
1308
// retriable AMI calls which are not marshalled again.
1310
OutgoingMessage message = _sendStreams.getFirst();
1311
_writeStream.swap(message.stream);
1314
// NOTE: for twoway requests which are not sent, finished can be called twice: the
1315
// first time because the outgoing is in the _sendStreams set and the second time
1316
// because it's either in the _requests/_asyncRequests set. This is fine, only the
1317
// first call should be taken into account by the implementation of finished.
1319
for(OutgoingMessage p : _sendStreams)
1277
if(p.out != null) // Make sure finished isn't called twice.
1279
_requests.remove(p.requestId);
1283
_asyncRequests.remove(p.requestId);
1323
if(p.out != null) // Make sure finished isn't called twice.
1325
_requests.remove(p.requestId);
1329
_asyncRequests.remove(p.requestId);
1332
p.finished(_exception);
1286
p.finished(_exception);
1334
_sendStreams.clear();
1288
_sendStreams.clear();
1290
1337
for(IceInternal.Outgoing p : _requests.values())
2330
2375
catch(java.lang.AssertionError ex) // Upon assertion, we print the stack trace.
2332
UnknownException uex = new UnknownException();
2377
UnknownException uex = new UnknownException(ex);
2333
2378
java.io.StringWriter sw = new java.io.StringWriter();
2334
2379
java.io.PrintWriter pw = new java.io.PrintWriter(sw);
2335
2380
ex.printStackTrace(pw);
2341
2386
catch(java.lang.OutOfMemoryError ex)
2343
UnknownException uex = new UnknownException();
2388
UnknownException uex = new UnknownException(ex);
2344
2389
java.io.StringWriter sw = new java.io.StringWriter();
2345
2390
java.io.PrintWriter pw = new java.io.PrintWriter(sw);
2346
2391
ex.printStackTrace(pw);