public static AbstractMessage duplicate ( Message srcMessage ) throws JMSException { AbstractMessage msgCopy ; // Internal type copy if ( srcMessage instanceof AbstractMessage ) msgCopy = ( ( AbstractMessage ) srcMessage ) . copy ( ) ; else if ( srcMessage instanceof TextMessage ) msgCopy = duplicateTextMessage ( ( TextMessage ) srcMessage ) ; else if ( srcMessage instanceof ObjectMessage ) msgCopy = duplicateObjectMessage ( ( ObjectMessage ) srcMessage ) ; else if ( srcMessage instanceof BytesMessage ) msgCopy = duplicateBytesMessage ( ( BytesMessage ) srcMessage ) ; else if ( srcMessage instanceof MapMessage ) msgCopy = duplicateMapMessage ( ( MapMessage ) srcMessage ) ; else if ( srcMessage instanceof StreamMessage ) msgCopy = duplicateStreamMessage ( ( StreamMessage ) srcMessage ) ; else msgCopy = duplicateMessage ( srcMessage ) ; return msgCopy ; }
Create an independant copy of the given message