Пример #1
0
        public static void SendOwn(Own destination, Own child)
        {
            destination.IncreaseSequenceNumber();

            var command = new OwnCommand(destination, child);
            SendCommand(command);
        }
Пример #2
0
        internal void SendOwn(Own destination, Own obj)
        {
            destination.IncSeqnum();
            Command cmd = new Command(destination, CommandType.Own, obj);

            SendCommand(cmd);
        }
Пример #3
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 (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 (!m_owned.Contains(obj))
            {
                return;
            }

            m_owned.Remove(obj);
            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.
            SendTerm(obj, m_options.Linger);
        }
Пример #4
0
        public static void SendPlug(Own destination, bool increaseSequenceNumber = true)
        {
            if (increaseSequenceNumber)
                destination.IncreaseSequenceNumber();

            var command = new PlugCommand(destination);
            SendCommand(command);
        }
Пример #5
0
        /// <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();
            }

            SendCommand(new Command(destination, CommandType.Plug));
        }
Пример #6
0
        /// <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();
            }

            SendCommand(new Command(destination, CommandType.Bind, pipe));
        }
Пример #7
0
        internal void SendBind(Own destination, Pipe pipe, bool incSeqnum = true)
        {
            if (incSeqnum)
            {
                destination.IncSeqnum();
            }

            Command cmd = new Command(destination, CommandType.Bind, pipe);

            SendCommand(cmd);
        }
Пример #8
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.
            SendPlug(obj);

            // Take ownership of the object.
            SendOwn(this, obj);
        }
Пример #9
0
        internal void SendPlug(Own destination, bool incSeqnum = true)
        {
            if (incSeqnum)
            {
                destination.IncSeqnum();
            }

            Command cmd = new Command(destination, CommandType.Plug);

            SendCommand(cmd);
        }
Пример #10
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 (m_terminating)
            {
                RegisterTermAcks(1);
                SendTerm(obj, 0);
                return;
            }

            // Store the reference to the owned object.
            m_owned.Add(obj);
        }
Пример #11
0
 /// <exception cref="NotSupportedException">Not supported on the ZObject class.</exception>
 protected virtual void ProcessOwn(Own obj)
 {
     throw new NotSupportedException();
 }
Пример #12
0
 /// <summary>
 /// Terminate owned object.
 /// </summary>
 protected void TermChild(Own obj)
 {
     ProcessTermReq(obj);
 }
Пример #13
0
 /// <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( Own obj)
 {
     throw new NotSupportedException();
 }
Пример #14
0
 protected void SendTermAck( Own destination)
 {
     SendCommand(new Command(destination, CommandType.TermAck));
 }
Пример #15
0
 public OwnCommand(BaseObject destination, Own child)
     : base(destination)
 {
     Child = child;
 }
Пример #16
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(m_owner == null);
     m_owner = owner;
 }
Пример #17
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(m_owner == null);
     m_owner = owner;
 }
Пример #18
0
 /// <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();
     SendCommand(new Command(destination, CommandType.Own, obj));
 }
Пример #19
0
        /// <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( Own destination, bool incSeqnum = true)
        {
            if (incSeqnum)
                destination.IncSeqnum();

            SendCommand(new Command(destination, CommandType.Plug));
        }
Пример #20
0
        internal void SendTermReq(Own destination, Own own)
        {
            Command cmd = new Command(destination, CommandType.TermReq, own);

            SendCommand(cmd);
        }
Пример #21
0
        internal void SendTerm(Own destination, int linger)
        {
            Command cmd = new Command(destination, CommandType.Term, linger);

            SendCommand(cmd);
        }
Пример #22
0
 public static void SendCloseRequest(Own destination, Own child)
 {
     var command = new CloseRequestCommand(destination, child);
     SendCommand(command);
 }
Пример #23
0
 public static void SendCloseAck(Own destination)
 {
     var command = new CloseAckCommand(destination);
     SendCommand(command);
 }
Пример #24
0
 public static void SendClose(Own destination, TimeSpan linger)
 {
     var command = new CloseCommand(destination, linger);
     SendCommand(command);
 }
Пример #25
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 (m_terminating)
            {
                RegisterTermAcks(1);
                SendTerm(obj, 0);
                return;
            }

            // Store the reference to the owned object.
            m_owned.Add(obj);
        }
Пример #26
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 (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 (!m_owned.Contains(obj))
                return;

            m_owned.Remove(obj);
            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.
            SendTerm(obj, m_options.Linger);
        }
Пример #27
0
 /// <summary>
 /// Terminate owned object.
 /// </summary>
 protected void TermChild([NotNull] Own obj)
 {
     ProcessTermReq(obj);
 }
Пример #28
0
 public Endpoint(Own own, Pipe pipe)
 {
     Own = own;
     Pipe = pipe;
 }
Пример #29
0
        internal void SendTermAck(Own destination)
        {
            Command cmd = new Command(destination, CommandType.TermAck);

            SendCommand(cmd);
        }
Пример #30
0
 /// <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)
 {
     SendCommand(new Command(destination, CommandType.TermReq, obj));
 }
Пример #31
0
 public CloseRequestCommand(BaseObject destination, Own child)
     : base(destination)
 {
     Child = child;
 }
Пример #32
0
Файл: Own.cs Проект: awb99/netmq
 /// <summary>
 /// Terminate owned object.
 /// </summary>
 protected void TermChild( Own obj)
 {
     ProcessTermReq(obj);
 }
Пример #33
0
 protected void SendTermAck([NotNull] Own destination)
 {
     SendCommand(new Command(destination, CommandType.TermAck));
 }
Пример #34
0
 /// <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( Own destination,  Own obj)
 {
     destination.IncSeqnum();
     SendCommand(new Command(destination, CommandType.Own, obj));
 }
Пример #35
0
Файл: Own.cs Проект: awb99/netmq
        /// <summary>
        /// Launch the supplied object and become its owner.
        /// </summary>
        /// <param name="obj">The object to be launched.</param>
        protected void LaunchChild( Own obj)
        {
            // Specify the owner of the object.
            obj.SetOwner(this);

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

            // Take ownership of the object.
            SendOwn(this, obj);
        }
Пример #36
0
        /// <summary>
        /// Send the Bind command
        /// </summary>
        /// <param name="destination"></param>
        /// <param name="pipe"></param>
        /// <param name="incSeqnum"></param>
        protected void SendBind( Own destination,  Pipe pipe, bool incSeqnum = true)
        {
            if (incSeqnum)
                destination.IncSeqnum();

            SendCommand(new Command(destination, CommandType.Bind, pipe));
        }
Пример #37
0
 /// <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( Own destination,  Own obj)
 {
     SendCommand(new Command(destination, CommandType.TermReq, obj));
 }
Пример #38
0
 protected void SendTerm([NotNull] Own destination, int linger)
 {
     SendCommand(new Command(destination, CommandType.Term, linger));
 }
Пример #39
0
 protected void SendTerm( Own destination, int linger)
 {
     SendCommand(new Command(destination, CommandType.Term, linger));
 }
Пример #40
0
 /// <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();
 }
Пример #41
0
 /// <summary>
 /// Take ownership of the given <paramref name="endpoint"/> and register it against the given <paramref name="address"/>.
 /// </summary>
 private void AddEndpoint( string address,  Own endpoint, Pipe pipe)
 {
     // Activate the session. Make it a child of this socket.
     LaunchChild(endpoint);
     m_endpoints[address] = new Endpoint(endpoint, pipe);
 }