コード例 #1
0
 ///<summary>Retrieve the next waiting continuation.</summary>
 ///<remarks>
 ///<para>
 /// It is an error to call this method when there are no
 /// waiting continuations. In the current implementation, if
 /// this happens, null will be returned (which will usually
 /// result in an immediate NullPointerException in the
 /// caller). Correct code will always arrange for a
 /// continuation to have been Enqueue()d before calling this
 /// method.
 ///</para>
 ///</remarks>
 public IRpcContinuation Next()
 {
     lock (m_outstandingRpcLock)
     {
         IRpcContinuation result = m_outstandingRpc;
         m_outstandingRpc = null;
         return(result);
     }
 }
コード例 #2
0
        ///<summary>Enqueue a continuation, marking a pending RPC.</summary>
        ///<remarks>
        ///<para>
        /// Continuations are retrieved in FIFO order by calling Next().
        ///</para>
        ///<para>
        /// In the current implementation, only one continuation can
        /// be queued up at once. Calls to Enqueue() when a
        /// continuation is already enqueued will result in
        /// NotSupportedException being thrown.
        ///</para>
        ///</remarks>
        public void Enqueue(IRpcContinuation k)
        {
            var result = Interlocked.CompareExchange(ref this.m_outstandingRpc, k, tmp);

            if (!(result is EmptyRpcContinuation))
            {
                throw new NotSupportedException("Pipelining of requests forbidden");
            }
        }
コード例 #3
0
        ///<summary>Interrupt all waiting continuations.</summary>
        ///<remarks>
        ///<para>
        /// There's just the one potential waiter in the current
        /// implementation.
        ///</para>
        ///</remarks>
        public void HandleModelShutdown(ShutdownEventArgs reason)
        {
            IRpcContinuation k = Next();

            if (k != null)
            {
                k.HandleModelShutdown(reason);
            }
        }
コード例 #4
0
        public void TestRpcContinuationQueueEnqueueAndRelease()
        {
            RpcContinuationQueue queue = new RpcContinuationQueue();
            var inputContinuation      = new SimpleBlockingRpcContinuation();

            queue.Enqueue(inputContinuation);
            IRpcContinuation outputContinuation = queue.Next();

            Assert.AreEqual(outputContinuation, inputContinuation);
        }
コード例 #5
0
 ///<summary>Enqueue a continuation, marking a pending RPC.</summary>
 ///<remarks>
 ///<para>
 /// Continuations are retrieved in FIFO order by calling Next().
 ///</para>
 ///<para>
 /// In the current implementation, only one continuation can
 /// be queued up at once. Calls to Enqueue() when a
 /// continuation is already enqueued will result in
 /// NotSupportedException being thrown.
 ///</para>
 ///</remarks>
 public void Enqueue(IRpcContinuation k)
 {
     lock (m_outstandingRpcLock)
     {
         if (m_outstandingRpc != null)
         {
             throw new NotSupportedException("Pipelining of requests forbidden");
         }
         m_outstandingRpc = k;
     }
 }
コード例 #6
0
 ///<summary>Enqueue a continuation, marking a pending RPC.</summary>
 ///<remarks>
 ///<para>
 /// Continuations are retrieved in FIFO order by calling Next().
 ///</para>
 ///<para>
 /// In the current implementation, only one continuation can
 /// be queued up at once. Calls to Enqueue() when a
 /// continuation is already enqueued will result in
 /// NotSupportedException being thrown.
 ///</para>
 ///</remarks>
 public void Enqueue(IRpcContinuation k)
 {
     lock (m_outstandingRpcLock)
     {
         if (m_outstandingRpc != null)
         {
             throw new NotSupportedException("Pipelining of requests forbidden");
         }
         m_outstandingRpc = k;
     }
 }
コード例 #7
0
ファイル: ModelBase.cs プロジェクト: pmq20/mono_forked
 public void TransmitAndEnqueue(Command cmd, IRpcContinuation k)
 {
     Enqueue(k);
     try
     {
         m_session.Transmit(cmd);
     }
     catch (AlreadyClosedException)
     {
         // Ignored, since the continuation will be told about
         // the closure via an OperationInterruptedException because
         // of the shutdown event propagation.
     }
 }
コード例 #8
0
ファイル: ModelBase.cs プロジェクト: pmq20/mono_forked
        public void Enqueue(IRpcContinuation k)
        {
            bool ok = false;

            lock (m_shutdownLock)
            {
                if (m_closeReason == null)
                {
                    m_continuationQueue.Enqueue(k);
                    ok = true;
                }
            }
            if (!ok)
            {
                k.HandleModelShutdown(m_closeReason);
            }
        }
コード例 #9
0
 public void TransmitAndEnqueue(Command cmd, IRpcContinuation k)
 {
     Enqueue(k);
     m_session.Transmit(cmd);
 }
コード例 #10
0
 public void Enqueue(IRpcContinuation k)
 {
     bool ok = false;
     lock (m_shutdownLock)
     {
         if (m_closeReason == null)
         {
             m_continuationQueue.Enqueue(k);
             ok = true;
         }
     }
     if (!ok)
     {
         k.HandleModelShutdown(m_closeReason);
     }
 }
コード例 #11
0
 ///<summary>Retrieve the next waiting continuation.</summary>
 ///<remarks>
 ///<para>
 /// It is an error to call this method when there are no
 /// waiting continuations. In the current implementation, if
 /// this happens, null will be returned (which will usually
 /// result in an immediate NullPointerException in the
 /// caller). Correct code will always arrange for a
 /// continuation to have been Enqueue()d before calling this
 /// method.
 ///</para>
 ///</remarks>
 public IRpcContinuation Next()
 {
     lock (m_outstandingRpcLock)
     {
         IRpcContinuation result = m_outstandingRpc;
         m_outstandingRpc = null;
         return result;
     }
 }
コード例 #12
0
 public void TransmitAndEnqueue(Command cmd, IRpcContinuation k)
 {
     Enqueue(k);
     try
     {
         m_session.Transmit(cmd);
     }
     catch (AlreadyClosedException)
     {
         // Ignored, since the continuation will be told about
         // the closure via an OperationInterruptedException because
         // of the shutdown event propagation.
     }
 }
コード例 #13
0
        ///<summary>Interrupt all waiting continuations.</summary>
        ///<remarks>
        ///<para>
        /// There's just the one potential waiter in the current
        /// implementation.
        ///</para>
        ///</remarks>
        public void HandleModelShutdown(ShutdownEventArgs reason)
        {
            IRpcContinuation k = Next();

            k?.HandleModelShutdown(reason);
        }
コード例 #14
0
 ///<summary>Enqueue a continuation, marking a pending RPC.</summary>
 ///<remarks>
 ///<para>
 /// Continuations are retrieved in FIFO order by calling Next().
 ///</para>
 ///<para>
 /// In the current implementation, only one continuation can
 /// be queued up at once. Calls to Enqueue() when a
 /// continuation is already enqueued will result in
 /// NotSupportedException being thrown.
 ///</para>
 ///</remarks>
 public void Enqueue(IRpcContinuation k)
 {
     m_outstandingRpc.Enqueue(k);
 }