private static void PrintIdentityFacetOperation(System.IO.StringWriter s, Ice.InputStream str) { try { Ice.ToStringMode toStringMode = str.Communicator.ToStringMode; var identity = new Ice.Identity(str); s.Write("\nidentity = " + identity.ToString(toStringMode)); string[] facet = str.ReadStringArray(); s.Write("\nfacet = "); if (facet.Length > 0) { s.Write(IceUtilInternal.StringUtil.EscapeString(facet[0], "", toStringMode)); } string operation = str.ReadString(); s.Write("\noperation = " + operation); } catch (System.IO.IOException) { Debug.Assert(false); } }
public void Invoke(Ice.InputStream stream) { _is = stream; int start = _is.Pos; // // Read the current. // var id = new Ice.Identity(_is); // // For compatibility with the old FacetPath. // string[] facetPath = _is.ReadStringArray(); string facet; if (facetPath.Length > 0) { if (facetPath.Length > 1) { throw new Ice.MarshalException(); } facet = facetPath[0]; } else { facet = ""; } string operation = _is.ReadString(); byte mode = _is.ReadByte(); var context = new Dictionary <string, string>(); int sz = _is.ReadSize(); while (sz-- > 0) { string first = _is.ReadString(); string second = _is.ReadString(); context[first] = second; } _current = new Ice.Current(_adapter, id, facet, operation, (Ice.OperationMode)mode, context, _requestId, _connection); Ice.Instrumentation.ICommunicatorObserver?obsv = _communicator.Observer; if (obsv != null) { // Read the encapsulation size. int size = _is.ReadInt(); _is.Pos -= 4; _observer = obsv.GetDispatchObserver(_current, _is.Pos - start + size); if (_observer != null) { _observer.Attach(); } } // // Don't put the code above into the try block below. Exceptions // in the code above are considered fatal, and must propagate to // the caller of this operation. // _servant = _adapter.Find(_current.Id, _current.Facet); if (_servant == null) { try { throw new Ice.ObjectNotExistException(_current.Id, _current.Facet, _current.Operation); } catch (Exception ex) { SkipReadParams(); // Required for batch requests HandleException(ex, false); return; } } try { Task <Ice.OutputStream?>?task = _servant.Dispatch(this, _current); if (task == null) { Completed(null, false); } else { if (task.IsCompleted) { _os = task.GetAwaiter().GetResult(); // Get the response Completed(null, false); } else { task.ContinueWith((Task <Ice.OutputStream> t) => { try { _os = t.GetAwaiter().GetResult(); Completed(null, true); // true = asynchronous } catch (Exception ex) { Completed(ex, true); // true = asynchronous } }, CancellationToken.None, TaskContinuationOptions.ExecuteSynchronously, scheduler: TaskScheduler.Current); } } } catch (Exception ex) { Completed(ex, false); } }