JBoss hornetq SVN: r10134 - in branches/Branch_2_2_EAP: src/main/org/hornetq/jms/persistence/impl/journal and 1 other directories.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-01-22 20:07:57 -0500 (Sat, 22 Jan 2011)
New Revision: 10134
Added:
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/persistence/JMSDynamicConfigTest.java
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.java
branches/Branch_2_2_EAP/src/main/org/hornetq/jms/persistence/impl/journal/JMSJournalStorageManagerImpl.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/persistence/JMSConnectionFactoryConfigurationStorageTest.java
Log:
HORNETQ-625 / https://issues.jboss.org/browse/JBPAPP-5803 - deleteCF doesn't survive restarts
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.java 2011-01-22 09:41:30 UTC (rev 10133)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/jms/management/impl/JMSServerControlImpl.java 2011-01-23 01:07:57 UTC (rev 10134)
@@ -340,7 +340,7 @@
try
{
- boolean destroyed = server.destroyConnectionFactory(name);
+ boolean destroyed = server.removeConnectionFactoryFromJNDI(name);
if (destroyed)
{
sendNotification(NotificationType.CONNECTION_FACTORY_DESTROYED, name);
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/jms/persistence/impl/journal/JMSJournalStorageManagerImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/jms/persistence/impl/journal/JMSJournalStorageManagerImpl.java 2011-01-22 09:41:30 UTC (rev 10133)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/jms/persistence/impl/journal/JMSJournalStorageManagerImpl.java 2011-01-23 01:07:57 UTC (rev 10134)
@@ -152,6 +152,8 @@
{
jmsJournal.appendDeleteRecord(oldCF.getId(), false);
}
+
+ this.deleteJNDI(PersistedType.ConnectionFactory, cfName);
}
/* (non-Javadoc)
@@ -257,12 +259,8 @@
PersistedJNDI currentJNDI = mapJNDI.remove(key);
- if (currentJNDI == null)
+ if (currentJNDI != null)
{
- return;
- }
- else
- {
jmsJournal.appendDeleteRecord(currentJNDI.getId(), true);
}
}
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/persistence/JMSConnectionFactoryConfigurationStorageTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/persistence/JMSConnectionFactoryConfigurationStorageTest.java 2011-01-22 09:41:30 UTC (rev 10133)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/persistence/JMSConnectionFactoryConfigurationStorageTest.java 2011-01-23 01:07:57 UTC (rev 10134)
@@ -21,8 +21,6 @@
import org.hornetq.api.core.HornetQBuffer;
import org.hornetq.api.core.HornetQBuffers;
import org.hornetq.api.core.Pair;
-import org.hornetq.api.core.TransportConfiguration;
-import org.hornetq.core.remoting.impl.netty.NettyConnectorFactory;
import org.hornetq.core.remoting.impl.netty.TransportConstants;
import org.hornetq.jms.persistence.config.PersistedConnectionFactory;
import org.hornetq.jms.server.config.ConnectionFactoryConfiguration;
Added: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/persistence/JMSDynamicConfigTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/persistence/JMSDynamicConfigTest.java (rev 0)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/persistence/JMSDynamicConfigTest.java 2011-01-23 01:07:57 UTC (rev 10134)
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2010 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.hornetq.tests.integration.persistence;
+
+import java.util.ArrayList;
+
+import javax.naming.NamingException;
+
+import org.hornetq.core.persistence.impl.journal.OperationContextImpl;
+import org.hornetq.core.remoting.impl.netty.NettyConnectorFactory;
+import org.hornetq.jms.server.config.ConnectionFactoryConfiguration;
+import org.hornetq.jms.server.config.impl.ConnectionFactoryConfigurationImpl;
+import org.hornetq.tests.util.JMSTestBase;
+
+/**
+ * A JMSDynamicConfigTest
+ *
+ * @author clebertsuconic
+ *
+ *
+ */
+public class JMSDynamicConfigTest extends JMSTestBase
+{
+
+ protected boolean usePersistence()
+ {
+ return true;
+ }
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ public void testStart() throws Exception
+ {
+ ArrayList<String> connectors = new ArrayList<String>();
+
+ connectors.add("netty");
+
+ ConnectionFactoryConfiguration cfg = new ConnectionFactoryConfigurationImpl("tst", false, connectors, "tt");
+ jmsServer.createConnectionFactory(true, cfg, "tst");
+
+ assertNotNull(context.lookup("tst"));
+ jmsServer.removeConnectionFactoryFromJNDI("tst");
+
+ try
+ {
+ context.lookup("tst");
+ fail("failure expected");
+ }
+ catch (NamingException excepted)
+ {
+ }
+
+ jmsServer.stop();
+
+ OperationContextImpl.clearContext();
+ jmsServer.start();
+
+ try
+ {
+ context.lookup("tst");
+ fail("failure expected");
+ }
+ catch (NamingException excepted)
+ {
+ }
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
13 years, 11 months
JBoss hornetq SVN: r10133 - branches/Branch_2_2_EAP/src/main/org/hornetq/ra.
by do-not-reply@jboss.org
Author: ataylor
Date: 2011-01-22 04:41:30 -0500 (Sat, 22 Jan 2011)
New Revision: 10133
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/ra/HornetQResourceAdapter.java
Log:
https://issues.jboss.org/browse/JBPAPP-5793 - fixed
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/ra/HornetQResourceAdapter.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/ra/HornetQResourceAdapter.java 2011-01-22 08:47:07 UTC (rev 10132)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/ra/HornetQResourceAdapter.java 2011-01-22 09:41:30 UTC (rev 10133)
@@ -1388,7 +1388,7 @@
if (connectorClassName != null)
{
Map<String, Object> connectionParams =
- overrideConnectionParameters(overrideProperties.getParsedConnectionParameters(),raProperties.getParsedConnectionParameters());
+ overrideConnectionParameters(raProperties.getParsedConnectionParameters(),overrideProperties.getParsedConnectionParameters());
TransportConfiguration transportConf = new TransportConfiguration(connectorClassName, connectionParams);
13 years, 11 months
JBoss hornetq SVN: r10132 - branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl.
by do-not-reply@jboss.org
Author: ataylor
Date: 2011-01-22 03:47:07 -0500 (Sat, 22 Jan 2011)
New Revision: 10132
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/FileLockNodeManager.java
Log:
https://issues.jboss.org/browse/JBPAPP-5781 - added check for interrupt so we can leave backup thread
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/FileLockNodeManager.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/FileLockNodeManager.java 2011-01-21 22:44:33 UTC (rev 10131)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/FileLockNodeManager.java 2011-01-22 08:47:07 UTC (rev 10132)
@@ -332,6 +332,10 @@
//
}
}
+ if (Thread.currentThread().isInterrupted())
+ {
+ throw new IOException(new InterruptedException());
+ }
}
while(lock == null);
return lock;
13 years, 11 months
JBoss hornetq SVN: r10131 - in branches/Branch_2_2_EAP: src/main/org/hornetq/api/jms/management and 10 other directories.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-01-21 17:44:33 -0500 (Fri, 21 Jan 2011)
New Revision: 10131
Modified:
branches/Branch_2_2_EAP/src/main/org/hornetq/api/core/management/QueueControl.java
branches/Branch_2_2_EAP/src/main/org/hornetq/api/jms/management/JMSQueueControl.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/management/impl/QueueControlImpl.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/postoffice/PostOffice.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/Queue.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/QueueImpl.java
branches/Branch_2_2_EAP/src/main/org/hornetq/jms/management/impl/JMSQueueControlImpl.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlTest.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlUsingJMSTest.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/management/QueueControlTest.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/management/QueueControlUsingCoreTest.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/unit/core/postoffice/impl/FakeQueue.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/unit/core/server/impl/fakes/FakePostOffice.java
Log:
JBPAPP-5800 / HORNETQ-605 - moving messages while ignoring duplicateIDs
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/api/core/management/QueueControl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/api/core/management/QueueControl.java 2011-01-21 18:54:45 UTC (rev 10130)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/api/core/management/QueueControl.java 2011-01-21 22:44:33 UTC (rev 10131)
@@ -185,22 +185,46 @@
*
* @return {@code true} if the message was moved, {@code false} else
*/
- @Operation(desc = "Move the message corresponding to the given messageID to another queue", impact = MBeanOperationInfo.ACTION)
+ @Operation(desc = "Move the message corresponding to the given messageID to another queue. rejectDuplicate=false on this case", impact = MBeanOperationInfo.ACTION)
boolean moveMessage(@Parameter(name = "messageID", desc = "A message ID") long messageID,
@Parameter(name = "otherQueueName", desc = "The name of the queue to move the message to") String otherQueueName) throws Exception;
/**
+ * Moves the message corresponding to the specified message ID to the specified other queue.
+ *
+ * @return {@code true} if the message was moved, {@code false} else
+ */
+ @Operation(desc = "Move the message corresponding to the given messageID to another queue", impact = MBeanOperationInfo.ACTION)
+ boolean moveMessage(@Parameter(name = "messageID", desc = "A message ID") long messageID,
+ @Parameter(name = "otherQueueName", desc = "The name of the queue to move the message to") String otherQueueName,
+ @Parameter(name = "rejectDuplicates", desc = "Reject messages identified as duplicate by the duplicate message") boolean rejectDuplicates) throws Exception;
+
+ /**
* Moves all the message corresponding to the specified filter to the specified other queue.
+ * RejectDuplicates = false on this case
* <br>
* Using {@code null} or an empty filter will move <em>all</em> messages from this queue.
*
* @return the number of moved messages
*/
- @Operation(desc = "Move the messages corresponding to the given filter (and returns the number of moved messages)", impact = MBeanOperationInfo.ACTION)
+ @Operation(desc = "Move the messages corresponding to the given filter (and returns the number of moved messages). RejectDuplicates=false on this case.", impact = MBeanOperationInfo.ACTION)
int moveMessages(@Parameter(name = "filter", desc = "A message filter (can be empty)") String filter,
@Parameter(name = "otherQueueName", desc = "The name of the queue to move the messages to") String otherQueueName) throws Exception;
+
/**
+ * Moves all the message corresponding to the specified filter to the specified other queue.
+ * <br>
+ * Using {@code null} or an empty filter will move <em>all</em> messages from this queue.
+ *
+ * @return the number of moved messages
+ */
+ @Operation(desc = "Move the messages corresponding to the given filter (and returns the number of moved messages)", impact = MBeanOperationInfo.ACTION)
+ int moveMessages(@Parameter(name = "filter", desc = "A message filter (can be empty)") String filter,
+ @Parameter(name = "otherQueueName", desc = "The name of the queue to move the messages to") String otherQueueName,
+ @Parameter(name = "rejectDuplicates", desc = "Reject messages identified as duplicate by the duplicate message") boolean rejectDuplicates) throws Exception;
+
+ /**
* Sends the message corresponding to the specified message ID to this queue's dead letter address.
*
* @return {@code true} if the message was sent to the dead letter address, {@code false} else
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/api/jms/management/JMSQueueControl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/api/jms/management/JMSQueueControl.java 2011-01-21 18:54:45 UTC (rev 10130)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/api/jms/management/JMSQueueControl.java 2011-01-21 22:44:33 UTC (rev 10131)
@@ -179,7 +179,16 @@
@Operation(desc = "Change the priority of the messages corresponding to the given filter", impact = MBeanOperationInfo.ACTION)
int changeMessagesPriority(@Parameter(name = "filter", desc = "A message filter") String filter,
@Parameter(name = "newPriority", desc = "the new priority (between 0 and 9)") int newPriority) throws Exception;
+ /**
+ * Moves the message corresponding to the specified message ID to the specified other queue.
+ *
+ * @return {@code true} if the message was moved, {@code false} else
+ */
+ @Operation(desc = "Move the message corresponding to the given messageID to another queue, ignoring duplicates (rejectDuplicates=false on this case)", impact = MBeanOperationInfo.ACTION)
+ boolean moveMessage(@Parameter(name = "messageID", desc = "A message ID") String messageID,
+ @Parameter(name = "otherQueueName", desc = "The name of the queue to move the message to") String otherQueueName) throws Exception;
+
/**
* Moves the message corresponding to the specified message ID to the specified other queue.
*
@@ -187,20 +196,34 @@
*/
@Operation(desc = "Move the message corresponding to the given messageID to another queue", impact = MBeanOperationInfo.ACTION)
boolean moveMessage(@Parameter(name = "messageID", desc = "A message ID") String messageID,
- @Parameter(name = "otherQueueName", desc = "The name of the queue to move the message to") String otherQueueName) throws Exception;
+ @Parameter(name = "otherQueueName", desc = "The name of the queue to move the message to") String otherQueueName,
+ @Parameter(name = "rejectDuplicates", desc = "Reject messages identified as duplicate by the duplicate message") boolean rejectDuplicates) throws Exception;
/**
* Moves all the message corresponding to the specified filter to the specified other queue.
+ * RejectDuplicates=false on this case
* <br>
* Using {@code null} or an empty filter will move <em>all</em> messages from this queue.
*
* @return the number of moved messages
*/
- @Operation(desc = "Move the messages corresponding to the given filter (and returns the number of moved messages)", impact = MBeanOperationInfo.ACTION)
+ @Operation(desc = "Move the messages corresponding to the given filter (and returns the number of moved messages). rejectDuplicates=false on this case", impact = MBeanOperationInfo.ACTION)
int moveMessages(@Parameter(name = "filter", desc = "A message filter (can be empty)") String filter,
@Parameter(name = "otherQueueName", desc = "The name of the queue to move the messages to") String otherQueueName) throws Exception;
/**
+ * Moves all the message corresponding to the specified filter to the specified other queue.
+ * <br>
+ * Using {@code null} or an empty filter will move <em>all</em> messages from this queue.
+ *
+ * @return the number of moved messages
+ */
+ @Operation(desc = "Move the messages corresponding to the given filter (and returns the number of moved messages)", impact = MBeanOperationInfo.ACTION)
+ int moveMessages(@Parameter(name = "filter", desc = "A message filter (can be empty)") String filter,
+ @Parameter(name = "otherQueueName", desc = "The name of the queue to move the messages to") String otherQueueName,
+ @Parameter(name = "rejectDuplicates", desc = "Reject messages identified as duplicate by the duplicate message") boolean rejectDuplicates) throws Exception;
+
+ /**
* Lists the message counter for this queue.
*/
@Operation(desc = "List the message counters", impact = MBeanOperationInfo.INFO)
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/management/impl/QueueControlImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/management/impl/QueueControlImpl.java 2011-01-21 18:54:45 UTC (rev 10130)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/management/impl/QueueControlImpl.java 2011-01-21 22:44:33 UTC (rev 10131)
@@ -543,6 +543,11 @@
public boolean moveMessage(final long messageID, final String otherQueueName) throws Exception
{
+ return moveMessage(messageID, otherQueueName, false);
+ }
+
+ public boolean moveMessage(final long messageID, final String otherQueueName, final boolean rejectDuplicates) throws Exception
+ {
checkStarted();
clearIO();
@@ -566,6 +571,12 @@
public int moveMessages(final String filterStr, final String otherQueueName) throws Exception
{
+ return moveMessages(filterStr, otherQueueName, false);
+ }
+
+
+ public int moveMessages(final String filterStr, final String otherQueueName, final boolean rejectDuplicates) throws Exception
+ {
checkStarted();
clearIO();
@@ -580,7 +591,7 @@
throw new IllegalArgumentException("No queue found for " + otherQueueName);
}
- int retValue = queue.moveReferences(filter, binding.getAddress());
+ int retValue = queue.moveReferences(filter, binding.getAddress(), rejectDuplicates);
return retValue;
}
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/postoffice/PostOffice.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/postoffice/PostOffice.java 2011-01-21 18:54:45 UTC (rev 10130)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/postoffice/PostOffice.java 2011-01-21 22:44:33 UTC (rev 10131)
@@ -53,8 +53,12 @@
void route(ServerMessage message, Transaction tx, boolean direct) throws Exception;
+ void route(ServerMessage message, Transaction tx, boolean direct, boolean rejectDuplicates) throws Exception;
+
void route(ServerMessage message, RoutingContext context, boolean direct) throws Exception;
+ void route(ServerMessage message, RoutingContext context, boolean direct, boolean rejectDuplicates) throws Exception;
+
MessageReference reroute(ServerMessage message, Queue queue, Transaction tx) throws Exception;
boolean redistribute(ServerMessage message, final Queue originatingQueue, Transaction tx) throws Exception;
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java 2011-01-21 18:54:45 UTC (rev 10130)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java 2011-01-21 22:44:33 UTC (rev 10131)
@@ -541,8 +541,18 @@
route(message, new RoutingContextImpl(tx), direct);
}
+ public void route(final ServerMessage message, final Transaction tx, final boolean direct, final boolean rejectDuplicates) throws Exception
+ {
+ route(message, new RoutingContextImpl(tx), direct, rejectDuplicates);
+ }
+
public void route(final ServerMessage message, final RoutingContext context, final boolean direct) throws Exception
{
+ route(message, context, direct, true);
+ }
+
+ public void route(final ServerMessage message, final RoutingContext context, final boolean direct, final boolean rejectDuplicates) throws Exception
+ {
// Sanity check
if (message.getRefCount() > 0)
{
@@ -557,11 +567,15 @@
DuplicateIDCache cache = null;
+ boolean isDuplicate = false;
+
if (duplicateIDBytes != null)
{
cache = getDuplicateIDCache(message.getAddress());
+
+ isDuplicate = cache.contains(duplicateIDBytes);
- if (cache.contains(duplicateIDBytes))
+ if (rejectDuplicates && isDuplicate)
{
if (context.getTransaction() == null)
{
@@ -580,7 +594,7 @@
boolean startedTx = false;
- if (cache != null)
+ if (cache != null && !isDuplicate)
{
if (context.getTransaction() == null)
{
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/Queue.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/Queue.java 2011-01-21 18:54:45 UTC (rev 10130)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/Queue.java 2011-01-21 22:44:33 UTC (rev 10131)
@@ -115,8 +115,12 @@
boolean moveReference(long messageID, SimpleString toAddress) throws Exception;
+ boolean moveReference(long messageID, SimpleString toAddress, boolean rejectDuplicates) throws Exception;
+
int moveReferences(Filter filter, SimpleString toAddress) throws Exception;
+ int moveReferences(Filter filter, SimpleString toAddress, boolean rejectDuplicates) throws Exception;
+
void addRedistributor(long delay);
void cancelRedistributor() throws Exception;
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/QueueImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/QueueImpl.java 2011-01-21 18:54:45 UTC (rev 10130)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/QueueImpl.java 2011-01-21 22:44:33 UTC (rev 10131)
@@ -974,8 +974,13 @@
return count;
}
- public synchronized boolean moveReference(final long messageID, final SimpleString toAddress) throws Exception
+ public boolean moveReference(final long messageID, final SimpleString toAddress) throws Exception
{
+ return moveReference(messageID, toAddress, false);
+ }
+
+ public synchronized boolean moveReference(final long messageID, final SimpleString toAddress, final boolean rejectDuplicate) throws Exception
+ {
Iterator<MessageReference> iter = iterator();
while (iter.hasNext())
@@ -1000,8 +1005,13 @@
return false;
}
- public synchronized int moveReferences(final Filter filter, final SimpleString toAddress) throws Exception
+ public int moveReferences(final Filter filter, final SimpleString toAddress) throws Exception
{
+ return moveReferences(filter, toAddress, false);
+ }
+
+ public synchronized int moveReferences(final Filter filter, final SimpleString toAddress, final boolean rejectDuplicates) throws Exception
+ {
Transaction tx = new TransactionImpl(storageManager);
int count = 0;
@@ -1022,19 +1032,23 @@
deliveringCount.incrementAndGet();
count++;
- byte [] duplicateBytes = ref.getMessage().getDuplicateIDBytes();
- if (duplicateBytes != null)
+ if (rejectDuplicates)
{
- if (targetDuplicateCache.contains(duplicateBytes))
+ byte [] duplicateBytes = ref.getMessage().getDuplicateIDBytes();
+ if (duplicateBytes != null)
{
- log.info("Message with duplicate ID " + ref.getMessage().getDuplicateProperty() + " was already set at " + toAddress + ". Move from " + this.address + " being ignored and message removed from " + this.address);
- acknowledge(tx, ref);
- ignored = true;
+ if (targetDuplicateCache.contains(duplicateBytes))
+ {
+ log.info("Message with duplicate ID " + ref.getMessage().getDuplicateProperty() + " was already set at " + toAddress + ". Move from " + this.address + " being ignored and message removed from " + this.address);
+ acknowledge(tx, ref);
+ ignored = true;
+ }
}
}
+
if (!ignored)
{
- move(toAddress, tx, ref, false);
+ move(toAddress, tx, ref, false, rejectDuplicates);
}
iter.remove();
}
@@ -1055,7 +1069,7 @@
deliveringCount.incrementAndGet();
count++;
- move(toAddress, tx, ref, false);
+ move(toAddress, tx, ref, false, rejectDuplicates);
acknowledge(tx, ref);
}
@@ -1418,13 +1432,14 @@
private void move(final SimpleString toAddress,
final Transaction tx,
final MessageReference ref,
- final boolean expiry) throws Exception
+ final boolean expiry,
+ final boolean rejectDuplicate) throws Exception
{
ServerMessage copyMessage = makeCopy(ref, expiry);
copyMessage.setAddress(toAddress);
- postOffice.route(copyMessage, tx, false);
+ postOffice.route(copyMessage, tx, false, rejectDuplicate);
acknowledge(tx, ref);
}
@@ -1463,7 +1478,7 @@
}
else
{
- move(expiryAddress, tx, ref, true);
+ move(expiryAddress, tx, ref, true, true);
}
}
else
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/jms/management/impl/JMSQueueControlImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/jms/management/impl/JMSQueueControlImpl.java 2011-01-21 18:54:45 UTC (rev 10130)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/jms/management/impl/JMSQueueControlImpl.java 2011-01-21 22:44:33 UTC (rev 10131)
@@ -284,9 +284,14 @@
public boolean moveMessage(final String messageID, final String otherQueueName) throws Exception
{
+ return moveMessage(messageID, otherQueueName, false);
+ }
+
+ public boolean moveMessage(final String messageID, final String otherQueueName, final boolean rejectDuplicates) throws Exception
+ {
String filter = JMSQueueControlImpl.createFilterForJMSMessageID(messageID);
HornetQDestination otherQueue = HornetQDestination.createQueue(otherQueueName);
- int moved = coreQueueControl.moveMessages(filter, otherQueue.getAddress());
+ int moved = coreQueueControl.moveMessages(filter, otherQueue.getAddress(), rejectDuplicates);
if (moved != 1)
{
throw new IllegalArgumentException("No message found for JMSMessageID: " + messageID);
@@ -295,13 +300,19 @@
return true;
}
- public int moveMessages(final String filterStr, final String otherQueueName) throws Exception
+ public int moveMessages(final String filterStr, final String otherQueueName, final boolean rejectDuplicates) throws Exception
{
String filter = JMSQueueControlImpl.createFilterFromJMSSelector(filterStr);
HornetQDestination otherQueue = HornetQDestination.createQueue(otherQueueName);
- return coreQueueControl.moveMessages(filter, otherQueue.getAddress());
+ return coreQueueControl.moveMessages(filter, otherQueue.getAddress(), rejectDuplicates);
}
+
+ public int moveMessages(final String filterStr, final String otherQueueName) throws Exception
+ {
+ return moveMessages(filterStr, otherQueueName, false);
+ }
+
@Operation(desc = "List all the existent consumers on the Queue")
public String listConsumersAsJSON() throws Exception
{
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlTest.java 2011-01-21 18:54:45 UTC (rev 10130)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlTest.java 2011-01-21 22:44:33 UTC (rev 10131)
@@ -762,6 +762,7 @@
serverManager.destroyQueue(otherQueueName);
}
+
public void testMoveMessagesWithDuplicateIDSet() throws Exception
{
String otherQueueName = RandomUtil.randomString();
@@ -799,7 +800,7 @@
Assert.assertEquals(10, queueControl.getMessageCount());
- int moved = queueControl.moveMessages(null, otherQueueName);
+ int moved = queueControl.moveMessages(null, otherQueueName, true);
assertEquals(10, moved);
@@ -886,7 +887,7 @@
for (int i = 0 ; i < 10; i++)
{
- queueControl.moveMessage(ids[i], otherQueueName);
+ queueControl.moveMessage(ids[i], otherQueueName, true);
}
assertEquals(0, queueControl.getDeliveringCount());
@@ -955,7 +956,7 @@
Assert.assertEquals(1, queueControl.getMessageCount());
Assert.assertEquals(1, otherQueueControl.getMessageCount());
- int moved = queueControl.moveMessages(null, otherQueueName);
+ int moved = queueControl.moveMessages(null, otherQueueName, true);
assertEquals(1, moved);
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlUsingJMSTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlUsingJMSTest.java 2011-01-21 18:54:45 UTC (rev 10130)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/jms/server/management/JMSQueueControlUsingJMSTest.java 2011-01-21 22:44:33 UTC (rev 10131)
@@ -202,6 +202,16 @@
return (String)proxy.invokeOperation("listMessagesAsJSON", filter);
}
+ public boolean moveMessage(String messageID, String otherQueueName, boolean rejectDuplicates) throws Exception
+ {
+ return (Boolean)proxy.invokeOperation("moveMessage", messageID, otherQueueName, rejectDuplicates);
+ }
+
+ public int moveMessages(String filter, String otherQueueName, boolean rejectDuplicates) throws Exception
+ {
+ return (Integer)proxy.invokeOperation("moveMessages", filter, otherQueueName, rejectDuplicates);
+ }
+
public int moveMessages(final String filter, final String otherQueueName) throws Exception
{
return (Integer)proxy.invokeOperation("moveMessages", filter, otherQueueName);
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/management/QueueControlTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/management/QueueControlTest.java 2011-01-21 18:54:45 UTC (rev 10130)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/management/QueueControlTest.java 2011-01-21 22:44:33 UTC (rev 10131)
@@ -20,23 +20,26 @@
import org.hornetq.api.core.Message;
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.TransportConfiguration;
-import org.hornetq.api.core.client.*;
+import org.hornetq.api.core.client.ClientConsumer;
+import org.hornetq.api.core.client.ClientMessage;
+import org.hornetq.api.core.client.ClientProducer;
+import org.hornetq.api.core.client.ClientSession;
+import org.hornetq.api.core.client.ClientSessionFactory;
+import org.hornetq.api.core.client.HornetQClient;
+import org.hornetq.api.core.client.ServerLocator;
import org.hornetq.api.core.management.DayCounterInfo;
import org.hornetq.api.core.management.HornetQServerControl;
import org.hornetq.api.core.management.MessageCounterInfo;
import org.hornetq.api.core.management.QueueControl;
import org.hornetq.core.config.Configuration;
-import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.messagecounter.impl.MessageCounterManagerImpl;
import org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory;
-import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.HornetQServers;
import org.hornetq.core.settings.impl.AddressSettings;
import org.hornetq.tests.util.RandomUtil;
import org.hornetq.tests.util.UnitTestCase;
import org.hornetq.utils.json.JSONArray;
-import org.hornetq.utils.json.JSONObject;
/**
* A QueueControlTest
@@ -212,9 +215,8 @@
ClientConsumer consumer = session.createConsumer(queue);
Assert.assertEquals(1, queueControl.getConsumerCount());
-
System.out.println("Consumers: " + queueControl.listConsumersAsJSON());
-
+
JSONArray obj = new JSONArray(queueControl.listConsumersAsJSON());
assertEquals(1, obj.length());
@@ -1272,6 +1274,77 @@
}
+ public void testMoveMessagesBack() throws Exception
+ {
+ server.createQueue(new SimpleString("q1"), new SimpleString("q1"), null, true, false);
+ server.createQueue(new SimpleString("q2"), new SimpleString("q2"), null, true, false);
+
+ ServerLocator locator = createInVMNonHALocator();
+
+ ClientSessionFactory sf = locator.createSessionFactory();
+
+ ClientSession session = sf.createSession(true, true);
+
+ ClientProducer prod1 = session.createProducer("q1");
+
+ for (int i = 0; i < 10; i++)
+ {
+ ClientMessage msg = session.createMessage(true);
+
+ msg.putStringProperty(org.hornetq.api.core.Message.HDR_DUPLICATE_DETECTION_ID, new SimpleString("dupl-" + i));
+
+ prod1.send(msg);
+ }
+
+ session.commit();
+
+ ClientConsumer consumer = session.createConsumer("q1", true);
+ session.start();
+
+ assertNotNull(consumer.receive(5000));
+ consumer.close();
+
+ QueueControl q1Control = ManagementControlHelper.createQueueControl(new SimpleString("q1"),
+ new SimpleString("q1"),
+ mbeanServer);
+
+ QueueControl q2Control = ManagementControlHelper.createQueueControl(new SimpleString("q2"),
+ new SimpleString("q2"),
+ mbeanServer);
+
+ assertEquals(10, q1Control.moveMessages(null, "q2"));
+
+ consumer = session.createConsumer("q2", true);
+
+ assertNotNull(consumer.receive(500));
+
+ consumer.close();
+
+ q2Control.moveMessages(null, "q1", false);
+
+ session.start();
+ consumer = session.createConsumer("q1");
+
+ for (int i = 0; i < 10; i++)
+ {
+ ClientMessage msg = consumer.receive(5000);
+ System.out.println("msg = " + msg);
+ assertNotNull(msg);
+ msg.acknowledge();
+ }
+
+ consumer.close();
+
+ session.deleteQueue("q1");
+
+ session.deleteQueue("q2");
+
+ session.close();
+
+ locator.close();
+
+ }
+
public void testPauseAndResume()
{
long counterPeriod = 1000;
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/management/QueueControlUsingCoreTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/management/QueueControlUsingCoreTest.java 2011-01-21 18:54:45 UTC (rev 10130)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/management/QueueControlUsingCoreTest.java 2011-01-21 22:44:33 UTC (rev 10131)
@@ -206,11 +206,21 @@
return (Integer)proxy.invokeOperation("moveMessages", filter, otherQueueName);
}
+ public int moveMessages(final String filter, final String otherQueueName, final boolean rejectDuplicates) throws Exception
+ {
+ return (Integer)proxy.invokeOperation("moveMessages", filter, otherQueueName, rejectDuplicates);
+ }
+
public boolean moveMessage(final long messageID, final String otherQueueName) throws Exception
{
return (Boolean)proxy.invokeOperation("moveMessage", messageID, otherQueueName);
}
+ public boolean moveMessage(final long messageID, final String otherQueueName, final boolean rejectDuplicates) throws Exception
+ {
+ return (Boolean)proxy.invokeOperation("moveMessage", messageID, otherQueueName, rejectDuplicates);
+ }
+
public int removeMessages(final String filter) throws Exception
{
return (Integer)proxy.invokeOperation("removeMessages", filter);
@@ -265,7 +275,6 @@
{
return (String)proxy.invokeOperation("listConsumersAsJSON");
}
-
};
}
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/unit/core/postoffice/impl/FakeQueue.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/unit/core/postoffice/impl/FakeQueue.java 2011-01-21 18:54:45 UTC (rev 10130)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/unit/core/postoffice/impl/FakeQueue.java 2011-01-21 22:44:33 UTC (rev 10131)
@@ -621,4 +621,22 @@
this.subs = sub;
}
+ /* (non-Javadoc)
+ * @see org.hornetq.core.server.Queue#moveReference(long, org.hornetq.api.core.SimpleString, boolean)
+ */
+ public boolean moveReference(long messageID, SimpleString toAddress, boolean rejectDuplicates) throws Exception
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.server.Queue#moveReferences(org.hornetq.core.filter.Filter, org.hornetq.api.core.SimpleString, boolean)
+ */
+ public int moveReferences(Filter filter, SimpleString toAddress, boolean rejectDuplicates) throws Exception
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
}
\ No newline at end of file
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/unit/core/server/impl/fakes/FakePostOffice.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/unit/core/server/impl/fakes/FakePostOffice.java 2011-01-21 18:54:45 UTC (rev 10130)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/unit/core/server/impl/fakes/FakePostOffice.java 2011-01-21 22:44:33 UTC (rev 10131)
@@ -198,4 +198,22 @@
}
+ /* (non-Javadoc)
+ * @see org.hornetq.core.postoffice.PostOffice#route(org.hornetq.core.server.ServerMessage, org.hornetq.core.server.RoutingContext, boolean, boolean)
+ */
+ public void route(ServerMessage message, RoutingContext context, boolean direct, boolean rejectDuplicates) throws Exception
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.postoffice.PostOffice#route(org.hornetq.core.server.ServerMessage, org.hornetq.core.transaction.Transaction, boolean, boolean)
+ */
+ public void route(ServerMessage message, Transaction tx, boolean direct, boolean rejectDuplicates) throws Exception
+ {
+ // TODO Auto-generated method stub
+
+ }
+
}
\ No newline at end of file
13 years, 11 months
JBoss hornetq SVN: r10130 - in branches/Branch_2_2_EAP: docs/eap-manual/en and 4 other directories.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-01-21 13:54:45 -0500 (Fri, 21 Jan 2011)
New Revision: 10130
Added:
branches/Branch_2_2_EAP/merges.txt
Modified:
branches/Branch_2_2_EAP/docs/eap-manual/en/clusters.xml
branches/Branch_2_2_EAP/src/main/org/hornetq/api/core/management/HornetQServerControl.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java
branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/management/HornetQServerControlTest.java
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/management/HornetQServerControlUsingCoreTest.java
Log:
Merge from trunk 10125:10129
Modified: branches/Branch_2_2_EAP/docs/eap-manual/en/clusters.xml
===================================================================
--- branches/Branch_2_2_EAP/docs/eap-manual/en/clusters.xml 2011-01-21 18:37:12 UTC (rev 10129)
+++ branches/Branch_2_2_EAP/docs/eap-manual/en/clusters.xml 2011-01-21 18:54:45 UTC (rev 10130)
@@ -314,7 +314,7 @@
<connector name="netty-connector">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
<param key="host" value="${jboss.bind.address:localhost}"/>
- <param key="port" value="${hornetq.remoting.netty.port:5446}"/>
+ <param key="port" value="${hornetq.remoting.backup.netty.port:5446}"/>
</connector>
<connector name="in-vm">
@@ -328,7 +328,7 @@
<acceptor name="netty">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
<param key="host" value="${jboss.bind.address:localhost}"/>
- <param key="port" value="${hornetq.remoting.netty.port:5446}"/>
+ <param key="port" value="${hornetq.remoting.backup.netty.port:5446}"/>
</acceptor>
</acceptors>
@@ -382,7 +382,7 @@
</programlisting>
<para>
- The first thing you can see is we have added a
+ The second thing you can see is we have added a
<literal>jmx-domain</literal>
attribute, this is used when
adding objects, such as the HornetQ server and JMS server to jmx, we change this from the default
Added: branches/Branch_2_2_EAP/merges.txt
===================================================================
--- branches/Branch_2_2_EAP/merges.txt (rev 0)
+++ branches/Branch_2_2_EAP/merges.txt 2011-01-21 18:54:45 UTC (rev 10130)
@@ -0,0 +1,3 @@
+
+- branch source - branch target - revision interval - date - Author
+- trunk - Branch_2_2 - 10125:10129 - 20-jan-2011 - Clebert
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/api/core/management/HornetQServerControl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/api/core/management/HornetQServerControl.java 2011-01-21 18:37:12 UTC (rev 10129)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/api/core/management/HornetQServerControl.java 2011-01-21 18:54:45 UTC (rev 10130)
@@ -130,6 +130,17 @@
int getJournalBufferTimeout();
/**
+ * do any clients failover on a server shutdown
+ */
+ void setFailoverOnServerShutdown(boolean failoverOnServerShutdown) throws Exception;
+
+
+ /**
+ * returns if clients failover on a server shutdown
+ */
+ boolean isFailoverOnServerShutdown();
+
+ /**
* Returns the minimal number of journal files before compacting.
*/
int getJournalCompactMinFiles();
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java 2011-01-21 18:37:12 UTC (rev 10129)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java 2011-01-21 18:54:45 UTC (rev 10130)
@@ -268,6 +268,37 @@
}
}
+ public void setFailoverOnServerShutdown(boolean failoverOnServerShutdown)
+ {
+ checkStarted();
+
+ clearIO();
+ try
+ {
+ configuration.setFailoverOnServerShutdown(failoverOnServerShutdown);
+ }
+ finally
+ {
+ blockOnIO();
+ }
+ }
+
+
+ public boolean isFailoverOnServerShutdown()
+ {
+ checkStarted();
+
+ clearIO();
+ try
+ {
+ return configuration.isFailoverOnServerShutdown();
+ }
+ finally
+ {
+ blockOnIO();
+ }
+ }
+
public int getJournalMaxIO()
{
checkStarted();
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2011-01-21 18:37:12 UTC (rev 10129)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2011-01-21 18:54:45 UTC (rev 10130)
@@ -1344,10 +1344,8 @@
addressSettingsDeployer.start();
}
- else
- {
- deployAddressSettingsFromConfiguration();
- }
+
+ deployAddressSettingsFromConfiguration();
storageManager.start();
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/management/HornetQServerControlTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/management/HornetQServerControlTest.java 2011-01-21 18:37:12 UTC (rev 10129)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/management/HornetQServerControlTest.java 2011-01-21 18:54:45 UTC (rev 10130)
@@ -44,8 +44,10 @@
import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.HornetQServers;
+import org.hornetq.core.transaction.impl.XidImpl;
import org.hornetq.tests.util.RandomUtil;
import org.hornetq.tests.util.UnitTestCase;
+import org.hornetq.utils.UUIDGenerator;
import org.hornetq.utils.json.JSONArray;
import org.hornetq.utils.json.JSONObject;
@@ -141,6 +143,7 @@
Assert.assertEquals(conf.getJournalCompactMinFiles(), serverControl.getJournalCompactMinFiles());
Assert.assertEquals(conf.getJournalCompactPercentage(), serverControl.getJournalCompactPercentage());
Assert.assertEquals(conf.isPersistenceEnabled(), serverControl.isPersistenceEnabled());
+ Assert.assertEquals(conf.isFailoverOnServerShutdown(), serverControl.isFailoverOnServerShutdown());
}
public void testGetConnectors() throws Exception
@@ -765,7 +768,65 @@
Assert.assertTrue(html.matches(".*m3.*"));
Assert.assertTrue(html.matches(".*m4.*"));
}
-
+
+ public void testCommitPreparedTransactions() throws Exception
+ {
+ SimpleString recQueue = new SimpleString("BasicXaTestqRec");
+ SimpleString sendQueue = new SimpleString("BasicXaTestqSend");
+
+ byte[] globalTransactionId = UUIDGenerator.getInstance().generateStringUUID().getBytes();
+ Xid xid = new XidImpl("xa1".getBytes(), 1, globalTransactionId);
+ Xid xid2 = new XidImpl("xa2".getBytes(), 1, globalTransactionId);
+ ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
+ ClientSessionFactory csf = locator.createSessionFactory();
+ ClientSession clientSession = csf.createSession(true, false, false);
+ clientSession.createQueue(recQueue, recQueue, null, true);
+ clientSession.createQueue(sendQueue, sendQueue, null, true);
+ ClientMessage m1 = createTextMessage(clientSession, "");
+ m1.putStringProperty("m1", "m1");
+ ClientProducer clientProducer = clientSession.createProducer(recQueue);
+ clientProducer.send(m1);
+ locator.close();
+
+
+ ServerLocator receiveLocator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
+ ClientSessionFactory receiveCsf = receiveLocator.createSessionFactory();
+ ClientSession receiveClientSession = receiveCsf.createSession(true, false, false);
+ ClientConsumer consumer = receiveClientSession.createConsumer(recQueue);
+
+
+ ServerLocator sendLocator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
+ ClientSessionFactory sendCsf = sendLocator.createSessionFactory();
+ ClientSession sendClientSession = sendCsf.createSession(true, false, false);
+ ClientProducer producer = sendClientSession.createProducer(sendQueue);
+
+ receiveClientSession.start(xid, XAResource.TMNOFLAGS);
+ receiveClientSession.start();
+ sendClientSession.start(xid2, XAResource.TMNOFLAGS);
+
+ ClientMessage m = consumer.receive(5000);
+ assertNotNull(m);
+
+ producer.send(m);
+
+
+ receiveClientSession.end(xid, XAResource.TMSUCCESS);
+ sendClientSession.end(xid2, XAResource.TMSUCCESS);
+
+ receiveClientSession.prepare(xid);
+ sendClientSession.prepare(xid2);
+
+ HornetQServerControl serverControl = createManagementControl();
+
+ sendLocator.close();
+ receiveLocator.close();
+
+ boolean success = serverControl.commitPreparedTransaction(XidImpl.toBase64String(xid));
+
+ success = serverControl.commitPreparedTransaction(XidImpl.toBase64String(xid));
+
+ System.out.println("HornetQServerControlTest.testCommitPreparedTransactions");
+ }
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/management/HornetQServerControlUsingCoreTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/management/HornetQServerControlUsingCoreTest.java 2011-01-21 18:37:12 UTC (rev 10129)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/management/HornetQServerControlUsingCoreTest.java 2011-01-21 18:54:45 UTC (rev 10130)
@@ -325,6 +325,16 @@
return (Boolean)proxy.retrieveAttributeValue("journalSyncTransactional");
}
+ public void setFailoverOnServerShutdown(boolean failoverOnServerShutdown) throws Exception
+ {
+ proxy.invokeOperation("setFailoverOnServerShutdown", failoverOnServerShutdown);
+ }
+
+ public boolean isFailoverOnServerShutdown()
+ {
+ return (Boolean)proxy.retrieveAttributeValue("failoverOnServerShutdown");
+ }
+
public boolean isMessageCounterEnabled()
{
return (Boolean)proxy.retrieveAttributeValue("messageCounterEnabled");
13 years, 11 months
JBoss hornetq SVN: r10129 - trunk/docs/eap-manual/en.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-01-21 13:37:12 -0500 (Fri, 21 Jan 2011)
New Revision: 10129
Modified:
trunk/docs/eap-manual/en/clusters.xml
Log:
Change on doc
Modified: trunk/docs/eap-manual/en/clusters.xml
===================================================================
--- trunk/docs/eap-manual/en/clusters.xml 2011-01-21 04:57:36 UTC (rev 10128)
+++ trunk/docs/eap-manual/en/clusters.xml 2011-01-21 18:37:12 UTC (rev 10129)
@@ -290,8 +290,6 @@
<jmx-domain>org.hornetq.backup1</jmx-domain>
- <file-deployment-enabled>true</file-deployment-enabled>
-
<clustered>true</clustered>
<backup>true</backup>
@@ -316,7 +314,7 @@
<connector name="netty-connector">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
<param key="host" value="${jboss.bind.address:localhost}"/>
- <param key="port" value="${hornetq.remoting.netty.port:5446}"/>
+ <param key="port" value="${hornetq.remoting.backup.netty.port:5446}"/>
</connector>
<connector name="in-vm">
@@ -330,7 +328,7 @@
<acceptor name="netty">
<factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
<param key="host" value="${jboss.bind.address:localhost}"/>
- <param key="port" value="${hornetq.remoting.netty.port:5446}"/>
+ <param key="port" value="${hornetq.remoting.backup.netty.port:5446}"/>
</acceptor>
</acceptors>
@@ -384,11 +382,6 @@
</programlisting>
<para>
- The first thing you can see is we have added a
- <literal>file-deployment-enabled</literal> and set it to true. This is because we want to bypass the
- AS deployers and use the hornetq ones instead.
- </para>
- <para>
The second thing you can see is we have added a
<literal>jmx-domain</literal>
attribute, this is used when
13 years, 11 months
JBoss hornetq SVN: r10128 - trunk/src/main/org/hornetq/core/server/impl.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2011-01-20 23:57:36 -0500 (Thu, 20 Jan 2011)
New Revision: 10128
Modified:
trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
Log:
https://issues.jboss.org/browse/JBPAPP-5784 - Deploying addressSettings on the backup also
Modified: trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2011-01-20 10:44:06 UTC (rev 10127)
+++ trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2011-01-21 04:57:36 UTC (rev 10128)
@@ -1344,10 +1344,8 @@
addressSettingsDeployer.start();
}
- else
- {
- deployAddressSettingsFromConfiguration();
- }
+
+ deployAddressSettingsFromConfiguration();
storageManager.start();
13 years, 11 months
JBoss hornetq SVN: r10127 - trunk/docs/eap-manual/en.
by do-not-reply@jboss.org
Author: ataylor
Date: 2011-01-20 05:44:06 -0500 (Thu, 20 Jan 2011)
New Revision: 10127
Modified:
trunk/docs/eap-manual/en/clusters.xml
Log:
updated docs
Modified: trunk/docs/eap-manual/en/clusters.xml
===================================================================
--- trunk/docs/eap-manual/en/clusters.xml 2011-01-19 16:54:23 UTC (rev 10126)
+++ trunk/docs/eap-manual/en/clusters.xml 2011-01-20 10:44:06 UTC (rev 10127)
@@ -290,6 +290,8 @@
<jmx-domain>org.hornetq.backup1</jmx-domain>
+ <file-deployment-enabled>true</file-deployment-enabled>
+
<clustered>true</clustered>
<backup>true</backup>
@@ -383,6 +385,11 @@
</programlisting>
<para>
The first thing you can see is we have added a
+ <literal>file-deployment-enabled</literal> and set it to true. This is because we want to bypass the
+ AS deployers and use the hornetq ones instead.
+ </para>
+ <para>
+ The second thing you can see is we have added a
<literal>jmx-domain</literal>
attribute, this is used when
adding objects, such as the HornetQ server and JMS server to jmx, we change this from the default
13 years, 11 months
JBoss hornetq SVN: r10126 - in trunk: src/main/org/hornetq/core/management/impl and 1 other directories.
by do-not-reply@jboss.org
Author: ataylor
Date: 2011-01-19 11:54:23 -0500 (Wed, 19 Jan 2011)
New Revision: 10126
Modified:
trunk/src/main/org/hornetq/api/core/management/HornetQServerControl.java
trunk/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java
trunk/tests/src/org/hornetq/tests/integration/management/HornetQServerControlTest.java
trunk/tests/src/org/hornetq/tests/integration/management/HornetQServerControlUsingCoreTest.java
Log:
https://issues.jboss.org/browse/HORNETQ-615 - added failoverOnServerShutdown
Modified: trunk/src/main/org/hornetq/api/core/management/HornetQServerControl.java
===================================================================
--- trunk/src/main/org/hornetq/api/core/management/HornetQServerControl.java 2011-01-19 15:05:15 UTC (rev 10125)
+++ trunk/src/main/org/hornetq/api/core/management/HornetQServerControl.java 2011-01-19 16:54:23 UTC (rev 10126)
@@ -130,6 +130,17 @@
int getJournalBufferTimeout();
/**
+ * do any clients failover on a server shutdown
+ */
+ void setFailoverOnServerShutdown(boolean failoverOnServerShutdown) throws Exception;
+
+
+ /**
+ * returns if clients failover on a server shutdown
+ */
+ boolean isFailoverOnServerShutdown();
+
+ /**
* Returns the minimal number of journal files before compacting.
*/
int getJournalCompactMinFiles();
Modified: trunk/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java 2011-01-19 15:05:15 UTC (rev 10125)
+++ trunk/src/main/org/hornetq/core/management/impl/HornetQServerControlImpl.java 2011-01-19 16:54:23 UTC (rev 10126)
@@ -268,6 +268,37 @@
}
}
+ public void setFailoverOnServerShutdown(boolean failoverOnServerShutdown)
+ {
+ checkStarted();
+
+ clearIO();
+ try
+ {
+ configuration.setFailoverOnServerShutdown(failoverOnServerShutdown);
+ }
+ finally
+ {
+ blockOnIO();
+ }
+ }
+
+
+ public boolean isFailoverOnServerShutdown()
+ {
+ checkStarted();
+
+ clearIO();
+ try
+ {
+ return configuration.isFailoverOnServerShutdown();
+ }
+ finally
+ {
+ blockOnIO();
+ }
+ }
+
public int getJournalMaxIO()
{
checkStarted();
Modified: trunk/tests/src/org/hornetq/tests/integration/management/HornetQServerControlTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/management/HornetQServerControlTest.java 2011-01-19 15:05:15 UTC (rev 10125)
+++ trunk/tests/src/org/hornetq/tests/integration/management/HornetQServerControlTest.java 2011-01-19 16:54:23 UTC (rev 10126)
@@ -44,8 +44,10 @@
import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.HornetQServers;
+import org.hornetq.core.transaction.impl.XidImpl;
import org.hornetq.tests.util.RandomUtil;
import org.hornetq.tests.util.UnitTestCase;
+import org.hornetq.utils.UUIDGenerator;
import org.hornetq.utils.json.JSONArray;
import org.hornetq.utils.json.JSONObject;
@@ -141,6 +143,7 @@
Assert.assertEquals(conf.getJournalCompactMinFiles(), serverControl.getJournalCompactMinFiles());
Assert.assertEquals(conf.getJournalCompactPercentage(), serverControl.getJournalCompactPercentage());
Assert.assertEquals(conf.isPersistenceEnabled(), serverControl.isPersistenceEnabled());
+ Assert.assertEquals(conf.isFailoverOnServerShutdown(), serverControl.isFailoverOnServerShutdown());
}
public void testGetConnectors() throws Exception
@@ -765,7 +768,65 @@
Assert.assertTrue(html.matches(".*m3.*"));
Assert.assertTrue(html.matches(".*m4.*"));
}
-
+
+ public void testCommitPreparedTransactions() throws Exception
+ {
+ SimpleString recQueue = new SimpleString("BasicXaTestqRec");
+ SimpleString sendQueue = new SimpleString("BasicXaTestqSend");
+
+ byte[] globalTransactionId = UUIDGenerator.getInstance().generateStringUUID().getBytes();
+ Xid xid = new XidImpl("xa1".getBytes(), 1, globalTransactionId);
+ Xid xid2 = new XidImpl("xa2".getBytes(), 1, globalTransactionId);
+ ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
+ ClientSessionFactory csf = locator.createSessionFactory();
+ ClientSession clientSession = csf.createSession(true, false, false);
+ clientSession.createQueue(recQueue, recQueue, null, true);
+ clientSession.createQueue(sendQueue, sendQueue, null, true);
+ ClientMessage m1 = createTextMessage(clientSession, "");
+ m1.putStringProperty("m1", "m1");
+ ClientProducer clientProducer = clientSession.createProducer(recQueue);
+ clientProducer.send(m1);
+ locator.close();
+
+
+ ServerLocator receiveLocator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
+ ClientSessionFactory receiveCsf = receiveLocator.createSessionFactory();
+ ClientSession receiveClientSession = receiveCsf.createSession(true, false, false);
+ ClientConsumer consumer = receiveClientSession.createConsumer(recQueue);
+
+
+ ServerLocator sendLocator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(UnitTestCase.INVM_CONNECTOR_FACTORY));
+ ClientSessionFactory sendCsf = sendLocator.createSessionFactory();
+ ClientSession sendClientSession = sendCsf.createSession(true, false, false);
+ ClientProducer producer = sendClientSession.createProducer(sendQueue);
+
+ receiveClientSession.start(xid, XAResource.TMNOFLAGS);
+ receiveClientSession.start();
+ sendClientSession.start(xid2, XAResource.TMNOFLAGS);
+
+ ClientMessage m = consumer.receive(5000);
+ assertNotNull(m);
+
+ producer.send(m);
+
+
+ receiveClientSession.end(xid, XAResource.TMSUCCESS);
+ sendClientSession.end(xid2, XAResource.TMSUCCESS);
+
+ receiveClientSession.prepare(xid);
+ sendClientSession.prepare(xid2);
+
+ HornetQServerControl serverControl = createManagementControl();
+
+ sendLocator.close();
+ receiveLocator.close();
+
+ boolean success = serverControl.commitPreparedTransaction(XidImpl.toBase64String(xid));
+
+ success = serverControl.commitPreparedTransaction(XidImpl.toBase64String(xid));
+
+ System.out.println("HornetQServerControlTest.testCommitPreparedTransactions");
+ }
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
Modified: trunk/tests/src/org/hornetq/tests/integration/management/HornetQServerControlUsingCoreTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/management/HornetQServerControlUsingCoreTest.java 2011-01-19 15:05:15 UTC (rev 10125)
+++ trunk/tests/src/org/hornetq/tests/integration/management/HornetQServerControlUsingCoreTest.java 2011-01-19 16:54:23 UTC (rev 10126)
@@ -325,6 +325,16 @@
return (Boolean)proxy.retrieveAttributeValue("journalSyncTransactional");
}
+ public void setFailoverOnServerShutdown(boolean failoverOnServerShutdown) throws Exception
+ {
+ proxy.invokeOperation("setFailoverOnServerShutdown", failoverOnServerShutdown);
+ }
+
+ public boolean isFailoverOnServerShutdown()
+ {
+ return (Boolean)proxy.retrieveAttributeValue("failoverOnServerShutdown");
+ }
+
public boolean isMessageCounterEnabled()
{
return (Boolean)proxy.retrieveAttributeValue("messageCounterEnabled");
13 years, 11 months
JBoss hornetq SVN: r10125 - trunk.
by do-not-reply@jboss.org
Author: ataylor
Date: 2011-01-19 10:05:15 -0500 (Wed, 19 Jan 2011)
New Revision: 10125
Modified:
trunk/build-maven.xml
Log:
https://issues.jboss.org/browse/HORNETQ-611 - upload rar as well as jar
Modified: trunk/build-maven.xml
===================================================================
--- trunk/build-maven.xml 2011-01-19 06:45:14 UTC (rev 10124)
+++ trunk/build-maven.xml 2011-01-19 15:05:15 UTC (rev 10125)
@@ -69,6 +69,10 @@
<target name="uploadHornetQRa">
<antcall target="upload">
<param name="artifact.id" value="hornetq-ra"/>
+ <param name="artifact.type" value="rar"/>
+ </antcall>
+ <antcall target="upload">
+ <param name="artifact.id" value="hornetq-ra"/>
<param name="artifact.type" value="jar"/>
</antcall>
</target>
@@ -264,9 +268,15 @@
<antcall target="deploy-jar">
<param name="artifact.id" value="hornetq-ra"/>
<param name="file-name" value="hornetq-ra"/>
+ <param name="artifact.type" value="rar"/>
</antcall>
<antcall target="deploy-jar">
+ <param name="artifact.id" value="hornetq-ra"/>
+ <param name="file-name" value="hornetq-ra"/>
+ </antcall>
+
+ <antcall target="deploy-jar">
<param name="artifact.id" value="hornetq-spring-integration"/>
<param name="file-name" value="hornetq-spring-integration"/>
</antcall>
@@ -274,6 +284,7 @@
</target>
<target name="deploy-jar">
+ <property name="artifact.type" value="jar"/>
<tempfile property="temporary.pom" prefix="pom" suffix=".xml"/>
<echo file="${temporary.pom}"
message="<?xml version="1.0" encoding="UTF-8"?><project>${line.separator}
@@ -290,8 +301,8 @@
<arg value="-DgroupId=org.hornetq"/>
<arg value="-DartifactId=${artifact.id}"/>
<arg value="-Dversion=${hornetq.version}"/>
- <arg value="-Dpackaging=jar"/>
- <arg value="-Dfile=./build/jars/${file-name}.jar"/>
+ <arg value="-Dpackaging=${artifact.type}"/>
+ <arg value="-Dfile=./build/jars/${file-name}.${artifact.type}"/>
<arg value="-DrepositoryId=jboss-releases-repository"/>
<arg value="-Durl=https://repository.jboss.org/nexus/service/local/staging/deploy/maven2/"/>
</exec>
13 years, 11 months