Esempio n. 1
0
File: Own.cs Progetto: knocte/netmq
        //  Note that the owner is unspecified in the constructor.
        //  It'll be supplied later on when the object is plugged in.
        //  The object is not living within an I/O thread. It has it's own
        //  thread outside of 0MQ infrastructure.
        public Own(Ctx parent, int tid)
            : base(parent, tid)
        {
            m_terminating = false;
            m_sentSeqnum = new AtomicLong(0);
            m_processedSeqnum = 0;
            m_owner = null;
            m_termAcks = 0;

            m_options = new Options();
            owned = new HashSet<Own>();
        }
Esempio n. 2
0
 //  Creates new endpoint ID and adds the endpoint to the map.
 private void AddEndpoint(String addr, Own endpoint)
 {
     //  Activate the session. Make it a child of this socket.
     LaunchChild(endpoint);
     m_endpoints[addr] = endpoint;
 }
Esempio n. 3
0
File: Own.cs Progetto: knocte/netmq
        //  The object is living within I/O thread.
        public Own(IOThread ioThread, Options options)
            : base(ioThread)
        {
            m_options = options;
            m_terminating = false;
            m_sentSeqnum = new AtomicLong(0);
            m_processedSeqnum = 0;
            m_owner = null;
            m_termAcks = 0;

            owned = new HashSet<Own>();
        }
Esempio n. 4
0
File: Own.cs Progetto: knocte/netmq
 private void SetOwner(Own owner)
 {
     Debug.Assert(m_owner == null);
     m_owner = owner;
 }
Esempio n. 5
0
File: Own.cs Progetto: knocte/netmq
 //  Terminate owned object
 protected void TermChild(Own object_)
 {
     ProcessTermReq(object_);
 }
Esempio n. 6
0
File: Own.cs Progetto: knocte/netmq
        protected override void ProcessTermReq(Own object_)
        {
            //  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 (!owned.Contains(object_))
                return;

            owned.Remove(object_);
            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(object_, m_options.Linger);
        }
Esempio n. 7
0
File: Own.cs Progetto: knocte/netmq
        protected override void ProcessOwn(Own object_)
        {
            //  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(object_, 0);
                return;
            }

            //  Store the reference to the owned object.
            owned.Add(object_);
        }
Esempio n. 8
0
File: Own.cs Progetto: knocte/netmq
        //  Launch the supplied object and become its owner.
        protected void LaunchChild(Own object_)
        {
            //  Specify the owner of the object.
            object_.SetOwner(this);

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

            //  Take ownership of the object.
            SendOwn(this, object_);
        }