ProducerInfo xref

View Javadoc

    1   /***
    2    *
    3    * Copyright 2004 Protique Ltd
    4    *
    5    * Licensed under the Apache License, Version 2.0 (the "License");
    6    * you may not use this file except in compliance with the License.
    7    * You may obtain a copy of the License at
    8    *
    9    * http://www.apache.org/licenses/LICENSE-2.0
    10   *
    11   * Unless required by applicable law or agreed to in writing, software
    12   * distributed under the License is distributed on an "AS IS" BASIS,
    13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14   * See the License for the specific language governing permissions and
    15   * limitations under the License.
    16   *
    17   **/
    18
    19  package org.codehaus.activemq.message;
    20
    21  /***
    22   * Denotes life cycle infomation for a Producer of messages
    23   */
    24
    25  public class ProducerInfo extends AbstractPacket {
    26      private ActiveMQDestination destination;
    27      private String producerId;
    28      private String clientId;
    29      private String sessionId;
    30      private long startTime;
    31      private boolean started;
    32
    33
    34      /***
    35       * Test for equality
    36       *
    37       * @param obj object to test
    38       * @return true if equivalent
    39       */
    40      public boolean equals(Object obj) {
    41          boolean result = false;
    42          if (obj != null && obj instanceof ProducerInfo) {
    43              ProducerInfo info = (ProducerInfo) obj;
    44              result = this.producerId == info.producerId;
    45          }
    46          return result;
    47      }
    48
    49      /***
    50       * @return hash code for instance
    51       */
    52      public int hashCode() {
    53          return this.producerId != null ? this.producerId.hashCode() : super.hashCode();
    54      }
    55
    56
    57      /***
    58       * @return Returns the producerId.
    59       */
    60      public String getProducerId() {
    61          return producerId;
    62      }
    63
    64      /***
    65       * @param producerId The producerId to set.
    66       */
    67      public void setProducerId(String producerId) {
    68          this.producerId = producerId;
    69      }
    70
    71      /***
    72       * @return Returns the sessionId.
    73       */
    74      public String getSessionId() {
    75          return sessionId;
    76      }
    77
    78      /***
    79       * @param sessionId The sessionId to set.
    80       */
    81      public void setSessionId(String sessionId) {
    82          this.sessionId = sessionId;
    83      }
    84
    85      /***
    86       * Return the type of Packet
    87       *
    88       * @return integer representation of the type of Packet
    89       */
    90
    91      public int getPacketType() {
    92          return PRODUCER_INFO;
    93      }
    94
    95
    96      /***
    97       * @return Returns the clientId.
    98       */
    99      public String getClientId() {
    100         return this.clientId;
    101     }
    102
    103     /***
    104      * @param newClientId The clientId to set.
    105      */
    106     public void setClientId(String newClientId) {
    107         this.clientId = newClientId;
    108     }
    109
    110
    111     /***
    112      * @return Returns the destination.
    113      */
    114     public ActiveMQDestination getDestination() {
    115         return this.destination;
    116     }
    117
    118     /***
    119      * @param newDestination The destination to set.
    120      */
    121     public void setDestination(ActiveMQDestination newDestination) {
    122         this.destination = newDestination;
    123     }
    124
    125
    126     /***
    127      * @return Returns the started.
    128      */
    129     public boolean isStarted() {
    130         return this.started;
    131     }
    132
    133     /***
    134      * @param flag to indicate if started
    135      */
    136     public void setStarted(boolean flag) {
    137         this.started = flag;
    138     }
    139
    140     /***
    141      * @return Returns the startTime.
    142      */
    143     public long getStartTime() {
    144         return this.startTime;
    145     }
    146
    147     /***
    148      * @param newStartTime The startTime to set.
    149      */
    150     public void setStartTime(long newStartTime) {
    151         this.startTime = newStartTime;
    152     }
    153 }