コード例 #1
0
        /// <summary>
        ///     Process a termination-request for the given Own obj,
        ///     removing it from the listed of owned things.
        /// </summary>
        /// <param name="obj">the Own object to remove and terminate</param>
        protected override void ProcessTermReq(Own obj)
        {
            // When shutting down we can ignore termination requests from owned
            // objects. The termination request was already sent to the object.
            if (this.m_terminating)
            {
                return;
            }

            // If I/O object is well and alive let's ask it to terminate.

            // If not found, we assume that termination request was already sent to
            // the object so we can safely ignore the request.
            if (!this.m_owned.Contains(obj))
            {
                return;
            }

            this.m_owned.Remove(obj);
            this.RegisterTermAcks(1);

            // Note that this object is the root of the (partial shutdown) thus, its
            // value of linger is used, rather than the value stored by the children.
            this.SendTerm(obj, this.m_options.Linger);
        }
コード例 #2
0
ファイル: ZObject.cs プロジェクト: NotHuza/Cerberus-v4
        /// <summary>
        ///     Send the Bind command
        /// </summary>
        /// <param name="destination"></param>
        /// <param name="pipe"></param>
        /// <param name="incSeqnum"></param>
        protected void SendBind([NotNull] Own destination, [NotNull] Pipe pipe, bool incSeqnum = true)
        {
            if (incSeqnum)
            {
                destination.IncSeqnum();
            }

            this.SendCommand(new Command(destination, CommandType.Bind, pipe));
        }
コード例 #3
0
ファイル: ZObject.cs プロジェクト: NotHuza/Cerberus-v4
        /// <summary>
        ///     Send the Plug command, incrementing the destinations sequence-number if incSeqnum is true.
        /// </summary>
        /// <param name="destination">the Own to send the command to</param>
        /// <param name="incSeqnum">
        ///     a flag that dictates whether to increment the sequence-number on the destination (optional -
        ///     defaults to false)
        /// </param>
        protected void SendPlug([NotNull] Own destination, bool incSeqnum = true)
        {
            if (incSeqnum)
            {
                destination.IncSeqnum();
            }

            this.SendCommand(new Command(destination, CommandType.Plug));
        }
コード例 #4
0
        /// <summary>
        ///     Launch the supplied object and become its owner.
        /// </summary>
        /// <param name="obj">The object to be launched.</param>
        protected void LaunchChild([NotNull] Own obj)
        {
            // Specify the owner of the object.
            obj.SetOwner(this);

            // Plug the object into the I/O thread.
            this.SendPlug(obj);

            // Take ownership of the object.
            this.SendOwn(this, obj);
        }
コード例 #5
0
        /// <summary>
        ///     Add the given Own object to the list of owned things.
        /// </summary>
        /// <param name="obj">the Own object to add to our list</param>
        /// <remarks>
        ///     If *this* Own is already terminating, then send a request to the given Own obj
        ///     to terminate itself.
        /// </remarks>
        protected override void ProcessOwn(Own obj)
        {
            // If the object is already being shut down, new owned objects are
            // immediately asked to terminate. Note that linger is set to zero.
            if (this.m_terminating)
            {
                this.RegisterTermAcks(1);
                this.SendTerm(obj, 0);
                return;
            }

            // Store the reference to the owned object.
            this.m_owned.Add(obj);
        }
コード例 #6
0
 /// <summary>
 ///     Terminate owned object.
 /// </summary>
 protected void TermChild([NotNull] Own obj)
 {
     this.ProcessTermReq(obj);
 }
コード例 #7
0
 /// <summary>
 ///     Set the owner of *this* Own object, to be the given owner.
 /// </summary>
 /// <param name="owner">the Own object to be our new owner</param>
 private void SetOwner([NotNull] Own owner)
 {
     Debug.Assert(this.m_owner == null);
     this.m_owner = owner;
 }
コード例 #8
0
ファイル: ZObject.cs プロジェクト: NotHuza/Cerberus-v4
 /// <summary>
 ///     Process a termination-request command on the Own object.
 /// </summary>
 /// <param name="obj"></param>
 /// <exception cref="NotSupportedException">Not supported on the ZObject class.</exception>
 protected virtual void ProcessTermReq([NotNull] Own obj)
 {
     throw new NotSupportedException();
 }
コード例 #9
0
ファイル: ZObject.cs プロジェクト: NotHuza/Cerberus-v4
 protected void SendTermAck([NotNull] Own destination)
 {
     this.SendCommand(new Command(destination, CommandType.TermAck));
 }
コード例 #10
0
ファイル: ZObject.cs プロジェクト: NotHuza/Cerberus-v4
 protected void SendTerm([NotNull] Own destination, int linger)
 {
     this.SendCommand(new Command(destination, CommandType.Term, linger));
 }
コード例 #11
0
ファイル: ZObject.cs プロジェクト: NotHuza/Cerberus-v4
 /// <summary>
 ///     For owned objects, asks the owner (<paramref name="destination" />) to terminate <paramref name="obj" />.
 /// </summary>
 /// <param name="destination"></param>
 /// <param name="obj"></param>
 protected void SendTermReq([NotNull] Own destination, [NotNull] Own obj)
 {
     this.SendCommand(new Command(destination, CommandType.TermReq, obj));
 }
コード例 #12
0
ファイル: ZObject.cs プロジェクト: NotHuza/Cerberus-v4
 /// <summary>
 ///     Send the Own command, and increment the sequence-number of the destination
 /// </summary>
 /// <param name="destination">the Own to send the command to</param>
 /// <param name="obj">the object to Own</param>
 protected void SendOwn([NotNull] Own destination, [NotNull] Own obj)
 {
     destination.IncSeqnum();
     this.SendCommand(new Command(destination, CommandType.Own, obj));
 }