protected void SendOwn(Own destination, Own obj) { destination.IncSeqnum(); Command cmd = new Command(destination, CommandType.Own, obj); SendCommand(cmd); }
protected void SendTermReq(Own destination, Own object_) { Command cmd = new Command(destination, CommandType.TermReq, object_); SendCommand(cmd); }
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 (!m_owned.Contains(object_)) { return; } m_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); }
/// <summary> Initializes a new instance of the <see cref="Own" /> class that is running within I/O thread. </summary> /// <param name="ioThread">The I/O thread.</param> /// <param name="options">The options.</param> /// <remarks> Note that the owner is unspecified in the constructor. It'll be assigned later on using <see cref="SetOwner"/> /// when the object is plugged in. </remarks> protected Own(IOThread ioThread, Options options) : base(ioThread) { m_options = options; m_terminating = false; m_processedSeqnum = 0; m_owner = null; m_termAcks = 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)); }
/// <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)); }
/// <summary> Initializes a new instance of the <see cref="Own" /> class that is running on a thread outside of 0MQ infrastructure. </summary> /// <param name="parent">The parent context.</param> /// <param name="threadId">The thread id.</param> /// <remarks> Note that the owner is unspecified in the constructor. It'll be assigned later on using <see cref="SetOwner"/> /// when the object is plugged in. </remarks> protected Own(Ctx parent, int threadId) : base(parent, threadId) { m_terminating = false; m_processedSeqnum = 0; m_owner = null; m_termAcks = 0; m_options = new Options(); }
/// <summary> Launch the supplied object and become its owner. </summary> /// <param name="object_">The object to be launched.</param> 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_); }
protected void SendBind(Own destination, Pipe pipe, bool incSeqnum = true) { if (incSeqnum) { destination.IncSeqnum(); } Command cmd = new Command(destination, CommandType.Bind, pipe); SendCommand(cmd); }
protected void SendPlug(Own destination, bool incSeqnum = true) { if (incSeqnum) { destination.IncSeqnum(); } Command cmd = new Command(destination, CommandType.Plug); SendCommand(cmd); }
// 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>(); }
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. m_owned.Add(object_); }
/// <summary> /// Creates new endpoint ID and adds the endpoint to the map. /// </summary> private void AddEndpoint([NotNull] string addr, [NotNull] Own endpoint) { // Activate the session. Make it a child of this socket. LaunchChild(endpoint); m_endpoints[addr] = endpoint; }
protected void SendBind(Own destination, Pipe pipe) { SendBind(destination, pipe, true); }
protected void SendOwn(Own destination, Own obj) { destination.IncSeqnum (); Command cmd = new Command(destination, CommandType.Own, obj); SendCommand (cmd); }
protected void SendTerm(Own destination, int linger) { Command cmd = new Command(destination, CommandType.Term, linger); SendCommand(cmd); }
protected virtual void ProcessTermReq(Own obj) { throw new NotSupportedException(); }
protected void SendPlug(Own destination, bool incSeqnum) { if (incSeqnum) destination.IncSeqnum (); Command cmd = new Command(destination, CommandType.Plug); SendCommand (cmd); }
protected void SendTermAck(Own destination) { Command cmd = new Command(destination, CommandType.TermAck); SendCommand (cmd); }
/// <summary> Terminate owned object. </summary> /// <param name="object_"></param> protected void TermChild(Own object_) { ProcessTermReq(object_); }
/// <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)); }
private void SetOwner(Own owner) { Debug.Assert(m_owner == null); m_owner = owner; }
// 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>(); }
/// <summary> /// Terminate owned object. /// </summary> /// <param name="obj"></param> protected void TermChild([NotNull] Own obj) { ProcessTermReq(obj); }
protected void SendTermAck([NotNull] Own destination) { SendCommand(new Command(destination, CommandType.TermAck)); }
protected void SendTermAck(Own destination) { Command cmd = new Command(destination, CommandType.TermAck); SendCommand(cmd); }
protected virtual void ProcessOwn([NotNull] Own obj) { throw new NotSupportedException(); }
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 (!m_owned.Contains(object_)) return; m_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); }
protected void SendBind(Own destination, Pipe pipe, bool incSeqnum) { if (incSeqnum) destination.IncSeqnum (); Command cmd = new Command(destination, CommandType.Bind, pipe); SendCommand (cmd); }
// 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; }
protected void SendPlug(Own destination) { SendPlug(destination, true); }
protected void SendTerm(Own destination, int linger) { Command cmd = new Command(destination, CommandType.Term, linger); SendCommand (cmd); }
protected void SendTermReq([NotNull] Own destination, [NotNull] Own obj) { SendCommand(new Command(destination, CommandType.TermReq, obj)); }
protected void SendTermReq(Own destination, Own object_) { Command cmd = new Command(destination, CommandType.TermReq, object_); SendCommand (cmd); }
protected void SendTerm([NotNull] Own destination, int linger) { SendCommand(new Command(destination, CommandType.Term, linger)); }