コード例 #1
0
ファイル: MessageImpl.java プロジェクト: ryanemerson/hornetq
  /*
   * Copy constructor
   */
  protected MessageImpl(final MessageImpl other, TypedProperties properties) {
    messageID = other.getMessageID();
    userID = other.getUserID();
    address = other.getAddress();
    type = other.getType();
    durable = other.isDurable();
    expiration = other.getExpiration();
    timestamp = other.getTimestamp();
    priority = other.getPriority();
    this.properties = new TypedProperties(properties);

    // This MUST be synchronized using the monitor on the other message to prevent it running
    // concurrently
    // with getEncodedBuffer(), otherwise can introduce race condition when delivering concurrently
    // to
    // many subscriptions and bridging to other nodes in a cluster
    synchronized (other) {
      bufferValid = other.bufferValid;
      endOfBodyPosition = other.endOfBodyPosition;
      endOfMessagePosition = other.endOfMessagePosition;
      copied = other.copied;

      if (other.buffer != null) {
        other.bufferUsed = true;

        // We need to copy the underlying buffer too, since the different messsages thereafter might
        // have different
        // properties set on them, making their encoding different
        buffer = other.buffer.copy(0, other.buffer.writerIndex());

        buffer.setIndex(other.buffer.readerIndex(), buffer.capacity());
      }
    }
  }
コード例 #2
0
ファイル: MessageImpl.java プロジェクト: ryanemerson/hornetq
  @Override
  public boolean equals(Object other) {

    if (this == other) {
      return true;
    }

    if (other instanceof MessageImpl) {
      MessageImpl message = (MessageImpl) other;

      if (this.getMessageID() == message.getMessageID()) return true;
    }

    return false;
  }
コード例 #3
0
ファイル: MessageImpl.java プロジェクト: ryanemerson/hornetq
 /*
  * Copy constructor
  */
 protected MessageImpl(final MessageImpl other) {
   this(other, other.getProperties());
 }