Save This Page
Home » jboss-5.0.0.CR1-src » org » jboss » mq » il » uil2 » msgs » [javadoc | source]
org.jboss.mq.il.uil2.msgs
public class: BaseMsg [javadoc | source]
java.lang.Object
   org.jboss.mq.il.uil2.msgs.BaseMsg

All Implemented Interfaces:
    Runnable

Direct Known Subclasses:
    CheckUserMsg, PingMsg, GetIDMsg, UnsubscribeMsg, TransactMsg, SubscribeMsg, DeleteSubscriptionMsg, AcknowledgementRequestMsg, TemporaryDestMsg, EnableConnectionMsg, ReceiveRequestMsg, AddMsg, CreateDestMsg, RecoverMsg, ReceiveMsg, BrowseMsg, CheckIDMsg, DeleteTemporaryDestMsg, ConnectionTokenMsg, CloseMsg

The base msg class for all msgs used by the UIL2 invoker. Msgs consist of a msg type, id and exception and can operate as two way items that are sent with the request content and received with the reply content for the request. Such round-trip behavior is based on matching the request msgID with the reply msgID. The msgID parameter is segmented into value 1 to 2147483647 for client originated msgs and -1 to -2147483647 for server originated msgs.

The message is a Runnable to avoid constructing a Runnable object when asynchronously handling the message from the ReadTask.

Field Summary
public  int msgType    The MsgTypes constant representing the type of the msg 
public  int msgID    A msg id used to associated a reply with its request 
public  Exception error    Any error thrown by the remote side 
Constructor:
 public BaseMsg(int msgType) 
 public BaseMsg(int msgType,
    int msgID) 
Method from org.jboss.mq.il.uil2.msgs.BaseMsg Summary:
createMsg,   equals,   getError,   getMsgID,   getMsgType,   hashCode,   read,   run,   setError,   setHandler,   setMsgID,   setUseJMSServerMsgIDs,   toString,   toString,   trimReply,   write
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.jboss.mq.il.uil2.msgs.BaseMsg Detail:
 public static BaseMsg createMsg(int msgType) throws IllegalArgumentException 
    Create a BaseMsg subclass based on the msgType.
 public boolean equals(Object o) 
    Equality is based on BaseMsg.msgID
 public Exception getError() 
    Access any exception associated with the msg
 public synchronized int getMsgID() 
    Access the msgID, initializing it if it has not been set yet. This is used by the SocketManager.internalSendMessage to setup the unique msgID for a request msg.
 public int getMsgType() 
 public int hashCode() 
    Hash code is simply the msgID
 public  void read(ObjectInputStream in) throws ClassNotFoundException, IOException 
    Read the hasError flag and optionally the error. This method is not a complete analog of write because the SocketManager read task reads the msgType and msgID off of the socket.
 public  void run() 
 public  void setError(Throwable e) 
    Set an exception that should be used as the msg return value.
 public  void setHandler(ReadTask handler) 
 public  void setMsgID(int msgID) 
    Set the msgID. This is used by the SocketManager read task to populate a msg with its request ID.
 public static  void setUseJMSServerMsgIDs(boolean flag) 
    Set the msgID parameter range. If false, the msgID is segmented into the range 1 to 2147483647 and if true, the rangs is -1 to -2147483647. The JMS server sets this to true and clients default to false.
 public String toString() 
 public static String toString(int msgType) 
    Translate a msgType into its string menmonic.
 public  void trimReply() 
    Trim the message when replying
 public  void write(ObjectOutputStream out) throws IOException 
    Write the msgType, msgID, hasError flag and optionally the error