You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ri...@apache.org on 2007/05/09 17:15:59 UTC
svn commit: r536560 - in /incubator/qpid/trunk/qpid: ./
java/broker/src/main/java/org/apache/qpid/server/
java/broker/src/main/java/org/apache/qpid/server/output/amqp0_8/
java/broker/src/main/java/org/apache/qpid/server/protocol/
java/broker/src/main/j...
Author: ritchiem
Date: Wed May 9 08:15:58 2007
New Revision: 536560
URL: http://svn.apache.org/viewvc?view=rev&rev=536560
Log:
Merged revisions 536480 via svnmerge from
https://svn.apache.org/repos/asf/incubator/qpid/branches/M2
........
r536480 | rgodfrey | 2007-05-09 11:24:13 +0100 (Wed, 09 May 2007) | 1 line
QPID-482 : Small performance enhancements
........
Modified:
incubator/qpid/trunk/qpid/ (props changed)
incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/AMQChannel.java
incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/output/amqp0_8/ProtocolOutputConverterImpl.java
incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQMinaProtocolSession.java
incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQMessage.java
incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SubscriptionImpl.java
incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/state/AMQStateManager.java
incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQShortString.java
incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicContentHeaderProperties.java
incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/framing/EncodingUtils.java
Propchange: incubator/qpid/trunk/qpid/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/AMQChannel.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/AMQChannel.java?view=diff&rev=536560&r1=536559&r2=536560
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/AMQChannel.java (original)
+++ incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/AMQChannel.java Wed May 9 08:15:58 2007
@@ -121,6 +121,7 @@
//Why do we need this reference ? - ritchiem
private final AMQProtocolSession _session;
+ private boolean _closing;
public AMQChannel(AMQProtocolSession session, int channelId, TransactionManager transactionManager, MessageStore messageStore, MessageRouter exchanges)
@@ -354,6 +355,7 @@
throws
AMQException
{
+ _closing = true;
_txnContext.rollback();
unsubscribeAllConsumers(session);
requeue();
@@ -965,5 +967,10 @@
public TransactionalContext getTransactionalContext()
{
return _txnContext;
+ }
+
+ public boolean isClosing()
+ {
+ return _closing;
}
}
Modified: incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/output/amqp0_8/ProtocolOutputConverterImpl.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/output/amqp0_8/ProtocolOutputConverterImpl.java?view=diff&rev=536560&r1=536559&r2=536560
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/output/amqp0_8/ProtocolOutputConverterImpl.java (original)
+++ incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/output/amqp0_8/ProtocolOutputConverterImpl.java Wed May 9 08:15:58 2007
@@ -77,7 +77,7 @@
final AMQMessageHandle messageHandle = message.getMessageHandle();
final StoreContext storeContext = message.getStoreContext();
- final long messageId = message.getMessageId();
+ final Long messageId = message.getMessageId();
final int bodyCount = messageHandle.getBodyCount(storeContext,messageId);
Modified: incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQMinaProtocolSession.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQMinaProtocolSession.java?view=diff&rev=536560&r1=536559&r2=536560
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQMinaProtocolSession.java (original)
+++ incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQMinaProtocolSession.java Wed May 9 08:15:58 2007
@@ -432,15 +432,16 @@
public AMQChannel getChannel(int channelId) throws AMQException
{
- if (channelAwaitingClosure(channelId))
+ final AMQChannel channel = ((channelId & CHANNEL_CACHE_SIZE) == channelId)
+ ? _cachedChannels[channelId]
+ : _channelMap.get(channelId);
+ if (channel == null || channel.isClosing())
{
return null;
}
else
{
- return ((channelId & CHANNEL_CACHE_SIZE) == channelId)
- ? _cachedChannels[channelId]
- : _channelMap.get(channelId);
+ return channel;
}
}
Modified: incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQMessage.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQMessage.java?view=diff&rev=536560&r1=536559&r2=536560
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQMessage.java (original)
+++ incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/AMQMessage.java Wed May 9 08:15:58 2007
@@ -214,10 +214,6 @@
// _taken = new AtomicBoolean(false);
- if (_log.isDebugEnabled())
- {
- _log.debug("Message(" + System.identityHashCode(this) + ") created (" + debugIdentity() + ")");
- }
}
/**
@@ -484,10 +480,10 @@
protected void incrementReference()
{
_referenceCount.incrementAndGet();
- if (_log.isDebugEnabled())
- {
- _log.debug("Ref count on message " + debugIdentity() + " incremented " + Arrays.asList(Thread.currentThread().getStackTrace()).subList(3, 6));
- }
+// if (_log.isDebugEnabled())
+// {
+// _log.debug("Ref count on message " + debugIdentity() + " incremented " + Arrays.asList(Thread.currentThread().getStackTrace()).subList(3, 6));
+// }
}
/**
@@ -512,10 +508,10 @@
{
try
{
- if (_log.isDebugEnabled())
- {
- _log.debug("Decremented ref count on message " + debugIdentity() + " is zero; removing message" + Arrays.asList(Thread.currentThread().getStackTrace()).subList(3, 6));
- }
+// if (_log.isDebugEnabled())
+// {
+// _log.debug("Decremented ref count on message " + debugIdentity() + " is zero; removing message" + Arrays.asList(Thread.currentThread().getStackTrace()).subList(3, 6));
+// }
// must check if the handle is null since there may be cases where we decide to throw away a message
// and the handle has not yet been constructed
@@ -532,14 +528,6 @@
}
} else
{
- if (_log.isDebugEnabled())
- {
- _log.debug("Decremented ref count is now " + count + " for message id " + debugIdentity() + "\n" + Arrays.asList(Thread.currentThread().getStackTrace()).subList(3, 5));
- if (count < 0)
- {
- Thread.dumpStack();
- }
- }
if (count < 0)
{
throw new MessageCleanupException("Reference count for message id " + debugIdentity() + " has gone below 0.");
Modified: incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SubscriptionImpl.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SubscriptionImpl.java?view=diff&rev=536560&r1=536559&r2=536560
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SubscriptionImpl.java (original)
+++ incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SubscriptionImpl.java Wed May 9 08:15:58 2007
@@ -322,17 +322,17 @@
public boolean isSuspended()
{
- if (_suspensionlogger.isInfoEnabled())
- {
- if (channel.isSuspended())
- {
- _suspensionlogger.info("Subscription(" + debugIdentity() + ") channel's is susupended");
- }
- if (_sendLock.get())
- {
- _suspensionlogger.info("Subscription(" + debugIdentity() + ") has sendLock set so closing.");
- }
- }
+// if (_suspensionlogger.isInfoEnabled())
+// {
+// if (channel.isSuspended())
+// {
+// _suspensionlogger.debug("Subscription(" + debugIdentity() + ") channel's is susupended");
+// }
+// if (_sendLock.get())
+// {
+// _suspensionlogger.debug("Subscription(" + debugIdentity() + ") has sendLock set so closing.");
+// }
+// }
return channel.isSuspended() || _sendLock.get();
}
@@ -381,11 +381,11 @@
{
if (localInstance == msgInstance || localInstance.equals(msgInstance))
{
- if (_logger.isTraceEnabled())
- {
- _logger.trace("(" + debugIdentity() + ") has no interest as it is a local message(" +
- msg.debugIdentity() + ")");
- }
+// if (_logger.isTraceEnabled())
+// {
+// _logger.trace("(" + debugIdentity() + ") has no interest as it is a local message(" +
+// msg.debugIdentity() + ")");
+// }
return false;
}
}
@@ -399,11 +399,11 @@
msgInstance = publisher.getClientIdentifier();
if (localInstance == msgInstance || ((localInstance != null) && localInstance.equals(msgInstance)))
{
- if (_logger.isTraceEnabled())
- {
- _logger.trace("(" + debugIdentity() + ") has no interest as it is a local message(" +
- msg.debugIdentity() + ")");
- }
+// if (_logger.isTraceEnabled())
+// {
+// _logger.trace("(" + debugIdentity() + ") has no interest as it is a local message(" +
+// msg.debugIdentity() + ")");
+// }
return false;
}
}
@@ -431,18 +431,18 @@
{
if (_filters != null)
{
- if (_logger.isTraceEnabled())
- {
- _logger.trace("(" + debugIdentity() + ") has filters.");
- }
+// if (_logger.isTraceEnabled())
+// {
+// _logger.trace("(" + debugIdentity() + ") has filters.");
+// }
return _filters.allAllow(msg);
}
else
{
- if (_logger.isTraceEnabled())
- {
- _logger.trace("(" + debugIdentity() + ") has no filters");
- }
+// if (_logger.isTraceEnabled())
+// {
+// _logger.trace("(" + debugIdentity() + ") has no filters");
+// }
return true;
}
Modified: incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/state/AMQStateManager.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/state/AMQStateManager.java?view=diff&rev=536560&r1=536559&r2=536560
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/state/AMQStateManager.java (original)
+++ incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/state/AMQStateManager.java Wed May 9 08:15:58 2007
@@ -241,10 +241,6 @@
B frame)
throws IllegalStateTransitionException
{
- if (_logger.isDebugEnabled())
- {
- _logger.debug("Looking for state transition handler for frame " + frame.getClass());
- }
final Map<Class<? extends AMQMethodBody>, StateAwareMethodListener<? extends AMQMethodBody>>
classToHandlerMap = _state2HandlersMap.get(currentState);
Modified: incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQShortString.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQShortString.java?view=diff&rev=536560&r1=536559&r2=536560
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQShortString.java (original)
+++ incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQShortString.java Wed May 9 08:15:58 2007
@@ -15,12 +15,14 @@
private final ByteBuffer _data;
private int _hashCode;
+ final int _length;
private static final char[] EMPTY_CHAR_ARRAY = new char[0];
public AMQShortString(byte[] data)
{
_data = ByteBuffer.wrap(data);
+ _length = data.length;
}
@@ -45,6 +47,7 @@
_data = ByteBuffer.wrap(stringBytes);
_data.rewind();
+ _length = length;
}
@@ -62,12 +65,14 @@
_data = ByteBuffer.wrap(stringBytes);
_data.rewind();
_hashCode = hash;
+ _length = length;
}
private AMQShortString(ByteBuffer data)
{
_data = data;
+ _length = data.limit();
}
@@ -78,7 +83,7 @@
*/
public int length()
{
- return _data.limit();
+ return _length;
}
public char charAt(int index)
Modified: incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicContentHeaderProperties.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicContentHeaderProperties.java?view=diff&rev=536560&r1=536559&r2=536560
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicContentHeaderProperties.java (original)
+++ incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/framing/BasicContentHeaderProperties.java Wed May 9 08:15:58 2007
@@ -83,6 +83,20 @@
private AMQShortString _clusterId;
private int _propertyFlags = 0;
+ private static final int CONTENT_TYPE_MASK = 1 << 15;
+ private static final int ENCONDING_MASK = 1 << 14;
+ private static final int HEADERS_MASK = 1 << 13;
+ private static final int DELIVERY_MODE_MASK = 1 << 12;
+ private static final int PROPRITY_MASK = 1 << 11;
+ private static final int CORRELATION_ID_MASK = 1 << 10;
+ private static final int REPLY_TO_MASK = 1 << 9;
+ private static final int EXPIRATION_MASK = 1 << 8;
+ private static final int MESSAGE_ID_MASK = 1 << 7;
+ private static final int TIMESTAMP_MASK = 1 << 6;
+ private static final int TYPE_MASK = 1 << 5;
+ private static final int USER_ID_MASK = 1 << 4;
+ private static final int APPLICATION_ID_MASK = 1 << 3;
+ private static final int CLUSTER_ID_MASK = 1 << 2;
public BasicContentHeaderProperties()
{
@@ -98,35 +112,35 @@
{
int size = 0;
- if ((_propertyFlags & (1 << 15)) > 0)
+ if ((_propertyFlags & (CONTENT_TYPE_MASK)) > 0)
{
size += EncodingUtils.encodedShortStringLength(_contentType);
}
- if ((_propertyFlags & (1 << 14)) > 0)
+ if ((_propertyFlags & ENCONDING_MASK) > 0)
{
size += EncodingUtils.encodedShortStringLength(_encoding);
}
- if ((_propertyFlags & (1 << 13)) > 0)
+ if ((_propertyFlags & HEADERS_MASK) > 0)
{
size += EncodingUtils.encodedFieldTableLength(_headers);
}
- if ((_propertyFlags & (1 << 12)) > 0)
+ if ((_propertyFlags & DELIVERY_MODE_MASK) > 0)
{
size += 1;
}
- if ((_propertyFlags & (1 << 11)) > 0)
+ if ((_propertyFlags & PROPRITY_MASK) > 0)
{
size += 1;
}
- if ((_propertyFlags & (1 << 10)) > 0)
+ if ((_propertyFlags & CORRELATION_ID_MASK) > 0)
{
size += EncodingUtils.encodedShortStringLength(_correlationId);
}
- if ((_propertyFlags & (1 << 9)) > 0)
+ if ((_propertyFlags & REPLY_TO_MASK) > 0)
{
size += EncodingUtils.encodedShortStringLength(_replyTo);
}
- if ((_propertyFlags & (1 << 8)) > 0)
+ if ((_propertyFlags & EXPIRATION_MASK) > 0)
{
if(_expiration == 0L)
{
@@ -137,27 +151,27 @@
size += EncodingUtils.encodedShortStringLength(_expiration);
}
}
- if ((_propertyFlags & (1 << 7)) > 0)
+ if ((_propertyFlags & MESSAGE_ID_MASK) > 0)
{
size += EncodingUtils.encodedShortStringLength(_messageId);
}
- if ((_propertyFlags & (1 << 6)) > 0)
+ if ((_propertyFlags & TIMESTAMP_MASK) > 0)
{
size += 8;
}
- if ((_propertyFlags & (1 << 5)) > 0)
+ if ((_propertyFlags & TYPE_MASK) > 0)
{
size += EncodingUtils.encodedShortStringLength(_type);
}
- if ((_propertyFlags & (1 << 4)) > 0)
+ if ((_propertyFlags & USER_ID_MASK) > 0)
{
size += EncodingUtils.encodedShortStringLength(_userId);
}
- if ((_propertyFlags & (1 << 3)) > 0)
+ if ((_propertyFlags & APPLICATION_ID_MASK) > 0)
{
size += EncodingUtils.encodedShortStringLength(_appId);
}
- if ((_propertyFlags & (1 << 2)) > 0)
+ if ((_propertyFlags & CLUSTER_ID_MASK) > 0)
{
size += EncodingUtils.encodedShortStringLength(_clusterId);
}
@@ -193,35 +207,35 @@
}
else
{
- if ((_propertyFlags & (1 << 15)) > 0)
+ if ((_propertyFlags & (CONTENT_TYPE_MASK)) != 0)
{
EncodingUtils.writeShortStringBytes(buffer, _contentType);
}
- if ((_propertyFlags & (1 << 14)) > 0)
+ if ((_propertyFlags & ENCONDING_MASK) != 0)
{
EncodingUtils.writeShortStringBytes(buffer, _encoding);
}
- if ((_propertyFlags & (1 << 13)) > 0)
+ if ((_propertyFlags & HEADERS_MASK) != 0)
{
EncodingUtils.writeFieldTableBytes(buffer, _headers);
}
- if ((_propertyFlags & (1 << 12)) > 0)
+ if ((_propertyFlags & DELIVERY_MODE_MASK) != 0)
{
buffer.put(_deliveryMode);
}
- if ((_propertyFlags & (1 << 11)) > 0)
+ if ((_propertyFlags & PROPRITY_MASK) != 0)
{
buffer.put(_priority);
}
- if ((_propertyFlags & (1 << 10)) > 0)
+ if ((_propertyFlags & CORRELATION_ID_MASK) != 0)
{
EncodingUtils.writeShortStringBytes(buffer, _correlationId);
}
- if ((_propertyFlags & (1 << 9)) > 0)
+ if ((_propertyFlags & REPLY_TO_MASK) != 0)
{
EncodingUtils.writeShortStringBytes(buffer, _replyTo);
}
- if ((_propertyFlags & (1 << 8)) > 0)
+ if ((_propertyFlags & EXPIRATION_MASK) != 0)
{
if(_expiration == 0L)
{
@@ -232,27 +246,27 @@
EncodingUtils.writeShortStringBytes(buffer, String.valueOf(_expiration));
}
}
- if ((_propertyFlags & (1 << 7)) > 0)
+ if ((_propertyFlags & MESSAGE_ID_MASK) != 0)
{
EncodingUtils.writeShortStringBytes(buffer, _messageId);
}
- if ((_propertyFlags & (1 << 6)) > 0)
+ if ((_propertyFlags & TIMESTAMP_MASK) != 0)
{
EncodingUtils.writeTimestamp(buffer, _timestamp);
}
- if ((_propertyFlags & (1 << 5)) > 0)
+ if ((_propertyFlags & TYPE_MASK) != 0)
{
EncodingUtils.writeShortStringBytes(buffer, _type);
}
- if ((_propertyFlags & (1 << 4)) > 0)
+ if ((_propertyFlags & USER_ID_MASK) != 0)
{
EncodingUtils.writeShortStringBytes(buffer, _userId);
}
- if ((_propertyFlags & (1 << 3)) > 0)
+ if ((_propertyFlags & APPLICATION_ID_MASK) != 0)
{
EncodingUtils.writeShortStringBytes(buffer, _appId);
}
- if ((_propertyFlags & (1 << 2)) > 0)
+ if ((_propertyFlags & CLUSTER_ID_MASK) != 0)
{
EncodingUtils.writeShortStringBytes(buffer, _clusterId);
}
@@ -282,59 +296,59 @@
int pos = buffer.position();
try
{
- if ((_propertyFlags & (1 << 15)) > 0)
+ if ((_propertyFlags & (CONTENT_TYPE_MASK)) != 0)
{
_contentType = EncodingUtils.readAMQShortString(buffer);
}
- if ((_propertyFlags & (1 << 14)) > 0)
+ if ((_propertyFlags & ENCONDING_MASK) != 0)
{
_encoding = EncodingUtils.readAMQShortString(buffer);
}
- if ((_propertyFlags & (1 << 13)) > 0)
+ if ((_propertyFlags & HEADERS_MASK) != 0)
{
_headers = EncodingUtils.readFieldTable(buffer);
}
- if ((_propertyFlags & (1 << 12)) > 0)
+ if ((_propertyFlags & DELIVERY_MODE_MASK) != 0)
{
_deliveryMode = buffer.get();
}
- if ((_propertyFlags & (1 << 11)) > 0)
+ if ((_propertyFlags & PROPRITY_MASK) != 0)
{
_priority = buffer.get();
}
- if ((_propertyFlags & (1 << 10)) > 0)
+ if ((_propertyFlags & CORRELATION_ID_MASK) != 0)
{
_correlationId = EncodingUtils.readAMQShortString(buffer);
}
- if ((_propertyFlags & (1 << 9)) > 0)
+ if ((_propertyFlags & REPLY_TO_MASK) != 0)
{
_replyTo = EncodingUtils.readAMQShortString(buffer);
}
- if ((_propertyFlags & (1 << 8)) > 0)
+ if ((_propertyFlags & EXPIRATION_MASK) != 0)
{
_expiration = EncodingUtils.readLongAsShortString(buffer);
}
- if ((_propertyFlags & (1 << 7)) > 0)
+ if ((_propertyFlags & MESSAGE_ID_MASK) != 0)
{
_messageId = EncodingUtils.readAMQShortString(buffer);
}
- if ((_propertyFlags & (1 << 6)) > 0)
+ if ((_propertyFlags & TIMESTAMP_MASK) != 0)
{
_timestamp = EncodingUtils.readTimestamp(buffer);
}
- if ((_propertyFlags & (1 << 5)) > 0)
+ if ((_propertyFlags & TYPE_MASK) != 0)
{
_type = EncodingUtils.readAMQShortString(buffer);
}
- if ((_propertyFlags & (1 << 4)) > 0)
+ if ((_propertyFlags & USER_ID_MASK) != 0)
{
_userId = EncodingUtils.readAMQShortString(buffer);
}
- if ((_propertyFlags & (1 << 3)) > 0)
+ if ((_propertyFlags & APPLICATION_ID_MASK) != 0)
{
_appId = EncodingUtils.readAMQShortString(buffer);
}
- if ((_propertyFlags & (1 << 2)) > 0)
+ if ((_propertyFlags & CLUSTER_ID_MASK) != 0)
{
_clusterId = EncodingUtils.readAMQShortString(buffer);
}
@@ -362,17 +376,17 @@
ByteBuffer buffer = ByteBuffer.wrap(_encodedForm);
try
{
- if ((_propertyFlags & (1 << 15)) > 0)
+ if ((_propertyFlags & (CONTENT_TYPE_MASK)) != 0)
{
byte length = buffer.get();
buffer.skip(length);
}
- if ((_propertyFlags & (1 << 14)) > 0)
+ if ((_propertyFlags & ENCONDING_MASK) != 0)
{
byte length = buffer.get();
buffer.skip(length);
}
- if ((_propertyFlags & (1 << 13)) > 0)
+ if ((_propertyFlags & HEADERS_MASK) != 0)
{
_headers = EncodingUtils.readFieldTable(buffer);
@@ -389,7 +403,7 @@
{
ByteBuffer buffer = ByteBuffer.wrap(_encodedForm);
- if ((_propertyFlags & (1 << 15)) > 0)
+ if ((_propertyFlags & (CONTENT_TYPE_MASK)) != 0)
{
_contentType = EncodingUtils.readAMQShortString(buffer);
}
@@ -437,7 +451,7 @@
public void setContentType(AMQShortString contentType)
{
clearEncodedForm();
- _propertyFlags |= (1 << 15);
+ _propertyFlags |= (CONTENT_TYPE_MASK);
_contentType = contentType;
}
@@ -462,14 +476,14 @@
public void setEncoding(String encoding)
{
clearEncodedForm();
- _propertyFlags |= (1 << 14);
+ _propertyFlags |= ENCONDING_MASK;
_encoding = encoding == null ? null : new AMQShortString(encoding);
}
public void setEncoding(AMQShortString encoding)
{
clearEncodedForm();
- _propertyFlags |= (1 << 14);
+ _propertyFlags |= ENCONDING_MASK;
_encoding = encoding;
}
@@ -489,7 +503,7 @@
public void setHeaders(FieldTable headers)
{
clearEncodedForm();
- _propertyFlags |= (1 << 13);
+ _propertyFlags |= HEADERS_MASK;
_headers = headers;
}
@@ -503,7 +517,7 @@
public void setDeliveryMode(byte deliveryMode)
{
clearEncodedForm();
- _propertyFlags |= (1 << 12);
+ _propertyFlags |= DELIVERY_MODE_MASK;
_deliveryMode = deliveryMode;
}
@@ -516,7 +530,7 @@
public void setPriority(byte priority)
{
clearEncodedForm();
- _propertyFlags |= (1 << 11);
+ _propertyFlags |= PROPRITY_MASK;
_priority = priority;
}
@@ -540,7 +554,7 @@
public void setCorrelationId(AMQShortString correlationId)
{
clearEncodedForm();
- _propertyFlags |= (1 << 10);
+ _propertyFlags |= CORRELATION_ID_MASK;
_correlationId = correlationId;
}
@@ -566,7 +580,7 @@
{
clearEncodedForm();
- _propertyFlags |= (1 << 9);
+ _propertyFlags |= REPLY_TO_MASK;
_replyTo = replyTo;
}
@@ -579,7 +593,7 @@
public void setExpiration(long expiration)
{
clearEncodedForm();
- _propertyFlags |= (1 << 8);
+ _propertyFlags |= EXPIRATION_MASK;
_expiration = expiration;
}
@@ -599,14 +613,14 @@
public void setMessageId(String messageId)
{
clearEncodedForm();
- _propertyFlags |= (1 << 7);
+ _propertyFlags |= MESSAGE_ID_MASK;
_messageId = messageId == null ? null : new AMQShortString(messageId);
}
public void setMessageId(AMQShortString messageId)
{
clearEncodedForm();
- _propertyFlags |= (1 << 7);
+ _propertyFlags |= MESSAGE_ID_MASK;
_messageId = messageId;
}
@@ -620,7 +634,7 @@
public void setTimestamp(long timestamp)
{
clearEncodedForm();
- _propertyFlags |= (1 << 6);
+ _propertyFlags |= TIMESTAMP_MASK;
_timestamp = timestamp;
}
@@ -646,7 +660,7 @@
public void setType(AMQShortString type)
{
clearEncodedForm();
- _propertyFlags |= (1 << 5);
+ _propertyFlags |= TYPE_MASK;
_type = type;
}
@@ -670,7 +684,7 @@
public void setUserId(AMQShortString userId)
{
clearEncodedForm();
- _propertyFlags |= (1 << 4);
+ _propertyFlags |= USER_ID_MASK;
_userId = userId;
}
@@ -694,7 +708,7 @@
public void setAppId(AMQShortString appId)
{
clearEncodedForm();
- _propertyFlags |= (1 << 3);
+ _propertyFlags |= APPLICATION_ID_MASK;
_appId = appId;
}
@@ -718,7 +732,7 @@
public void setClusterId(AMQShortString clusterId)
{
clearEncodedForm();
- _propertyFlags |= (1 << 2);
+ _propertyFlags |= CLUSTER_ID_MASK;
_clusterId = clusterId;
}
Modified: incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/framing/EncodingUtils.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/framing/EncodingUtils.java?view=diff&rev=536560&r1=536559&r2=536560
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/framing/EncodingUtils.java (original)
+++ incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/framing/EncodingUtils.java Wed May 9 08:15:58 2007
@@ -157,7 +157,7 @@
}
else
{
- return (short) (1 + s.length());
+ return (1 + s.length());
}
}
@@ -1023,4 +1023,7 @@
return l;
}
+
+
+
}