From 753b21047a234f69ca56f2706b62a5c537d4138c Mon Sep 17 00:00:00 2001 From: Gary Tully Date: Mon, 29 Jun 2009 11:32:06 +0000 Subject: [PATCH] apply patch for: https://issues.apache.org/activemq/browse/AMQ-2308 with thanks; apply fix for https://issues.apache.org/activemq/browse/AMQ-1993 to the client side git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@789291 13f79535-47bb-0310-9956-ffa450edef68 --- .../activemq/transport/TransportFactory.java | 12 +++++++----- .../transport/tcp/TcpTransportFactory.java | 2 +- .../ft/TransactedTopicMasterSlaveTest.java | 2 +- .../broker/store/TransactionStoreTest.java | 19 ++++--------------- 4 files changed, 13 insertions(+), 22 deletions(-) diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/TransportFactory.java b/activemq-core/src/main/java/org/apache/activemq/transport/TransportFactory.java index 15e32349eb..5fac1fc7a7 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/TransportFactory.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/TransportFactory.java @@ -264,11 +264,6 @@ public abstract class TransportFactory { * @throws Exception */ public Transport serverConfigure(Transport transport, WireFormat format, HashMap options) throws Exception { - if (options.containsKey(WRITE_TIMEOUT_FILTER)) { - transport = new WriteTimeoutFilter(transport); - String soWriteTimeout = (String)options.get(WRITE_TIMEOUT_FILTER); - if (soWriteTimeout!=null) ((WriteTimeoutFilter)transport).setWriteTimeout(Long.parseLong(soWriteTimeout)); - } if (options.containsKey(THREAD_NAME_FILTER)) { transport = new ThreadNameFilter(transport); } @@ -288,6 +283,13 @@ public abstract class TransportFactory { * @return */ public Transport compositeConfigure(Transport transport, WireFormat format, Map options) { + if (options.containsKey(WRITE_TIMEOUT_FILTER)) { + transport = new WriteTimeoutFilter(transport); + String soWriteTimeout = (String)options.remove(WRITE_TIMEOUT_FILTER); + if (soWriteTimeout!=null) { + ((WriteTimeoutFilter)transport).setWriteTimeout(Long.parseLong(soWriteTimeout)); + } + } IntrospectionSupport.setProperties(transport, options); return transport; } diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java b/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java index 6d64487bfd..7d2ebbe2ea 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java @@ -106,7 +106,7 @@ public class TcpTransportFactory extends TransportFactory { transport = new WireFormatNegotiator(transport, (OpenWireFormat)format, tcpTransport.getMinmumWireFormatVersion()); } - return transport; + return super.compositeConfigure(transport, format, options); } private String getOption(Map options, String key, String def) { diff --git a/activemq-core/src/test/java/org/apache/activemq/broker/ft/TransactedTopicMasterSlaveTest.java b/activemq-core/src/test/java/org/apache/activemq/broker/ft/TransactedTopicMasterSlaveTest.java index da4fee6c5b..802cfbded1 100644 --- a/activemq-core/src/test/java/org/apache/activemq/broker/ft/TransactedTopicMasterSlaveTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/broker/ft/TransactedTopicMasterSlaveTest.java @@ -29,7 +29,7 @@ public class TransactedTopicMasterSlaveTest extends JmsTopicTransactionTest { protected BrokerService slave; protected int inflightMessageCount; protected int failureCount = 50; - protected String uriString = "failover://(tcp://localhost:62001,tcp://localhost:62002)?randomize=false"; + protected String uriString = "failover://(tcp://localhost:62001?soWriteTimeout=15000,tcp://localhost:62002?soWriteTimeout=15000)?randomize=false"; private boolean stopMaster = false; protected void setUp() throws Exception { diff --git a/activemq-core/src/test/java/org/apache/activemq/broker/store/TransactionStoreTest.java b/activemq-core/src/test/java/org/apache/activemq/broker/store/TransactionStoreTest.java index 1d7fe56d35..4ef3e7b343 100755 --- a/activemq-core/src/test/java/org/apache/activemq/broker/store/TransactionStoreTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/broker/store/TransactionStoreTest.java @@ -16,45 +16,34 @@ */ package org.apache.activemq.broker.store; -import java.net.URI; import java.util.Map; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; -import junit.framework.Test; import junit.framework.TestCase; -import org.apache.activemq.broker.BrokerFactory; -import org.apache.activemq.broker.BrokerService; -import org.apache.activemq.broker.BrokerTest; import org.apache.activemq.command.ConnectionId; import org.apache.activemq.command.LocalTransactionId; import org.apache.activemq.command.TransactionId; -import org.apache.activemq.store.amq.AMQPersistenceAdapter; import org.apache.activemq.store.amq.AMQTransactionStore; import org.apache.activemq.store.amq.AMQTx; -/** - * Once the wire format is completed we can test against real persistence storage. - * - * @version $Revision$ - */ public class TransactionStoreTest extends TestCase { protected static final int MAX_TX = 2500; protected static final int MAX_THREADS = 200; - class UnderTest extends AMQTransactionStore { - public UnderTest() { + class BeingTested extends AMQTransactionStore { + public BeingTested() { super(null); } public Map getInFlight() { - return inflightTransactions; + return inflightTransactions; } }; - UnderTest underTest = new UnderTest(); + BeingTested underTest = new BeingTested(); public void testConcurrentGetTx() throws Exception { final ConnectionId connectionId = new ConnectionId("1:1");