@Override public void storeContent() { ByteSequence bodyAsBytes = getContent(); if (bodyAsBytes == null && object != null) { try { ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(); OutputStream os = bytesOut; ActiveMQConnection connection = getConnection(); if (connection != null && connection.isUseCompression()) { compressed = true; os = new DeflaterOutputStream(os); } DataOutputStream dataOut = new DataOutputStream(os); ObjectOutputStream objOut = new ObjectOutputStream(dataOut); objOut.writeObject(object); objOut.flush(); objOut.reset(); objOut.close(); setContent(bytesOut.toByteSequence()); } catch (IOException ioe) { throw new RuntimeException(ioe.getMessage(), ioe); } } }
/** * Sets the serializable object containing this message's data. It is * important to note that an <CODE>ObjectMessage</CODE> contains a * snapshot of the object at the time <CODE>setObject()</CODE> is called; * subsequent modifications of the object will have no effect on the * <CODE>ObjectMessage</CODE> body. * * @param newObject the message's data * @throws JMSException if the JMS provider fails to set the object due to * some internal error. * @throws javax.jms.MessageFormatException if object serialization fails. * @throws javax.jms.MessageNotWriteableException if the message is in * read-only mode. */ @Override public void setObject(Serializable newObject) throws JMSException { checkReadOnlyBody(); this.object = newObject; setContent(null); ActiveMQConnection connection = getConnection(); if (connection == null || !connection.isObjectMessageSerializationDefered()) { storeContent(); } }
public static ActiveMQObjectMessage createObjectMessage(byte[] content, int offset, int length) { ActiveMQObjectMessage message = new ActiveMQObjectMessage(); message.setContent(new ByteSequence(content, offset, length)); return message; }
public static ActiveMQObjectMessage createObjectMessage(byte[] content, int offset, int length) { ActiveMQObjectMessage message = new ActiveMQObjectMessage(); message.setContent(new ByteSequence(content, offset, length)); return message; }
@Override public void storeContent() { ByteSequence bodyAsBytes = getContent(); if (bodyAsBytes == null && object != null) { try { ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(); OutputStream os = bytesOut; ActiveMQConnection connection = getConnection(); if (connection != null && connection.isUseCompression()) { compressed = true; os = new DeflaterOutputStream(os); } DataOutputStream dataOut = new DataOutputStream(os); ObjectOutputStream objOut = new ObjectOutputStream(dataOut); objOut.writeObject(object); objOut.flush(); objOut.reset(); objOut.close(); setContent(bytesOut.toByteSequence()); } catch (IOException ioe) { throw new RuntimeException(ioe.getMessage(), ioe); } } }
@Override public void storeContent() { ByteSequence bodyAsBytes = getContent(); if (bodyAsBytes == null && object != null) { try { ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(); OutputStream os = bytesOut; ActiveMQConnection connection = getConnection(); if (connection != null && connection.isUseCompression()) { compressed = true; os = new DeflaterOutputStream(os); } DataOutputStream dataOut = new DataOutputStream(os); ObjectOutputStream objOut = new ObjectOutputStream(dataOut); objOut.writeObject(object); objOut.flush(); objOut.reset(); objOut.close(); setContent(bytesOut.toByteSequence()); } catch (IOException ioe) { throw new RuntimeException(ioe.getMessage(), ioe); } } }
@Override public void storeContent() { ByteSequence bodyAsBytes = getContent(); if (bodyAsBytes == null && object != null) { try { ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(); OutputStream os = bytesOut; ActiveMQConnection connection = getConnection(); if (connection != null && connection.isUseCompression()) { compressed = true; os = new DeflaterOutputStream(os); } DataOutputStream dataOut = new DataOutputStream(os); ObjectOutputStream objOut = new ObjectOutputStream(dataOut); objOut.writeObject(object); objOut.flush(); objOut.reset(); objOut.close(); setContent(bytesOut.toByteSequence()); } catch (IOException ioe) { throw new RuntimeException(ioe.getMessage(), ioe); } } }
public void storeContent() { ByteSequence bodyAsBytes = getContent(); if (bodyAsBytes == null && object != null) { try { ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(); OutputStream os = bytesOut; ActiveMQConnection connection = getConnection(); if (connection != null && connection.isUseCompression()) { compressed = true; os = new DeflaterOutputStream(os); } DataOutputStream dataOut = new DataOutputStream(os); ObjectOutputStream objOut = new ObjectOutputStream(dataOut); objOut.writeObject(object); objOut.flush(); objOut.reset(); objOut.close(); setContent(bytesOut.toByteSequence()); } catch (IOException ioe) { throw new RuntimeException(ioe.getMessage(), ioe); } } }
/** * Sets the serializable object containing this message's data. It is * important to note that an <CODE>ObjectMessage</CODE> contains a * snapshot of the object at the time <CODE>setObject()</CODE> is called; * subsequent modifications of the object will have no effect on the * <CODE>ObjectMessage</CODE> body. * * @param newObject the message's data * @throws JMSException if the JMS provider fails to set the object due to * some internal error. * @throws javax.jms.MessageFormatException if object serialization fails. * @throws javax.jms.MessageNotWriteableException if the message is in * read-only mode. */ @Override public void setObject(Serializable newObject) throws JMSException { checkReadOnlyBody(); this.object = newObject; setContent(null); ActiveMQConnection connection = getConnection(); if (connection == null || !connection.isObjectMessageSerializationDefered()) { storeContent(); } }
/** * Sets the serializable object containing this message's data. It is * important to note that an <CODE>ObjectMessage</CODE> contains a * snapshot of the object at the time <CODE>setObject()</CODE> is called; * subsequent modifications of the object will have no effect on the * <CODE>ObjectMessage</CODE> body. * * @param newObject the message's data * @throws JMSException if the JMS provider fails to set the object due to * some internal error. * @throws javax.jms.MessageFormatException if object serialization fails. * @throws javax.jms.MessageNotWriteableException if the message is in * read-only mode. */ @Override public void setObject(Serializable newObject) throws JMSException { checkReadOnlyBody(); this.object = newObject; setContent(null); ActiveMQConnection connection = getConnection(); if (connection == null || !connection.isObjectMessageSerializationDefered()) { storeContent(); } }
/** * Sets the serializable object containing this message's data. It is * important to note that an <CODE>ObjectMessage</CODE> contains a * snapshot of the object at the time <CODE>setObject()</CODE> is called; * subsequent modifications of the object will have no effect on the * <CODE>ObjectMessage</CODE> body. * * @param newObject the message's data * @throws JMSException if the JMS provider fails to set the object due to * some internal error. * @throws javax.jms.MessageFormatException if object serialization fails. * @throws javax.jms.MessageNotWriteableException if the message is in * read-only mode. */ public void setObject(Serializable newObject) throws JMSException { checkReadOnlyBody(); this.object = newObject; setContent(null); ActiveMQConnection connection = getConnection(); if (connection == null || !connection.isObjectMessageSerializationDefered()) { storeContent(); } }
/** * Sets the serializable object containing this message's data. It is * important to note that an <CODE>ObjectMessage</CODE> contains a * snapshot of the object at the time <CODE>setObject()</CODE> is called; * subsequent modifications of the object will have no effect on the * <CODE>ObjectMessage</CODE> body. * * @param newObject the message's data * @throws JMSException if the JMS provider fails to set the object due to * some internal error. * @throws javax.jms.MessageFormatException if object serialization fails. * @throws javax.jms.MessageNotWriteableException if the message is in * read-only mode. */ @Override public void setObject(Serializable newObject) throws JMSException { checkReadOnlyBody(); this.object = newObject; setContent(null); ActiveMQConnection connection = getConnection(); if (connection == null || !connection.isObjectMessageSerializationDefered()) { storeContent(); } }