public void reap(Ice.ConnectionI connection) { lock (this) { _reapedConnections.Add(connection); } }
// // These functions allow this object to be reused, rather than reallocated. // public virtual void reset(Instance instance, Ice.ConnectionI connection, Ice.ObjectAdapter adapter, bool response, byte compress, int requestId) { instance_ = instance; // // Don't recycle the Current object, because servants may keep a reference to it. // current_ = new Ice.Current(); current_.id = new Ice.Identity(); current_.adapter = adapter; current_.con = connection; current_.requestId = requestId; Debug.Assert(cookie_ == null); response_ = response; compress_ = compress; if (response_ && os_ == null) { os_ = new BasicStream(instance, Ice.Util.currentProtocolEncoding); } connection_ = connection; interceptorAsyncCallbackList_ = null; }
public BatchOutgoing(Ice.ConnectionI connection, Instance instance, InvocationObserver observer) { _connection = connection; _sent = false; _observer = observer; _os = new BasicStream(instance, Ice.Util.currentProtocolEncoding); }
public ConnectionRequestHandler(Reference @ref, Ice.ConnectionI connection, bool compress) { _reference = @ref; _response = _reference.getMode() == Reference.Mode.ModeTwoway; _connection = connection; _compress = compress; }
// // Implementation of Reference.GetConnectionCallback // public void setConnection(Ice.ConnectionI connection, bool compress) { lock (this) { Debug.Assert(_exception == null && _connection == null); _connection = connection; _compress = compress; } // // If this proxy is for a non-local object, and we are using a router, then // add this proxy to the router info object. // RouterInfo ri = _reference.getRouterInfo(); if (ri != null && !ri.addProxy(_proxy, this)) { return; // The request handler will be initialized once addProxy returns. } // // We can now send the queued requests. // flushRequests(); }
public void flushConnection(Ice.ConnectionI con) { lock (this) { ++_useCount; } try { Ice.AsyncCallback sentCB = null; FlushBatch flush = new FlushBatch(this); int batchRequestNum = con.getBatchRequestQueue().swap(flush.getOs()); if (batchRequestNum == 0) { flush.sent(); } else { con.sendAsyncRequest(flush, false, false, batchRequestNum, out sentCB); } Debug.Assert(sentCB == null); } catch (Ice.LocalException ex) { doCheck(false); throw ex; } }
public void setAdapterOnConnection(Ice.ConnectionI connection) { lock (this) { checkForDeactivation(); connection.setAdapterAndServantManager(this, _servantManager); } }
public void add(Ice.ConnectionI connection) { lock (this) { Debug.Assert(instance_ != null); _connections.Add(connection); } }
public void remove(Ice.ConnectionI connection) { lock (this) { Debug.Assert(instance_ != null); _connections.Remove(connection); } }
public override int invokeRemote(Ice.ConnectionI connection, bool compress, bool response) { cachedConnection_ = connection; if (responseImpl(false, true, true)) { invokeResponseAsync(); } return(AsyncStatusSent); }
public override bool invokeRemote(Ice.ConnectionI con, bool compress, bool resp, out Ice.AsyncCallback sentCB) { if (_batchRequestNum == 0) { sentCB = sent(); return(true); } cachedConnection_ = con; return(con.sendAsyncRequest(this, compress, false, _batchRequestNum, out sentCB)); }
add(Ice.ConnectionI connection, Ice.Instrumentation.Observer observer) { lock (this) { _connections.Add(connection); if (observer != null) { observer.detach(); } } }
public FixedReference(Instance instance, Ice.Communicator communicator, Ice.Identity identity, string facet, Reference.Mode mode, bool secure, Ice.ConnectionI connection) : base(instance, communicator, identity, facet, mode, secure) { _fixedConnection = connection; }
public override bool invokeRemote(Ice.ConnectionI con, bool compress, bool resp, out Ice.AsyncCallback sentCB) { sentCB = null; cachedConnection_ = con; Ice.AsyncCallback cb = finished(true); if (cb != null) { invokeCompletedAsync(cb); } return(true); }
public void remove(Ice.ConnectionI connection) { lock (this) { Debug.Assert(_connection == connection); _connection = null; if (_config.timeout > 0) { _timer.cancel(this); } } }
public void add(Ice.ConnectionI connection) { lock (this) { Debug.Assert(_connection == null); _connection = connection; if (_config.timeout > 0) { _timer.scheduleRepeated(this, _config.timeout / 2); } } }
public void remove(Ice.ConnectionI connection) { if (_config.timeout == 0) { return; } lock (this) { Debug.Assert(_instance != null); _changes.Add(new Change(connection, true)); } }
public Ice.ConnectionI sendRequest(Outgoing @out) { Ice.ConnectionI connection = getConnection(true); Debug.Assert(connection != null); if (!connection.sendRequest(@out, _compress, _response) || _response) { return(_connection); // The request has been sent or we're expecting a response. } else { return(null); // The request hasn't been sent yet. } }
public Incoming(Ice.Communicator communicator, ResponseHandler handler, Ice.ConnectionI connection, Ice.ObjectAdapter adapter, bool response, byte compress, int requestId) { _communicator = communicator; _responseHandler = handler; _response = response; _compress = compress; _current = new Ice.Current(); _current.id = new Ice.Identity(); _current.adapter = adapter; _current.con = connection; _current.requestId = requestId; _cookie = null; }
public Incoming(Instance instance, Ice.ConnectionI connection, Ice.ObjectAdapter adapter, bool response, byte compress, int requestId) : base(instance, connection, adapter, response, compress, requestId) { // // Prepare the response if necessary. // if (response) { os_.writeBlob(IceInternal.Protocol.replyHdr); // // Add the request ID. // os_.writeInt(requestId); } }
public ConnectionRequestHandler(Reference @ref, Ice.ObjectPrx proxy) { _reference = @ref; _response = _reference.getMode() == Reference.Mode.ModeTwoway; _connection = _reference.getConnection(out _compress); // // If this proxy is for a non-local object, and we are using a router, then // add this proxy to the router info object. // IceInternal.RouterInfo ri = _reference.getRouterInfo(); if(ri != null) { ri.addProxy(proxy); } }
public Reference create(Ice.Identity ident, Ice.ConnectionI connection) { if (ident.name.Length == 0 && ident.category.Length == 0) { return(null); } // // Create new reference // return(new FixedReference( instance_, _communicator, ident, "", // Facet connection.endpoint().datagram() ? Reference.Mode.ModeDatagram : Reference.Mode.ModeTwoway, connection.endpoint().secure(), instance_.defaultsAndOverrides().defaultEncoding, connection)); }
protected internal IncomingBase(Instance instance, Ice.ConnectionI connection, Ice.ObjectAdapter adapter, bool response, byte compress, int requestId) { instance_ = instance; response_ = response; compress_ = compress; if (response_) { os_ = new BasicStream(instance, Ice.Util.currentProtocolEncoding); } connection_ = connection; current_ = new Ice.Current(); current_.id = new Ice.Identity(); current_.adapter = adapter; current_.con = connection; current_.requestId = requestId; cookie_ = null; }
public void add(Ice.ConnectionI connection) { if (_config.timeout == 0) { return; } lock (this) { if (_connections.Count == 0) { _connections.Add(connection); _instance.timer().scheduleRepeated(this, _config.timeout / 2); } else { _changes.Add(new Change(connection, false)); } } }
// // These functions allow this object to be reused, rather than reallocated. // public void reset(Ice.Communicator communicator, ResponseHandler handler, Ice.ConnectionI connection, Ice.ObjectAdapter adapter, bool response, byte compress, int requestId) { _communicator = communicator; _responseHandler = handler; _response = response; _compress = compress; // // Don't recycle the Current object, because servants may keep a reference to it. // _current = null; _adapter = adapter; _connection = connection; _requestId = requestId; Debug.Assert(_cookie == null); _inParamPos = -1; }
// // These functions allow this object to be reused, rather than reallocated. // public void reset(Instance instance, ResponseHandler handler, Ice.ConnectionI connection, Ice.ObjectAdapter adapter, bool response, byte compress, int requestId) { _instance = instance; _responseHandler = handler; _response = response; _compress = compress; // // Don't recycle the Current object, because servants may keep a reference to it. // _current = new Ice.Current(); _current.id = new Ice.Identity(); _current.adapter = adapter; _current.con = connection; _current.requestId = requestId; Debug.Assert(_cookie == null); _inParamPos = -1; }
// // These functions allow this object to be reused, rather than reallocated. // public override void reset(Instance instance, Ice.ConnectionI connection, Ice.ObjectAdapter adapter, bool response, byte compress, int requestId) { _cb = null; _inParamPos = -1; base.reset(instance, connection, adapter, response, compress, requestId); // // Prepare the response if necessary. // if (response) { os_.writeBlob(IceInternal.Protocol.replyHdr); // // Add the request ID. // os_.writeInt(requestId); } }
public void add(Ice.ConnectionI connection) { if (_config.timeout == 0) { return; } lock (this) { if (_connections.Count == 0) { Debug.Assert(_communicator != null); _connections.Add(connection); _communicator.timer().scheduleRepeated(this, _config.timeout / 2); } else { _changes.Add(new Change(connection, false)); } } }
public void runTimerTask() { Ice.ConnectionI[] connections = null; lock (this) { if (instance_ == null) { return; } connections = new Ice.ConnectionI[_connections.Count]; _connections.CopyTo(connections); } // // Monitor connections outside the thread synchronization, // so that connections can be added or removed during // monitoring. // long now = IceInternal.Time.currentMonotonicTimeMillis(); foreach (Ice.ConnectionI connection in connections) { try { connection.monitor(now); } catch (System.Exception ex) { lock (this) { if (instance_ == null) { return; } instance_.initializationData().logger.error("unknown exception in connection monitor:\n" + ex); } } } }
public Reference create(Ice.Identity ident, Ice.ConnectionI connection) { if (ident.name.Length == 0 && ident.category.Length == 0) { return(null); } // // Create new reference // return(new FixedReference( _instance, _communicator, ident, "", // Facet connection.endpoint().datagram() ? Reference.Mode.ModeDatagram : Reference.Mode.ModeTwoway, connection.endpoint().secure(), Ice.Util.Protocol_1_0, _instance.defaultsAndOverrides().defaultEncoding, connection, -1, null, new Ice.Optional <bool>())); }
internal Change(Ice.ConnectionI connection, bool remove) { this.connection = connection; this.remove = remove; }
public BatchOutgoing(Ice.ConnectionI connection, Instance instance) { _connection = connection; _sent = false; _os = new BasicStream(instance); }
public void reap(Ice.ConnectionI connection) { _parent.reap(connection); }
public void runTimerTask() { Ice.ConnectionI[] connections = null; lock(this) { if(instance_ == null) { return; } connections = new Ice.ConnectionI[_connections.Count]; _connections.CopyTo(connections); } // // Monitor connections outside the thread synchronization, // so that connections can be added or removed during // monitoring. // long now = IceInternal.Time.currentMonotonicTimeMillis(); foreach(Ice.ConnectionI connection in connections) { try { connection.monitor(now); } catch(System.Exception ex) { lock(this) { if(instance_ == null) { return; } instance_.initializationData().logger.error("unknown exception in connection monitor:\n" + ex); } } } }
public TimeoutCallback(ConnectionI connection) { _connection = connection; }
public void remove(Ice.ConnectionI connection) { lock(this) { Debug.Assert(_connection == connection); _connection = null; if(_config.timeout > 0) { _timer.cancel(this); } } }
public void add(Ice.ConnectionI connection) { lock(this) { Debug.Assert(_connection == null); _connection = connection; if(_config.timeout > 0) { _timer.scheduleRepeated(this, _config.timeout / 2); } } }
// // Implementation of Reference.GetConnectionCallback // public void setConnection(Ice.ConnectionI connection, bool compress) { lock(this) { Debug.Assert(_exception == null && _connection == null); _connection = connection; _compress = compress; } // // If this proxy is for a non-local object, and we are using a router, then // add this proxy to the router info object. // RouterInfo ri = _reference.getRouterInfo(); if(ri != null && !ri.addProxy(_proxy, this)) { return; // The request handler will be initialized once addProxy returns. } // // We can now send the queued requests. // flushRequests(); }
protected internal IncomingBase(Instance instance, Ice.ConnectionI connection, Ice.ObjectAdapter adapter, bool response, byte compress, int requestId) { instance_ = instance; response_ = response; compress_ = compress; os_ = new BasicStream(instance); connection_ = connection; current_ = new Ice.Current(); current_.id = new Ice.Identity(); current_.adapter = adapter; current_.con = connection; current_.requestId = requestId; cookie_ = null; }
// // These functions allow this object to be reused, rather than reallocated. // public virtual void reset(Instance instance, Ice.ConnectionI connection, Ice.ObjectAdapter adapter, bool response, byte compress, int requestId) { instance_ = instance; // // Don't recycle the Current object, because servants may keep a reference to it. // current_ = new Ice.Current(); current_.id = new Ice.Identity(); current_.adapter = adapter; current_.con = connection; current_.requestId = requestId; Debug.Assert(cookie_ == null); response_ = response; compress_ = compress; if(os_ == null) { os_ = new BasicStream(instance); } connection_ = connection; interceptorAsyncCallbackList_ = null; }
internal void adopt(IncomingBase inc) { instance_ = inc.instance_; //inc.instance_ = null; // Don't reset instance_. servant_ = inc.servant_; inc.servant_ = null; locator_ = inc.locator_; inc.locator_ = null; cookie_ = inc.cookie_; inc.cookie_ = null; response_ = inc.response_; inc.response_ = false; compress_ = inc.compress_; inc.compress_ = 0; // // Adopt the stream - it creates less garbage. // os_ = inc.os_; inc.os_ = null; connection_ = inc.connection_; inc.connection_ = null; }
protected internal void handleException__(System.Exception exc) { Debug.Assert(connection_ != null); try { throw exc; } catch(Ice.RequestFailedException ex) { if(ex.id == null) { ex.id = current_.id; } if(ex.facet == null) { ex.facet = current_.facet; } if(ex.operation == null || ex.operation.Length == 0) { ex.operation = current_.operation; } if(instance_.initializationData().properties.getPropertyAsIntWithDefault( "Ice.Warn.Dispatch", 1) > 1) { warning__(ex); } if(response_) { os_.endWriteEncaps(); os_.resize(Protocol.headerSize + 4, false); // Reply status position. if(ex is Ice.ObjectNotExistException) { os_.writeByte(ReplyStatus.replyObjectNotExist); } else if(ex is Ice.FacetNotExistException) { os_.writeByte(ReplyStatus.replyFacetNotExist); } else if(ex is Ice.OperationNotExistException) { os_.writeByte(ReplyStatus.replyOperationNotExist); } else { Debug.Assert(false); } ex.id.write__(os_); // // For compatibility with the old FacetPath. // if(ex.facet == null || ex.facet.Length == 0) { os_.writeStringSeq(null); } else { string[] facetPath2 = { ex.facet }; os_.writeStringSeq(facetPath2); } os_.writeString(ex.operation); connection_.sendResponse(os_, compress_); } else { connection_.sendNoResponse(); } } catch(Ice.UnknownLocalException ex) { if(instance_.initializationData().properties.getPropertyAsIntWithDefault( "Ice.Warn.Dispatch", 1) > 0) { warning__(ex); } if(response_) { os_.endWriteEncaps(); os_.resize(Protocol.headerSize + 4, false); // Reply status position. os_.writeByte(ReplyStatus.replyUnknownLocalException); os_.writeString(ex.unknown); connection_.sendResponse(os_, compress_); } else { connection_.sendNoResponse(); } } catch(Ice.UnknownUserException ex) { if(instance_.initializationData().properties.getPropertyAsIntWithDefault( "Ice.Warn.Dispatch", 1) > 0) { warning__(ex); } if(response_) { os_.endWriteEncaps(); os_.resize(Protocol.headerSize + 4, false); // Reply status position. os_.writeByte(ReplyStatus.replyUnknownUserException); os_.writeString(ex.unknown); connection_.sendResponse(os_, compress_); } else { connection_.sendNoResponse(); } } catch(Ice.UnknownException ex) { if(instance_.initializationData().properties.getPropertyAsIntWithDefault( "Ice.Warn.Dispatch", 1) > 0) { warning__(ex); } if(response_) { os_.endWriteEncaps(); os_.resize(Protocol.headerSize + 4, false); // Reply status position. os_.writeByte(ReplyStatus.replyUnknownException); os_.writeString(ex.unknown); connection_.sendResponse(os_, compress_); } else { connection_.sendNoResponse(); } } catch(Ice.LocalException ex) { if(instance_.initializationData().properties.getPropertyAsIntWithDefault( "Ice.Warn.Dispatch", 1) > 0) { warning__(ex); } if(response_) { os_.endWriteEncaps(); os_.resize(Protocol.headerSize + 4, false); // Reply status position. os_.writeByte(ReplyStatus.replyUnknownLocalException); os_.writeString(ex.ice_name() + "\n" + ex.StackTrace); connection_.sendResponse(os_, compress_); } else { connection_.sendNoResponse(); } } catch(Ice.UserException ex) { if(instance_.initializationData().properties.getPropertyAsIntWithDefault( "Ice.Warn.Dispatch", 1) > 0) { warning__(ex); } if(response_) { os_.endWriteEncaps(); os_.resize(Protocol.headerSize + 4, false); // Reply status position. os_.writeByte(ReplyStatus.replyUnknownUserException); os_.writeString(ex.ice_name() + "\n" + ex.StackTrace); connection_.sendResponse(os_, compress_); } else { connection_.sendNoResponse(); } } catch(System.Exception ex) { if(instance_.initializationData().properties.getPropertyAsIntWithDefault( "Ice.Warn.Dispatch", 1) > 0) { warning__(ex); } if(response_) { os_.endWriteEncaps(); os_.resize(Protocol.headerSize + 4, false); // Reply status position. os_.writeByte(ReplyStatus.replyUnknownException); os_.writeString(ex.ToString()); connection_.sendResponse(os_, compress_); } else { connection_.sendNoResponse(); } } connection_ = null; }
protected bool servantLocatorFinished__() { Debug.Assert(locator_ != null && servant_ != null); try { locator_.finished(current_, servant_, cookie_); return true; } catch(Ice.UserException ex) { Debug.Assert(connection_ != null); // // The operation may have already marshaled a reply; we must overwrite that reply. // if(response_) { os_.endWriteEncaps(); os_.resize(Protocol.headerSize + 4, false); // Reply status position. os_.writeByte(ReplyStatus.replyUserException); os_.startWriteEncaps(); os_.writeUserException(ex); os_.endWriteEncaps(); connection_.sendResponse(os_, compress_); } else { connection_.sendNoResponse(); } connection_ = null; } catch(System.Exception ex) { handleException__(ex); } return false; }