public RpcTcpSimplexConnectionWrapper(RpcTcpSimplexConnection parent)
 {
     _syncRoot   = new object();
     _parent     = parent;
     _retryBegin = DateTime.MinValue;
     CreateConnection();
 }
Ejemplo n.º 2
0
        /// <summary>
        ///		创建一个Transaction
        /// </summary>
        /// <param name="uri"></param>
        /// <param name="request"></param>
        /// <returns></returns>
        /// <remarks>这个事务会建立在单工的Tcp连接上</remarks>
        public override RpcClientTransaction CreateTransaction(ServerUri uri, RpcRequest request)
        {
            RpcTcpSimplexConnection conn;

            lock (_syncRoot) {
                if (!_simplexConnections.TryGetValue(uri, out conn))
                {
                    conn = new RpcTcpSimplexConnection(this, (TcpUri)uri, p_channelSettings.ConcurrentConnection);
                    conn.Disconnected += new Action <RpcConnection>(conn_Disconnected);
                    _simplexConnections.Add(uri, conn);
                }
            }
            return(conn.CreateTransaction(request));
        }