📄 messageimpl.java
字号:
public Destination getJMSDestination() throws JMSException {
return _messageHeader.getJMSDestination();
}
public void setJMSDestination(Destination destination)
throws JMSException {
_messageHeader.setJMSDestination(destination);
}
public int getJMSDeliveryMode() throws JMSException {
return _messageHeader.getJMSDeliveryMode();
}
public void setJMSDeliveryMode(int deliveryMode) throws JMSException {
_messageHeader.setJMSDeliveryMode(deliveryMode);
}
public boolean getJMSRedelivered() throws JMSException {
return _messageHeader.getJMSRedelivered();
}
public void setJMSRedelivered(boolean redelivered) throws JMSException {
_messageHeader.setJMSRedelivered(redelivered);
}
public String getJMSType() throws JMSException {
return _messageHeader.getJMSType();
}
public void setJMSType(String type) throws JMSException {
_messageHeader.setJMSType(type);
}
public long getJMSExpiration() throws JMSException {
return _messageHeader.getJMSExpiration();
}
public void setJMSExpiration(long expiration) throws JMSException {
_messageHeader.setJMSExpiration(expiration);
}
public int getJMSPriority() throws JMSException {
return _messageHeader.getJMSPriority();
}
public void setJMSPriority(int priority) throws JMSException {
_messageHeader.setJMSPriority(priority);
}
/**
* Checks whether the message is persistent.
*
* @return boolean - true if it is
*/
public boolean isPersistent() {
return _messageHeader.isPersistent();
}
//Expedited or normal
public boolean isPriorityExpedited() throws JMSException {
return _messageHeader.isPriorityExpedited();
}
public void clearProperties() throws JMSException {
_messageProperties.clearProperties();
_propertiesReadOnly = false;
}
public boolean propertyExists(String name) throws JMSException {
return _messageProperties.propertyExists(name);
}
public boolean getBooleanProperty(String name) throws JMSException {
return _messageProperties.getBooleanProperty(name);
}
public byte getByteProperty(String name) throws JMSException {
return _messageProperties.getByteProperty(name);
}
public short getShortProperty(String name) throws JMSException {
return _messageProperties.getShortProperty(name);
}
public int getIntProperty(String name) throws JMSException {
return _messageProperties.getIntProperty(name);
}
public long getLongProperty(String name) throws JMSException {
return _messageProperties.getLongProperty(name);
}
public float getFloatProperty(String name) throws JMSException {
return _messageProperties.getFloatProperty(name);
}
public double getDoubleProperty(String name) throws JMSException {
return _messageProperties.getDoubleProperty(name);
}
public String getStringProperty(String name) throws JMSException {
return _messageProperties.getStringProperty(name);
}
public Object getObjectProperty(String name) throws JMSException {
return _messageProperties.getObjectProperty(name);
}
public Enumeration getPropertyNames() throws JMSException {
return _messageProperties.getPropertyNames();
}
public void setBooleanProperty(String name, boolean value)
throws JMSException {
checkPropertyWrite();
_messageProperties.setBooleanProperty(name, value);
}
public void setByteProperty(String name, byte value) throws JMSException {
checkPropertyWrite();
_messageProperties.setByteProperty(name, value);
}
public void setShortProperty(String name, short value)
throws JMSException {
checkPropertyWrite();
_messageProperties.setShortProperty(name, value);
}
public void setIntProperty(String name, int value) throws JMSException {
checkPropertyWrite();
_messageProperties.setIntProperty(name, value);
}
public void setLongProperty(String name, long value) throws JMSException {
checkPropertyWrite();
_messageProperties.setLongProperty(name, value);
}
public void setFloatProperty(String name, float value)
throws JMSException {
checkPropertyWrite();
_messageProperties.setFloatProperty(name, value);
}
public void setDoubleProperty(String name, double value)
throws JMSException {
checkPropertyWrite();
_messageProperties.setDoubleProperty(name, value);
}
public void setStringProperty(String name, String value)
throws JMSException {
checkPropertyWrite();
_messageProperties.setStringProperty(name, value);
}
public void setObjectProperty(String name, Object value)
throws JMSException {
checkPropertyWrite();
_messageProperties.setObjectProperty(name, value);
}
/**
* Acknowledge the message through the session that dispatched it.
* Throw JMSException is there is no session attached to the message
*
* @throws JMSException if acknowledgement fails
*/
public void acknowledge() throws JMSException {
if (getAckMessageID() == null) {
throw new JMSException(
"Cannot acknowledge message: no identifier");
}
if (_session == null) {
throw new JMSException(
"Cannot acknowledge message: unknown session");
}
_session.acknowledgeMessage(this);
}
public void clearBody() throws JMSException {
_bodyReadOnly = false;
}
public final void checkPropertyWrite()
throws MessageNotWriteableException {
if (_propertiesReadOnly) {
throw new MessageNotWriteableException(
"Message in read-only mode");
}
}
public final void checkWrite() throws MessageNotWriteableException {
if (_bodyReadOnly) {
throw new MessageNotWriteableException(
"Message in read-only mode");
}
}
public final void checkRead() throws MessageNotReadableException {
if (_bodyReadOnly == false) {
throw new MessageNotReadableException(
"Message in write-only mode");
}
}
// implementation of Identifiable.getId()
public String getId() {
return _messageHeader.getMessageId().getId();
}
/**
* Set the time that the message was accepted by the server. This is
* different to the JMSTimestamp, which denotes the time that the message
* was handed off to the provider.
*
* @param time the time that the message was accepted by the server
*/
public void setAcceptedTime(long time) {
_acceptedTime = time;
}
/**
* Return the time that the messages was accepted by the server
*
* @return time in milliseconds
*/
public long getAcceptedTime() {
return _acceptedTime;
}
/**
* Set the sequence number for this message. Not mandatory.
*
* @param seq the sequence number, which is used for ordering
*/
public void setSequenceNumber(long seq) {
_sequenceNumber = seq;
}
/**
* Return the sequence number associated with this message
*
* @return the sequence number
*/
public long getSequenceNumber() {
return _sequenceNumber;
}
/**
* Set the id of the connection that this message was received on
*
* @param id the connection id
*/
public void setConnectionId(int id) {
_connectionId = id;
}
/**
* Return the id of the connection that this messaged was received on
*
* @return the connection id
*/
public int getConnectionId() {
return _connectionId;
}
/**
* Set the processed state of the message
*
* @param state true if message has been processed by provider
*/
public void setProcessed(boolean state) {
_processed = state;
}
/**
* Check whether the message has been processed
*
* @return true if the message has been processed
*/
public boolean getProcessed() {
return _processed;
}
/**
* Set the read-only state of the message
*
* @param readOnly if true, make the message body and properties read-only
* @throws JMSException if the read-only state cannot be changed
*/
public void setReadOnly(boolean readOnly) throws JMSException {
_propertiesReadOnly = readOnly;
_bodyReadOnly = readOnly;
}
/**
* Get the read-only state of the message. Note that this only returns true
* if both properties and body are read-only
*
* @return true if the message is read-only
*/
public final boolean getReadOnly() {
return _propertiesReadOnly && _bodyReadOnly;
}
/**
* Set the JMSXRcvTimestamp property. This bypasses the read-only
* check to avoid unwanted exceptions.
*/
public void setJMSXRcvTimestamp(long timestamp) {
_messageProperties.setJMSXRcvTimestamp(timestamp);
}
} //-- MessageImpl
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -