Example #1
0
 /// <summary>
 /// Inserts processing on a communication object after it transitions into the opening state which must complete within a specified interval of time.
 /// </summary>
 /// <param name="timeout">The <see cref="T:System.TimeSpan" /> that specifies how long the on open operation has to complete before timing out.</param>
 /// <exception cref="T:System.ArgumentOutOfRangeException"><paramref name="timeout" /> is less than zero.</exception>
 /// <exception cref="T:System.TimeoutException">The interval of time specified by <paramref name="timeout" /> that was allotted for the operation was exceeded before the operation was completed.</exception>
 protected override void OnOpen(TimeSpan timeout)
 {
     if (Uri == null)
     {
         throw new InvalidOperationException("Uri must be set before ChannelListener is opened.");
     }
     NmsChannelHelper.ValidateTimeout(timeout);
 }
Example #2
0
 /// <summary>
 /// When implemented in a derived class, provides an asynchronous extensibility point when beginning to accept a channel.
 /// </summary>
 /// <returns>
 /// The <see cref="T:System.IAsyncResult" /> that references the asynchronous accept channel operation.
 /// </returns>
 /// <param name="timeout">The <see cref="T:System.TimeSpan" /> that specifies how long the accept channel operation has to complete before timing out.</param>
 /// <param name="callback">The <see cref="T:System.AsyncCallback" /> delegate that receives the notification of the asynchronous completion of the accept channel operation.</param>
 /// <param name="state">An object, specified by the application, that contains state information associated with the asynchronous accept channel operation.</param>
 protected override IAsyncResult OnBeginAcceptChannel(TimeSpan timeout, AsyncCallback callback, object state)
 {
     NmsChannelHelper.ValidateTimeout(timeout);
     if (!IsDisposed)
     {
         EnsureChannelAvailable();
     }
     return(_channelQueue.BeginDequeue(timeout, callback, state));
 }
Example #3
0
        /// <summary>
        /// When implemented in a derived class, provides an extensibility point when accepting a channel.
        /// </summary>
        /// <returns>
        /// The <see cref="T:System.ServiceModel.Channels.IChannel" /> accepted.
        /// </returns>
        /// <param name="timeout">The <see cref="T:System.TimeSpan" /> that specifies how long the accept channel operation has to complete before timing out.</param>
        protected override IInputChannel OnAcceptChannel(TimeSpan timeout)
        {
            Tracer.Debug("Accepting channel");
            NmsChannelHelper.ValidateTimeout(timeout);
            if (!IsDisposed)
            {
                EnsureChannelAvailable();
            }

            IInputChannel channel;

            if (_channelQueue.Dequeue(timeout, out channel))
            {
                return(channel);
            }
            throw new TimeoutException(String.Format("Accept on listener at address {0} timed out after {1}.", Uri.AbsoluteUri, timeout));
        }
Example #4
0
 /// <summary>
 /// When implemented in a derived class, provides a point of extensibility when starting to wait for a channel to arrive.
 /// </summary>
 /// <returns>
 /// The <see cref="T:System.IAsyncResult" /> that references the asynchronous on begin wait operation.
 /// </returns>
 /// <param name="timeout">The <see cref="T:System.TimeSpan" /> that specifies how long the on begin wait operation has to complete before timing out.</param>
 /// <param name="callback">The <see cref="T:System.AsyncCallback" /> delegate that receives the notification of the asynchronous operation on begin wait completion.</param>
 /// <param name="state">An object, specified by the application, that contains state information associated with the asynchronous on begin wait operation.</param>
 protected override IAsyncResult OnBeginWaitForChannel(TimeSpan timeout, AsyncCallback callback, object state)
 {
     NmsChannelHelper.ValidateTimeout(timeout);
     return(_channelQueue.BeginWaitForItem(timeout, callback, state));
 }
Example #5
0
 /// <summary>
 /// When overridden in a derived class, provides a point of extensibility when waiting for a channel to arrive.
 /// </summary>
 /// <returns>
 /// true if the method completed before the interval of time specified by the <paramref name="timeout" /> expired; otherwise false.
 /// </returns>
 /// <param name="timeout">The <see cref="T:System.TimeSpan" /> that specifies how long the on wait for a channel operation has to complete before timing out.</param>
 protected override bool OnWaitForChannel(TimeSpan timeout)
 {
     NmsChannelHelper.ValidateTimeout(timeout);
     return(_channelQueue.WaitForItem(timeout));
 }
Example #6
0
 /// <summary>
 /// Inserts processing on a communication object after it transitions to the opening state due to the invocation of an asynchronous open operation.
 /// </summary>
 /// <returns>
 /// The <see cref="T:System.IAsyncResult" /> that references the asynchronous on open operation.
 /// </returns>
 /// <param name="timeout">The <see cref="T:System.TimeSpan" /> that specifies how long the on open operation has to complete before timing out.</param>
 /// <param name="callback">The <see cref="T:System.AsyncCallback" /> delegate that receives notification of the completion of the asynchronous on open operation.</param>
 /// <param name="state">An object, specified by the application, that contains state information associated with the asynchronous on open operation.</param>
 /// <exception cref="T:System.ArgumentOutOfRangeException"><paramref name="timeout" /> is less than zero.</exception>
 protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
 {
     NmsChannelHelper.ValidateTimeout(timeout);
     OnOpen(timeout);
     return(new CompletedAsyncResult(callback, state));
 }
Example #7
0
 /// <summary>
 /// Inserts processing on a communication object after it transitions into the opening state which must complete within a specified interval of time.
 /// </summary>
 /// <param name="timeout">The <see cref="T:System.TimeSpan" /> that specifies how long the on open operation has to complete before timing out.</param>
 /// <exception cref="T:System.ArgumentOutOfRangeException"><paramref name="timeout" /> is less than zero.</exception>
 /// <exception cref="T:System.TimeoutException">The interval of time specified by <paramref name="timeout" /> that was allotted for the operation was exceeded before the operation was completed.</exception>
 protected override void OnOpen(TimeSpan timeout)
 {
     NmsChannelHelper.ValidateTimeout(timeout);
 }