示例#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();
 }
 /// <summary>
 /// Terminate owned object.
 /// </summary>
 protected void TermChild(Own obj)
 {
     ProcessTermReq(obj);
 }
示例#13
0
文件: ZObject.cs 项目: awb99/netmq
 /// <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
文件: ZObject.cs 项目: awb99/netmq
 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
文件: Own.cs 项目: romanros/netmq
 /// <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
文件: ZObject.cs 项目: awb99/netmq
        /// <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
文件: Own.cs 项目: romanros/netmq
        /// <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
文件: Own.cs 项目: romanros/netmq
        /// <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
文件: ZObject.cs 项目: awb99/netmq
 /// <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
文件: ZObject.cs 项目: awb99/netmq
        /// <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
文件: ZObject.cs 项目: awb99/netmq
 /// <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
文件: ZObject.cs 项目: awb99/netmq
 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
文件: SocketBase.cs 项目: awb99/netmq
 /// <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);
 }