[hornetq-commits] JBoss hornetq SVN: r8162 - in trunk: src/main/org/hornetq/core/persistence/impl/journal and 4 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Wed Oct 28 20:35:31 EDT 2009
Author: clebert.suconic at jboss.com
Date: 2009-10-28 20:35:30 -0400 (Wed, 28 Oct 2009)
New Revision: 8162
Modified:
trunk/src/main/org/hornetq/core/persistence/StorageManager.java
trunk/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
trunk/src/main/org/hornetq/core/persistence/impl/nullpm/NullStorageManager.java
trunk/src/main/org/hornetq/core/server/group/impl/LocalGroupingHandler.java
trunk/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusteredGroupingTest.java
trunk/tests/src/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java
Log:
just small tweaks
Modified: trunk/src/main/org/hornetq/core/persistence/StorageManager.java
===================================================================
--- trunk/src/main/org/hornetq/core/persistence/StorageManager.java 2009-10-28 23:49:56 UTC (rev 8161)
+++ trunk/src/main/org/hornetq/core/persistence/StorageManager.java 2009-10-29 00:35:30 UTC (rev 8162)
@@ -56,6 +56,10 @@
boolean isReplicated();
void afterReplicated(Runnable run);
+
+ /** Block until the replication is done.
+ * @throws Exception */
+ void waitOnReplication(long timeout) throws Exception;
void completeReplication();
Modified: trunk/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
===================================================================
--- trunk/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java 2009-10-28 23:49:56 UTC (rev 8161)
+++ trunk/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java 2009-10-29 00:35:30 UTC (rev 8162)
@@ -26,11 +26,12 @@
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executor;
+import java.util.concurrent.TimeUnit;
import javax.transaction.xa.Xid;
-import org.hornetq.core.buffers.ChannelBuffer;
import org.hornetq.core.buffers.ChannelBuffers;
import org.hornetq.core.config.Configuration;
import org.hornetq.core.exception.HornetQException;
@@ -52,9 +53,9 @@
import org.hornetq.core.paging.PagedMessage;
import org.hornetq.core.paging.PagingManager;
import org.hornetq.core.paging.impl.PageTransactionInfoImpl;
+import org.hornetq.core.persistence.GroupingInfo;
import org.hornetq.core.persistence.QueueBindingInfo;
import org.hornetq.core.persistence.StorageManager;
-import org.hornetq.core.persistence.GroupingInfo;
import org.hornetq.core.postoffice.Binding;
import org.hornetq.core.postoffice.PostOffice;
import org.hornetq.core.remoting.impl.wireformat.XidCodecSupport;
@@ -297,6 +298,26 @@
return replicator != null;
}
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#blockOnReplication()
+ */
+ public void waitOnReplication(final long timeout) throws Exception
+ {
+ final CountDownLatch latch = new CountDownLatch(1);
+ afterReplicated(new Runnable()
+ {
+ public void run()
+ {
+ latch.countDown();
+ }
+ });
+ completeReplication();
+ if (!latch.await(timeout, TimeUnit.MILLISECONDS))
+ {
+ throw new IllegalStateException("no response received from replication");
+ }
+ }
+
// TODO: shouldn't those page methods be on the PageManager?
/*
@@ -1142,17 +1163,16 @@
resourceManager.putTransaction(xid, tx);
}
}
+
//grouping handler operations
public void addGrouping(GroupBinding groupBinding) throws Exception
{
GroupingEncoding groupingEncoding = new GroupingEncoding(groupBinding.getId(), groupBinding.getGroupId(), groupBinding.getClusterName());
- System.out.println("groupingEncoding = " + groupingEncoding);
bindingsJournal.appendAddRecord(groupBinding.getId(), GROUP_RECORD, groupingEncoding, true);
}
public void deleteGrouping(GroupBinding groupBinding) throws Exception
{
- System.out.println("deleting groupBinding = " + groupBinding);
bindingsJournal.appendDeleteRecord(groupBinding.getId(), true);
}
Modified: trunk/src/main/org/hornetq/core/persistence/impl/nullpm/NullStorageManager.java
===================================================================
--- trunk/src/main/org/hornetq/core/persistence/impl/nullpm/NullStorageManager.java 2009-10-28 23:49:56 UTC (rev 8161)
+++ trunk/src/main/org/hornetq/core/persistence/impl/nullpm/NullStorageManager.java 2009-10-29 00:35:30 UTC (rev 8162)
@@ -321,12 +321,17 @@
public void addGrouping(GroupBinding groupBinding) throws Exception
{
- //To change body of implemented methods use File | Settings | File Templates.
}
public void deleteGrouping(GroupBinding groupBinding) throws Exception
{
- //To change body of implemented methods use File | Settings | File Templates.
}
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#blockOnReplication(long)
+ */
+ public void waitOnReplication(long timeout) throws Exception
+ {
+ }
+
}
Modified: trunk/src/main/org/hornetq/core/server/group/impl/LocalGroupingHandler.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/group/impl/LocalGroupingHandler.java 2009-10-28 23:49:56 UTC (rev 8161)
+++ trunk/src/main/org/hornetq/core/server/group/impl/LocalGroupingHandler.java 2009-10-29 00:35:30 UTC (rev 8162)
@@ -12,24 +12,21 @@
*/
package org.hornetq.core.server.group.impl;
-import org.hornetq.core.management.NotificationType;
-import org.hornetq.core.management.Notification;
-import org.hornetq.core.management.ManagementService;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
+
import org.hornetq.core.client.management.impl.ManagementHelper;
-import org.hornetq.core.postoffice.BindingType;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.server.group.GroupingHandler;
+import org.hornetq.core.management.ManagementService;
+import org.hornetq.core.management.Notification;
+import org.hornetq.core.management.NotificationType;
import org.hornetq.core.persistence.StorageManager;
+import org.hornetq.core.postoffice.BindingType;
+import org.hornetq.core.server.group.GroupingHandler;
import org.hornetq.utils.SimpleString;
import org.hornetq.utils.TypedProperties;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-import java.util.HashMap;
-import java.util.List;
-import java.util.ArrayList;
-
/**
* A Local Grouping handler. All the Remote handlers will talk with us
*
@@ -88,19 +85,7 @@
storageManager.addGrouping(groupBinding);
if (storageManager.isReplicated())
{
- final CountDownLatch latch = new CountDownLatch(1);
- storageManager.afterReplicated(new Runnable()
- {
- public void run()
- {
- latch.countDown();
- storageManager.completeReplication();
- }
- });
- if (!latch.await(timeout, TimeUnit.MILLISECONDS))
- {
- throw new IllegalStateException("no response received from group handler for " + proposal.getGroupId());
- }
+ storageManager.waitOnReplication(timeout);
}
return new Response(groupBinding.getGroupId(), groupBinding.getClusterName());
}
Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusteredGroupingTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusteredGroupingTest.java 2009-10-28 23:49:56 UTC (rev 8161)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusteredGroupingTest.java 2009-10-29 00:35:30 UTC (rev 8162)
@@ -12,19 +12,18 @@
*/
package org.hornetq.tests.integration.cluster.distribution;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import org.hornetq.core.management.Notification;
import org.hornetq.core.message.impl.MessageImpl;
+import org.hornetq.core.server.group.GroupingHandler;
+import org.hornetq.core.server.group.impl.GroupBinding;
import org.hornetq.core.server.group.impl.GroupingHandlerConfiguration;
-import org.hornetq.core.server.group.impl.Response;
import org.hornetq.core.server.group.impl.Proposal;
-import org.hornetq.core.server.group.impl.GroupBinding;
-import org.hornetq.core.server.group.GroupingHandler;
-import org.hornetq.core.exception.HornetQException;
-import org.hornetq.core.management.Notification;
+import org.hornetq.core.server.group.impl.Response;
import org.hornetq.utils.SimpleString;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
/**
* @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
*/
Modified: trunk/tests/src/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java 2009-10-28 23:49:56 UTC (rev 8161)
+++ trunk/tests/src/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java 2009-10-29 00:35:30 UTC (rev 8162)
@@ -1189,6 +1189,13 @@
}
+ /* (non-Javadoc)
+ * @see org.hornetq.core.persistence.StorageManager#blockOnReplication(long)
+ */
+ public void waitOnReplication(long timeout) throws Exception
+ {
+ }
+
}
class FakeStoreFactory implements PagingStoreFactory
More information about the hornetq-commits
mailing list