@Override protected void process_pipe_term_ack() { // Notify the user that all the references to the pipe should be dropped. assert (sink != null); sink.terminated(this); // In terminating and double_terminated states there's nothing to do. // Simply deallocate the pipe. In terminated state we have to ack the // peer before deallocating this side of the pipe. All the other states // are invalid. if (state == State.TERMINATED) { outpipe = null; send_pipe_term_ack(peer); } else assert (state == State.TERMINATING || state == State.DOUBLE_TERMINATED); // We'll deallocate the inbound pipe, the peer will deallocate the outbound // pipe (which is an inbound pipe from its point of view). // First, delete all the unread messages in the pipe. We have to do it by // hand because msg_t doesn't have automatic destructor. Then deallocate // the ypipe itself. while (inpipe.read() != null) {} inpipe = null; // Deallocate the pipe object }
@Override protected void process_activate_read() { if (!in_active && (state == State.ACTIVE || state == State.PENDING)) { in_active = true; sink.read_activated(this); } }
@Override protected void process_activate_write(long msgs_read_) { // Remember the peers's message sequence number. peers_msgs_read = msgs_read_; if (!out_active && state == State.ACTIVE) { out_active = true; sink.write_activated(this); } }
@SuppressWarnings("unchecked") @Override protected void process_hiccup(Object pipe_) { // Destroy old outpipe. Note that the read end of the pipe was already // migrated to this thread. assert (outpipe != null); outpipe.flush(); while (outpipe.read() != null) {} // Plug in the new outpipe. assert (pipe_ != null); outpipe = (YPipe<Msg>) pipe_; out_active = true; // If appropriate, notify the user about the hiccup. if (state == State.ACTIVE) sink.hiccuped(this); }