AbstractPacket (ActiveMQ 1.1 API)
Keywords: org.codehaus.activemq.message.AbstractPacket class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.codehaus.activemq.message
Class AbstractPacket

    java.lang.Object
      org.codehaus.activemq.message.AbstractPacket

All Implemented Interfaces:
  Packet

Direct Known Subclasses:
  ActiveMQMessage, BrokerInfo, CapacityInfo, CapacityInfoRequest, ConnectionInfo, ConsumerInfo, DurableUnsubscribe, MessageAck, ProducerInfo, Receipt, SessionInfo, TransactionInfo, WireFormatInfo, XATransactionInfo

public abstract class AbstractPacket
extends Object
implements Packet

Abstract class for a transportable Packet

Version:
  $Revision: 1.19 $

Field Summary
`protected BitArray` | `bitArray`
`(package private) static int` | `BROKERS_VISITED_INDEX`
`(package private) static int` | `RECEIPT_REQUIRED_INDEX` Message flag indexes (used for writing/reading to/from a Stream

Fields inherited from interface org.codehaus.activemq.message.Packet
`ACTIVEMQ_BROKER_INFO, ACTIVEMQ_BYTES_MESSAGE, ACTIVEMQ_CONNECTION_INFO, ACTIVEMQ_MAP_MESSAGE, ACTIVEMQ_MESSAGE, ACTIVEMQ_MSG_ACK, ACTIVEMQ_OBJECT_MESSAGE, ACTIVEMQ_STREAM_MESSAGE, ACTIVEMQ_TEXT_MESSAGE, CAPACITY_INFO, CAPACITY_INFO_REQUEST, CONSUMER_INFO, DURABLE_UNSUBSCRIBE, INT_RESPONSE_RECEIPT_INFO, PRODUCER_INFO, RECEIPT_INFO, RESPONSE_RECEIPT_INFO, SESSION_INFO, TRANSACTION_INFO, WIRE_FORMAT_INFO, XA_TRANSACTION_INFO`

Constructor Summary
`protected` | `AbstractPacket()`

Method Summary
`void` | `addBrokerVisited(String brokerName)` As the packet passes through the broker add the broker to the visited list
`int` | `decrementMemoryReferenceCount()` Decrement reference count for bounded memory collections
`boolean` | `equals(Object obj)` Tests equality with another instance
`protected boolean` | `equals(Object left, Object right)` A helper method used when implementing equals() which returns true if the objects are identical or equal handling nulls properly
`BitArray` | `getBitArray()`
`(package private) Object[]` | `getBrokersVisited()`
`String` | `getBrokersVisitedAsString()`
`String` | `getId()`
`int` | `getMemoryUsage()` Get a hint about how much memory this Packet is consuming
`int` | `getMemoryUsageReferenceCount()`
`protected static String` | `getPacketTypeAsString(int type)`
`int` | `hashCode()`
`boolean` | `hasVisited(String brokerName)` test to see if the named broker has already seen this packet
`int` | `incrementMemoryReferenceCount()` Increment reference count for bounded memory collections
`(package private) void` | `initializeBrokersVisited()`
`protected void` | `initializeOther(AbstractPacket other)` Initializes another message with current values from this instance
`boolean` | `isJMSMessage()` Retrieve if a JMS Message type or not
`boolean` | `isReceipt()`
`boolean` | `isReceiptRequired()`
`void` | `setBitArray(BitArray bitArray)`
`void` | `setId(String newId)` Set the unique id for this Packet
`void` | `setMemoryUsage(int newMemoryUsage)` Set a hint about how mujch memory this packet is consuming
`void` | `setReceiptRequired(boolean value)` Set if a Recipt if required on receiving this Packet
`String` | `toString()`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Methods inherited from interface org.codehaus.activemq.message.Packet
`getPacketType`

Field Detail

### RECEIPT_REQUIRED_INDEX

    static final int RECEIPT_REQUIRED_INDEX

  Message flag indexes (used for writing/reading to/from a Stream

  See Also:
    Constant Field Values

### BROKERS_VISITED_INDEX

    static final int BROKERS_VISITED_INDEX

See Also:
  Constant Field Values

### bitArray

    protected BitArray bitArray

Constructor Detail

### AbstractPacket

    protected AbstractPacket()

Method Detail

### getId

    public String getId()

  Specified by:
    `getId` in interface `Packet`
  Returns:
    the unique id for this Packet

### setId

    public void setId(String newId)

  Set the unique id for this Packet

  Specified by:
    `setId` in interface `Packet`
  Parameters:
    `newId` -

### isReceiptRequired

    public boolean isReceiptRequired()

  Specified by:
    `isReceiptRequired` in interface `Packet`
  Returns:
    true if a Recipt is required

### isReceipt

    public boolean isReceipt()

  Specified by:
    `isReceipt` in interface `Packet`
  Returns:
    false since most packets are not receipt packets

### setReceiptRequired

    public void setReceiptRequired(boolean value)

  Set if a Recipt if required on receiving this Packet

  Specified by:
    `setReceiptRequired` in interface `Packet`
  Parameters:
    `value` -

### isJMSMessage

    public boolean isJMSMessage()

  Retrieve if a JMS Message type or not

  Specified by:
    `isJMSMessage` in interface `Packet`
  Returns:
    true if it is a JMS Message

### equals

    public boolean equals(Object obj)

  Tests equality with another instance

  Parameters:
    `obj` - - the other instance to test equality with
  Returns:
    Returns true if the objects are equilvant

### hashCode

    public int hashCode()

  Returns:
    Returns hash code for this instance

### getMemoryUsage

    public int getMemoryUsage()

  Get a hint about how much memory this Packet is consuming

  Specified by:
    `getMemoryUsage` in interface `Packet`
  Returns:
    an aproximation of the current memory used by this instance

### setMemoryUsage

    public void setMemoryUsage(int newMemoryUsage)

  Set a hint about how mujch memory this packet is consuming

  Specified by:
    `setMemoryUsage` in interface `Packet`
  Parameters:
    `newMemoryUsage` -

### incrementMemoryReferenceCount

    public int incrementMemoryReferenceCount()

  Increment reference count for bounded memory collections

  Specified by:
    `incrementMemoryReferenceCount` in interface `Packet`
  Returns:
    the incremented reference value
  See Also:
    `MemoryBoundedQueue`

### decrementMemoryReferenceCount

    public int decrementMemoryReferenceCount()

  Decrement reference count for bounded memory collections

  Specified by:
    `decrementMemoryReferenceCount` in interface `Packet`
  Returns:
    the decremented reference value
  See Also:
    `MemoryBoundedQueue`

### getMemoryUsageReferenceCount

    public int getMemoryUsageReferenceCount()

  Specified by:
    `getMemoryUsageReferenceCount` in interface `Packet`
  Returns:
    the current reference count for bounded memory collections
  See Also:
    `MemoryBoundedQueue`

### addBrokerVisited

    public void addBrokerVisited(String brokerName)

  As the packet passes through the broker add the broker to the visited list

  Specified by:
    `addBrokerVisited` in interface `Packet`
  Parameters:
    `brokerName` - the name of the broker

### hasVisited

    public boolean hasVisited(String brokerName)

  test to see if the named broker has already seen this packet

  Specified by:
    `hasVisited` in interface `Packet`
  Parameters:
    `brokerName` - the name of the broker
  Returns:
    true if the packet has visited the broker

### getBrokersVisitedAsString

    public String getBrokersVisitedAsString()

  Specified by:
    `getBrokersVisitedAsString` in interface `Packet`
  Returns:
    Returns the brokersVisited.

### toString

    public String toString()

  Returns:
    pretty print of this Packet

### getPacketTypeAsString

    protected static String getPacketTypeAsString(int type)

### equals

    protected boolean equals(Object left,
                             Object right)

  A helper method used when implementing equals() which returns true if the objects are identical or equal handling nulls properly

  Parameters:
    `left` -
    `right` -
  Returns:
    true if the objects are the same or equal or both null

### initializeOther

    protected void initializeOther(AbstractPacket other)

  Initializes another message with current values from this instance

  Parameters:
    `other` - the other ActiveMQMessage to initialize

### initializeBrokersVisited

    void initializeBrokersVisited()

### getBrokersVisited

    Object[] getBrokersVisited()

  Returns:
    Returns the brokersVisited.

### getBitArray

    public BitArray getBitArray()

  Returns:
    Returns the bitArray.

### setBitArray

    public void setBitArray(BitArray bitArray)

  Parameters:
    `bitArray` - The bitArray to set.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004 Protique, Ltd.. All Rights Reserved.