Author: timfox
Date: 2009-11-06 04:52:34 -0500 (Fri, 06 Nov 2009)
New Revision: 8233
Modified:
trunk/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java
trunk/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java
Log:
some tweaks to setting page store on message
Modified: trunk/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java 2009-11-06
04:27:59 UTC (rev 8232)
+++ trunk/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java 2009-11-06
09:52:34 UTC (rev 8233)
@@ -538,7 +538,7 @@
{
throw new IllegalStateException("Message cannot be routed more than
once");
}
-
+
RoutingContext context = new RoutingContextImpl(tx);
SimpleString address = message.getDestination();
@@ -596,6 +596,8 @@
cache.addToCache(duplicateIDBytes, context.getTransaction());
}
+
+ setPagingStore(message);
if (context.getTransaction() == null)
{
@@ -665,7 +667,9 @@
}
public MessageReference reroute(final ServerMessage message, final Queue queue, final
Transaction tx) throws Exception
- {
+ {
+ setPagingStore(message);
+
MessageReference reference = message.createReference(queue);
Long scheduledDeliveryTime =
(Long)message.getProperty(MessageImpl.HDR_SCHEDULED_DELIVERY_TIME);
@@ -772,8 +776,6 @@
message.setBody(ChannelBuffers.EMPTY_BUFFER);
message.setDestination(queueName);
message.putBooleanProperty(HDR_RESET_QUEUE_DATA, true);
- // queue.preroute(message, null);
- // queue.route(message, null);
routeDirect(message, queue, false);
for (QueueInfo info : queueInfos.values())
@@ -828,6 +830,13 @@
// Private -----------------------------------------------------------------
+ private void setPagingStore(final ServerMessage message) throws Exception
+ {
+ PagingStore store = pagingManager.getPageStore(message.getDestination());
+
+ message.setPagingStore(store);
+ }
+
private void routeDirect(final ServerMessage message, final Queue queue, final boolean
applyFilters) throws Exception
{
if (!applyFilters || queue.getFilter() == null ||
queue.getFilter().match(message))
@@ -860,11 +869,11 @@
{
reference.setScheduledDeliveryTime(scheduledDeliveryTime);
}
-
+
if (message.isDurable() && queue.isDurable())
{
int durableRefCount = message.incrementDurableRefCount();
-
+
if (durableRefCount == 1)
{
if (tx != null)
@@ -1180,7 +1189,7 @@
if (!pagingStoresToSync.isEmpty())
{
- for (PagingStore store: pagingStoresToSync)
+ for (PagingStore store : pagingStoresToSync)
{
store.sync();
}
@@ -1228,7 +1237,7 @@
public void beforeRollback(Transaction tx) throws Exception
{
// Reverse the ref counts, and paging sizes
-
+
for (MessageReference ref : refs)
{
ServerMessage message = ref.getMessage();
Modified: trunk/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java 2009-11-06 04:27:59
UTC (rev 8232)
+++ trunk/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java 2009-11-06 09:52:34
UTC (rev 8233)
@@ -1437,8 +1437,6 @@
try
{
- setPagingStore(message);
-
long id = storageManager.generateUniqueID();
message.setMessageID(id);
@@ -1768,8 +1766,6 @@
{
LargeServerMessage msg = createLargeMessageStorage(id,
packet.getLargeMessageHeader());
- setPagingStore(msg);
-
return msg;
}
catch (Exception e)
@@ -1884,32 +1880,31 @@
holder.store.returnProducerCredits(credits);
}
- // TODO can we combine these two methods....
- private CreditManagerHolder getCreditManagerHolder(final SimpleString address) throws
Exception
+ private CreditManagerHolder getCreditManagerHolder(final ServerMessage message) throws
Exception
{
+ SimpleString address = message.getDestination();
+
CreditManagerHolder holder = creditManagerHolders.get(address);
if (holder == null)
{
- PagingStore store = postOffice.getPagingManager().getPageStore(address);
+ holder = new CreditManagerHolder(message.getPagingStore());
- holder = new CreditManagerHolder(store);
-
creditManagerHolders.put(address, holder);
}
return holder;
}
-
- private CreditManagerHolder getCreditManagerHolder(final ServerMessage message) throws
Exception
+
+ private CreditManagerHolder getCreditManagerHolder(final SimpleString address) throws
Exception
{
- SimpleString address = message.getDestination();
-
CreditManagerHolder holder = creditManagerHolders.get(address);
if (holder == null)
{
- holder = new CreditManagerHolder(message.getPagingStore());
+ PagingStore store = postOffice.getPagingManager().getPageStore(address);
+
+ holder = new CreditManagerHolder(store);
creditManagerHolders.put(address, holder);
}
@@ -1917,13 +1912,6 @@
return holder;
}
- private void setPagingStore(final ServerMessage message) throws Exception
- {
- PagingStore store =
postOffice.getPagingManager().getPageStore(message.getDestination());
-
- message.setPagingStore(store);
- }
-
private void sendProducerCredits(final CreditManagerHolder holder, final int credits,
final SimpleString address)
{
holder.outstandingCredits += credits;
Show replies by date