예제 #1
0
        /// <summary>
        ///		Notifies to RPC runtime to end service operation.
        /// </summary>
        /// <remarks>
        ///		Currently, this method performs following:
        ///		<list type="bullet">
        ///			<item>Clear <see cref="RpcApplicationContext"/>.</item>
        ///			<item>Stop execution timeout wathing.</item>
        ///		</list>
        /// </remarks>
        public void EndOperation()
        {
            bool wasSoftTimeout = false;
            var  context        = RpcApplicationContext.Current;

            try
            {
                if (context != null)
                {
                    context.StopTimeoutWatch();
                    wasSoftTimeout = context.IsSoftTimeout;
                }
            }
            finally
            {
                RpcApplicationContext.Clear();

                if (context != null && !context.IsDisposed)
                {
                    this._applicationContextPool.Return(context);
                }
            }

            if (wasSoftTimeout)
            {
                throw RpcError.ServerError.ToException(this._softTimeoutDetails);
            }
        }
예제 #2
0
        /// <summary>
        ///		Notifies to RPC runtime to begin service operation.
        /// </summary>
        /// <remarks>
        ///		Currently, this method performs following:
        ///		<list type="bullet">
        ///			<item>Sets <see cref="RpcApplicationContext"/>.</item>
        ///			<item>Starts execution timeout wathing.</item>
        ///		</list>
        /// </remarks>
        public void BeginOperation()
        {
            var context = this._applicationContextPool.Borrow();

            RpcApplicationContext.SetCurrent(context);
            context.StartTimeoutWatch();
        }