Esempio n. 1
0
  //  Reads a message to the underlying pipe.
  public Msg read() {
    if (!in_active || (state != State.ACTIVE && state != State.PENDING)) return null;

    Msg msg_ = inpipe.read();

    if (msg_ == null) {
      in_active = false;
      return null;
    }

    //  If delimiter was read, start termination process of the pipe.
    if (msg_.isDelimiter()) {
      delimit();
      return null;
    }

    if (!msg_.hasMore()) msgs_read++;

    if (lwm > 0 && msgs_read % lwm == 0) send_activate_write(peer, msgs_read);

    return msg_;
  }
Esempio n. 2
0
 //  Returns true if the message is delimiter; false otherwise.
 private static boolean is_delimiter(Msg msg_) {
   return msg_.isDelimiter();
 }