This commit is contained in:
Clebert Suconic 2019-10-21 09:02:57 -04:00
commit c3eacfd4d1
19 changed files with 81 additions and 87 deletions

View File

@ -113,6 +113,7 @@ public final class ActiveMQClient {
public static final int INITIAL_CONNECT_ATTEMPTS = 1; public static final int INITIAL_CONNECT_ATTEMPTS = 1;
@Deprecated
public static final boolean DEFAULT_FAILOVER_ON_INITIAL_CONNECTION = false; public static final boolean DEFAULT_FAILOVER_ON_INITIAL_CONNECTION = false;
public static final boolean DEFAULT_IS_HA = false; public static final boolean DEFAULT_IS_HA = false;

View File

@ -96,11 +96,29 @@ public interface ServerLocator extends AutoCloseable {
* *
* @param transportConfiguration * @param transportConfiguration
* @param reconnectAttempts number of attempts of reconnection to perform * @param reconnectAttempts number of attempts of reconnection to perform
* @return a {@link ClientSessionFactory} instance
* @throws Exception if a failure happened in creating the ClientSessionFactory or the
* ServerLocator does not know about the passed in transportConfiguration
*/
ClientSessionFactory createSessionFactory(TransportConfiguration transportConfiguration,
int reconnectAttempts) throws Exception;
/**
* Creates a {@link ClientSessionFactory} to a specific server. The server must already be known
* about by this ServerLocator. This method allows the user to make a connection to a specific
* server bypassing any load balancing policy in force
*
* @deprecated This method is no longer acceptable to create a client session factory.
* Replaced by {@link ServerLocator#createSessionFactory(TransportConfiguration, int)}.
*
* @param transportConfiguration
* @param reconnectAttempts number of attempts of reconnection to perform
* @param failoverOnInitialConnection * @param failoverOnInitialConnection
* @return a {@link ClientSessionFactory} instance * @return a {@link ClientSessionFactory} instance
* @throws Exception if a failure happened in creating the ClientSessionFactory or the * @throws Exception if a failure happened in creating the ClientSessionFactory or the
* ServerLocator does not know about the passed in transportConfiguration * ServerLocator does not know about the passed in transportConfiguration
*/ */
@Deprecated
ClientSessionFactory createSessionFactory(TransportConfiguration transportConfiguration, ClientSessionFactory createSessionFactory(TransportConfiguration transportConfiguration,
int reconnectAttempts, int reconnectAttempts,
boolean failoverOnInitialConnection) throws Exception; boolean failoverOnInitialConnection) throws Exception;
@ -643,6 +661,7 @@ public interface ServerLocator extends AutoCloseable {
* <p> * <p>
* Default value is {@link ActiveMQClient#DEFAULT_FAILOVER_ON_INITIAL_CONNECTION}. * Default value is {@link ActiveMQClient#DEFAULT_FAILOVER_ON_INITIAL_CONNECTION}.
*/ */
@Deprecated
boolean isFailoverOnInitialConnection(); boolean isFailoverOnInitialConnection();
/** /**
@ -651,6 +670,7 @@ public interface ServerLocator extends AutoCloseable {
* @param failover * @param failover
* @return this ServerLocator * @return this ServerLocator
*/ */
@Deprecated
ServerLocator setFailoverOnInitialConnection(boolean failover); ServerLocator setFailoverOnInitialConnection(boolean failover);
/** /**

View File

@ -235,8 +235,7 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C
} }
@Override @Override
public void connect(final int initialConnectAttempts, public void connect(final int initialConnectAttempts) throws ActiveMQException {
final boolean failoverOnInitialConnection) throws ActiveMQException {
// Get the connection // Get the connection
getConnectionWithRetry(initialConnectAttempts, null); getConnectionWithRetry(initialConnectAttempts, null);
@ -250,6 +249,13 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C
} }
@Deprecated
@Override
public void connect(final int initialConnectAttempts,
final boolean failoverOnInitialConnection) throws ActiveMQException {
connect(initialConnectAttempts);
}
@Override @Override
public TransportConfiguration getConnectorConfiguration() { public TransportConfiguration getConnectorConfiguration() {
return currentConnectorConfig; return currentConnectorConfig;

View File

@ -47,6 +47,13 @@ public interface ClientSessionFactoryInternal extends ClientSessionFactory {
void removeSession(ClientSessionInternal session, boolean failingOver); void removeSession(ClientSessionInternal session, boolean failingOver);
void connect(int reconnectAttempts) throws ActiveMQException;
/**
* @deprecated This method is no longer acceptable to connect.
* Replaced by {@link ClientSessionFactoryInternal#connect(int)}.
*/
@Deprecated
void connect(int reconnectAttempts, boolean failoverOnInitialConnection) throws ActiveMQException; void connect(int reconnectAttempts, boolean failoverOnInitialConnection) throws ActiveMQException;
void setBackupConnector(TransportConfiguration live, TransportConfiguration backUp); void setBackupConnector(TransportConfiguration live, TransportConfiguration backUp);

View File

@ -187,8 +187,6 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
private int initialConnectAttempts; private int initialConnectAttempts;
private boolean failoverOnInitialConnection;
private int initialMessagePacketSize; private int initialMessagePacketSize;
private final Object stateGuard = new Object(); private final Object stateGuard = new Object();
@ -386,8 +384,6 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
initialConnectAttempts = ActiveMQClient.INITIAL_CONNECT_ATTEMPTS; initialConnectAttempts = ActiveMQClient.INITIAL_CONNECT_ATTEMPTS;
failoverOnInitialConnection = ActiveMQClient.DEFAULT_FAILOVER_ON_INITIAL_CONNECTION;
cacheLargeMessagesClient = ActiveMQClient.DEFAULT_CACHE_LARGE_MESSAGE_CLIENT; cacheLargeMessagesClient = ActiveMQClient.DEFAULT_CACHE_LARGE_MESSAGE_CLIENT;
initialMessagePacketSize = ActiveMQClient.DEFAULT_INITIAL_MESSAGE_PACKET_SIZE; initialMessagePacketSize = ActiveMQClient.DEFAULT_INITIAL_MESSAGE_PACKET_SIZE;
@ -523,7 +519,6 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
maxRetryInterval = locator.maxRetryInterval; maxRetryInterval = locator.maxRetryInterval;
reconnectAttempts = locator.reconnectAttempts; reconnectAttempts = locator.reconnectAttempts;
initialConnectAttempts = locator.initialConnectAttempts; initialConnectAttempts = locator.initialConnectAttempts;
failoverOnInitialConnection = locator.failoverOnInitialConnection;
initialMessagePacketSize = locator.initialMessagePacketSize; initialMessagePacketSize = locator.initialMessagePacketSize;
startExecutor = locator.startExecutor; startExecutor = locator.startExecutor;
afterConnectListener = locator.afterConnectListener; afterConnectListener = locator.afterConnectListener;
@ -700,32 +695,12 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
@Override @Override
public ClientSessionFactory createSessionFactory(final TransportConfiguration transportConfiguration) throws Exception { public ClientSessionFactory createSessionFactory(final TransportConfiguration transportConfiguration) throws Exception {
assertOpen(); return createSessionFactory(transportConfiguration, reconnectAttempts);
initialize();
ClientSessionFactoryInternal factory = new ClientSessionFactoryImpl(this, transportConfiguration, callTimeout, callFailoverTimeout, clientFailureCheckPeriod, connectionTTL, retryInterval, retryIntervalMultiplier, maxRetryInterval, reconnectAttempts, threadPool, scheduledThreadPool, incomingInterceptors, outgoingInterceptors);
addToConnecting(factory);
try {
try {
factory.connect(reconnectAttempts, failoverOnInitialConnection);
} catch (ActiveMQException e1) {
//we need to make sure is closed just for garbage collection
factory.close();
throw e1;
}
addFactory(factory);
return factory;
} finally {
removeFromConnecting(factory);
}
} }
@Override @Override
public ClientSessionFactory createSessionFactory(final TransportConfiguration transportConfiguration, public ClientSessionFactory createSessionFactory(final TransportConfiguration transportConfiguration,
int reconnectAttempts, int reconnectAttempts) throws Exception {
boolean failoverOnInitialConnection) throws Exception {
assertOpen(); assertOpen();
initialize(); initialize();
@ -735,7 +710,7 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
addToConnecting(factory); addToConnecting(factory);
try { try {
try { try {
factory.connect(reconnectAttempts, failoverOnInitialConnection); factory.connect(reconnectAttempts);
} catch (ActiveMQException e1) { } catch (ActiveMQException e1) {
//we need to make sure is closed just for garbage collection //we need to make sure is closed just for garbage collection
factory.close(); factory.close();
@ -748,6 +723,14 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
} }
} }
@Deprecated
@Override
public ClientSessionFactory createSessionFactory(final TransportConfiguration transportConfiguration,
int reconnectAttempts,
boolean failoverOnInitialConnection) throws Exception {
return createSessionFactory(transportConfiguration, reconnectAttempts);
}
private void removeFromConnecting(ClientSessionFactoryInternal factory) { private void removeFromConnecting(ClientSessionFactoryInternal factory) {
synchronized (connectingFactories) { synchronized (connectingFactories) {
connectingFactories.remove(factory); connectingFactories.remove(factory);
@ -1183,15 +1166,15 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
return initialConnectAttempts; return initialConnectAttempts;
} }
@Deprecated
@Override @Override
public boolean isFailoverOnInitialConnection() { public boolean isFailoverOnInitialConnection() {
return this.failoverOnInitialConnection; return false;
} }
@Deprecated
@Override @Override
public ServerLocatorImpl setFailoverOnInitialConnection(final boolean failover) { public ServerLocatorImpl setFailoverOnInitialConnection(final boolean failover) {
checkWrite();
this.failoverOnInitialConnection = failover;
return this; return this;
} }

View File

@ -740,13 +740,13 @@ public class ActiveMQConnectionFactory extends JNDIStorable implements Connectio
return serverLocator.getInitialConnectAttempts(); return serverLocator.getInitialConnectAttempts();
} }
@Deprecated
public synchronized boolean isFailoverOnInitialConnection() { public synchronized boolean isFailoverOnInitialConnection() {
return serverLocator.isFailoverOnInitialConnection(); return false;
} }
@Deprecated
public synchronized void setFailoverOnInitialConnection(final boolean failover) { public synchronized void setFailoverOnInitialConnection(final boolean failover) {
checkWrite();
serverLocator.setFailoverOnInitialConnection(failover);
} }
public synchronized boolean isUseGlobalPools() { public synchronized boolean isUseGlobalPools() {

View File

@ -162,8 +162,10 @@ public interface ConnectionFactoryConfiguration extends EncodingSupport {
ConnectionFactoryConfiguration setReconnectAttempts(int reconnectAttempts); ConnectionFactoryConfiguration setReconnectAttempts(int reconnectAttempts);
@Deprecated
boolean isFailoverOnInitialConnection(); boolean isFailoverOnInitialConnection();
@Deprecated
ConnectionFactoryConfiguration setFailoverOnInitialConnection(boolean failover); ConnectionFactoryConfiguration setFailoverOnInitialConnection(boolean failover);
String getGroupID(); String getGroupID();

View File

@ -111,8 +111,6 @@ public class ConnectionFactoryConfigurationImpl implements ConnectionFactoryConf
private int reconnectAttempts = ActiveMQClient.DEFAULT_RECONNECT_ATTEMPTS; private int reconnectAttempts = ActiveMQClient.DEFAULT_RECONNECT_ATTEMPTS;
private boolean failoverOnInitialConnection = ActiveMQClient.DEFAULT_FAILOVER_ON_INITIAL_CONNECTION;
private String groupID = null; private String groupID = null;
private String protocolManagerFactoryStr; private String protocolManagerFactoryStr;
@ -518,14 +516,15 @@ public class ConnectionFactoryConfigurationImpl implements ConnectionFactoryConf
return this; return this;
} }
@Deprecated
@Override @Override
public boolean isFailoverOnInitialConnection() { public boolean isFailoverOnInitialConnection() {
return failoverOnInitialConnection; return false;
} }
@Deprecated
@Override @Override
public ConnectionFactoryConfiguration setFailoverOnInitialConnection(final boolean failover) { public ConnectionFactoryConfiguration setFailoverOnInitialConnection(final boolean failover) {
failoverOnInitialConnection = failover;
return this; return this;
} }
@ -629,7 +628,8 @@ public class ConnectionFactoryConfigurationImpl implements ConnectionFactoryConf
reconnectAttempts = buffer.readInt(); reconnectAttempts = buffer.readInt();
failoverOnInitialConnection = buffer.readBoolean(); buffer.readBoolean();
// failoverOnInitialConnection
compressLargeMessage = buffer.readBoolean(); compressLargeMessage = buffer.readBoolean();
@ -724,7 +724,8 @@ public class ConnectionFactoryConfigurationImpl implements ConnectionFactoryConf
buffer.writeInt(reconnectAttempts); buffer.writeInt(reconnectAttempts);
buffer.writeBoolean(failoverOnInitialConnection); buffer.writeBoolean(false);
// failoverOnInitialConnection
buffer.writeBoolean(compressLargeMessage); buffer.writeBoolean(compressLargeMessage);

View File

@ -614,12 +614,8 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable {
* *
* @param failoverOnInitialConnection The value * @param failoverOnInitialConnection The value
*/ */
@Deprecated
public void setFailoverOnInitialConnection(final Boolean failoverOnInitialConnection) { public void setFailoverOnInitialConnection(final Boolean failoverOnInitialConnection) {
if (logger.isTraceEnabled()) {
logger.trace("setFailoverOnInitialConnection(" + failoverOnInitialConnection + ")");
}
raProperties.setFailoverOnInitialConnection(failoverOnInitialConnection);
} }
/** /**
@ -627,12 +623,9 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable {
* *
* @return The value * @return The value
*/ */
@Deprecated
public Boolean isFailoverOnInitialConnection() { public Boolean isFailoverOnInitialConnection() {
if (logger.isTraceEnabled()) { return false;
logger.trace("isFailoverOnInitialConnection()");
}
return raProperties.isFailoverOnInitialConnection();
} }
/** /**
@ -1955,11 +1948,6 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable {
cf.setCompressLargeMessage(val); cf.setCompressLargeMessage(val);
} }
val = overrideProperties.isFailoverOnInitialConnection() != null ? overrideProperties.isFailoverOnInitialConnection() : raProperties.isFailoverOnInitialConnection();
if (val != null) {
cf.setFailoverOnInitialConnection(val);
}
val = overrideProperties.isCacheDestinations() != null ? overrideProperties.isCacheDestinations() : raProperties.isCacheDestinations(); val = overrideProperties.isCacheDestinations() != null ? overrideProperties.isCacheDestinations() : raProperties.isCacheDestinations();
if (val != null) { if (val != null) {
cf.setCacheDestinations(val); cf.setCacheDestinations(val);

View File

@ -79,8 +79,6 @@ public class ConnectionFactoryProperties implements ConnectionFactoryOptions {
private Integer confirmationWindowSize; private Integer confirmationWindowSize;
private Boolean failoverOnInitialConnection;
private Integer producerMaxRate; private Integer producerMaxRate;
private Integer minLargeMessageSize; private Integer minLargeMessageSize;
@ -415,13 +413,13 @@ public class ConnectionFactoryProperties implements ConnectionFactoryOptions {
this.confirmationWindowSize = confirmationWindowSize; this.confirmationWindowSize = confirmationWindowSize;
} }
@Deprecated
public Boolean isFailoverOnInitialConnection() { public Boolean isFailoverOnInitialConnection() {
return failoverOnInitialConnection; return false;
} }
@Deprecated
public void setFailoverOnInitialConnection(Boolean failoverOnInitialConnection) { public void setFailoverOnInitialConnection(Boolean failoverOnInitialConnection) {
hasBeenUpdated = true;
this.failoverOnInitialConnection = failoverOnInitialConnection;
} }
public Integer getProducerMaxRate() { public Integer getProducerMaxRate() {
@ -799,11 +797,6 @@ public class ConnectionFactoryProperties implements ConnectionFactoryOptions {
return false; return false;
} else if (!this.compressLargeMessage.equals(other.compressLargeMessage)) } else if (!this.compressLargeMessage.equals(other.compressLargeMessage))
return false; return false;
if (this.failoverOnInitialConnection == null) {
if (other.failoverOnInitialConnection != null)
return false;
} else if (!this.failoverOnInitialConnection.equals(other.failoverOnInitialConnection))
return false;
if (this.ha == null) { if (this.ha == null) {
if (other.ha != null) if (other.ha != null)
return false; return false;
@ -1039,7 +1032,6 @@ public class ConnectionFactoryProperties implements ConnectionFactoryOptions {
result = prime * result + ((protocolManagerFactoryStr == null) ? 0 : protocolManagerFactoryStr.hashCode()); result = prime * result + ((protocolManagerFactoryStr == null) ? 0 : protocolManagerFactoryStr.hashCode());
result = prime * result + ((consumerMaxRate == null) ? 0 : consumerMaxRate.hashCode()); result = prime * result + ((consumerMaxRate == null) ? 0 : consumerMaxRate.hashCode());
result = prime * result + ((confirmationWindowSize == null) ? 0 : confirmationWindowSize.hashCode()); result = prime * result + ((confirmationWindowSize == null) ? 0 : confirmationWindowSize.hashCode());
result = prime * result + ((failoverOnInitialConnection == null) ? 0 : failoverOnInitialConnection.hashCode());
result = prime * result + ((producerMaxRate == null) ? 0 : producerMaxRate.hashCode()); result = prime * result + ((producerMaxRate == null) ? 0 : producerMaxRate.hashCode());
result = prime * result + ((minLargeMessageSize == null) ? 0 : minLargeMessageSize.hashCode()); result = prime * result + ((minLargeMessageSize == null) ? 0 : minLargeMessageSize.hashCode());
result = prime * result + ((blockOnAcknowledge == null) ? 0 : blockOnAcknowledge.hashCode()); result = prime * result + ((blockOnAcknowledge == null) ? 0 : blockOnAcknowledge.hashCode());

View File

@ -166,7 +166,7 @@ public class BMFailoverTest extends FailoverTestBase {
action = "org.apache.activemq.artemis.tests.extras.byteman.BMFailoverTest.serverToStop.getServer().stop(true)")}) action = "org.apache.activemq.artemis.tests.extras.byteman.BMFailoverTest.serverToStop.getServer().stop(true)")})
public void testFailoverOnCommit2() throws Exception { public void testFailoverOnCommit2() throws Exception {
serverToStop = liveServer; serverToStop = liveServer;
locator = getServerLocator().setFailoverOnInitialConnection(true); locator = getServerLocator();
SimpleString inQueue = new SimpleString("inQueue"); SimpleString inQueue = new SimpleString("inQueue");
SimpleString outQueue = new SimpleString("outQueue"); SimpleString outQueue = new SimpleString("outQueue");
createSessionFactory(); createSessionFactory();
@ -253,7 +253,7 @@ public class BMFailoverTest extends FailoverTestBase {
action = "org.apache.activemq.artemis.tests.extras.byteman.BMFailoverTest.serverToStop.getServer().stop(true)")}) action = "org.apache.activemq.artemis.tests.extras.byteman.BMFailoverTest.serverToStop.getServer().stop(true)")})
public void testFailoverOnCommit() throws Exception { public void testFailoverOnCommit() throws Exception {
serverToStop = liveServer; serverToStop = liveServer;
locator = getServerLocator().setFailoverOnInitialConnection(true); locator = getServerLocator();
createSessionFactory(); createSessionFactory();
ClientSession session = createSessionAndQueue(); ClientSession session = createSessionAndQueue();
@ -282,7 +282,7 @@ public class BMFailoverTest extends FailoverTestBase {
action = "org.apache.activemq.artemis.tests.extras.byteman.BMFailoverTest.serverToStop.getServer().stop(true)")}) action = "org.apache.activemq.artemis.tests.extras.byteman.BMFailoverTest.serverToStop.getServer().stop(true)")})
public void testFailoverOnReceiveCommit() throws Exception { public void testFailoverOnReceiveCommit() throws Exception {
serverToStop = liveServer; serverToStop = liveServer;
locator = getServerLocator().setFailoverOnInitialConnection(true); locator = getServerLocator();
createSessionFactory(); createSessionFactory();
ClientSession session = createSessionAndQueue(); ClientSession session = createSessionAndQueue();

View File

@ -63,7 +63,7 @@ public class ServerLocatorConnectTest extends ActiveMQTestBase {
"transactionBatchSize=1048576&callTimeout=30000&preAcknowledge=false&" + "transactionBatchSize=1048576&callTimeout=30000&preAcknowledge=false&" +
"connectionLoadBalancingPolicyClassName=org.apache.activemq.artemis.api.core.client.loadbalance." + "connectionLoadBalancingPolicyClassName=org.apache.activemq.artemis.api.core.client.loadbalance." +
"RoundRobinConnectionLoadBalancingPolicy&dupsOKBatchSize=1048576&initialMessagePacketSize=1500&" + "RoundRobinConnectionLoadBalancingPolicy&dupsOKBatchSize=1048576&initialMessagePacketSize=1500&" +
"consumerMaxRate=-1&retryInterval=2000&failoverOnInitialConnection=false&producerWindowSize=65536&" + "consumerMaxRate=-1&retryInterval=2000&producerWindowSize=65536&" +
"port=61616&host=localhost#"); "port=61616&host=localhost#");
// try it a few times to make sure it fails if it's broken // try it a few times to make sure it fails if it's broken

View File

@ -231,7 +231,7 @@ public class FailBackAutoTest extends FailoverTestBase {
} }
private void createSessionFactory() throws Exception { private void createSessionFactory() throws Exception {
locator.setBlockOnNonDurableSend(true).setBlockOnDurableSend(true).setFailoverOnInitialConnection(true) // unnecessary? locator.setBlockOnNonDurableSend(true).setBlockOnDurableSend(true) // unnecessary?
.setReconnectAttempts(15); .setReconnectAttempts(15);
sf = createSessionFactoryAndWaitForTopology(locator, 2); sf = createSessionFactoryAndWaitForTopology(locator, 2);
} }

View File

@ -50,7 +50,7 @@ public class FailBackManualTest extends FailoverTestBase {
@Test @Test
public void testNoAutoFailback() throws Exception { public void testNoAutoFailback() throws Exception {
locator.setBlockOnNonDurableSend(true).setBlockOnDurableSend(true).setFailoverOnInitialConnection(true).setReconnectAttempts(15); locator.setBlockOnNonDurableSend(true).setBlockOnDurableSend(true).setReconnectAttempts(15);
ClientSessionFactoryInternal sf = createSessionFactoryAndWaitForTopology(locator, 2); ClientSessionFactoryInternal sf = createSessionFactoryAndWaitForTopology(locator, 2);

View File

@ -144,7 +144,7 @@ public class FailoverListenerTest extends FailoverTestBase {
*/ */
@Test @Test
public void testFailoverFailed() throws Exception { public void testFailoverFailed() throws Exception {
locator.setBlockOnNonDurableSend(true).setBlockOnDurableSend(true).setFailoverOnInitialConnection(true) // unnecessary? locator.setBlockOnNonDurableSend(true).setBlockOnDurableSend(true) // unnecessary?
.setReconnectAttempts(1); .setReconnectAttempts(1);
sf = createSessionFactoryAndWaitForTopology(locator, 2); sf = createSessionFactoryAndWaitForTopology(locator, 2);
@ -170,7 +170,7 @@ public class FailoverListenerTest extends FailoverTestBase {
} }
private void createSessionFactory(int members) throws Exception { private void createSessionFactory(int members) throws Exception {
locator.setBlockOnNonDurableSend(true).setBlockOnDurableSend(true).setFailoverOnInitialConnection(true) // unnecessary? locator.setBlockOnNonDurableSend(true).setBlockOnDurableSend(true) // unnecessary?
.setReconnectAttempts(15); .setReconnectAttempts(15);
sf = createSessionFactoryAndWaitForTopology(locator, members); sf = createSessionFactoryAndWaitForTopology(locator, members);
} }

View File

@ -780,7 +780,6 @@ public class FailoverTest extends FailoverTestBase {
@Test(timeout = 120000) @Test(timeout = 120000)
public void testFailBackLiveRestartsBackupIsGone() throws Exception { public void testFailBackLiveRestartsBackupIsGone() throws Exception {
locator.setFailoverOnInitialConnection(true);
createSessionFactory(); createSessionFactory();
ClientSession session = createSessionAndQueue(); ClientSession session = createSessionAndQueue();
@ -833,7 +832,6 @@ public class FailoverTest extends FailoverTestBase {
@Test(timeout = 120000) @Test(timeout = 120000)
public void testWithoutUsingTheBackup() throws Exception { public void testWithoutUsingTheBackup() throws Exception {
locator.setFailoverOnInitialConnection(true);
createSessionFactory(); createSessionFactory();
ClientSession session = createSessionAndQueue(); ClientSession session = createSessionAndQueue();
@ -884,7 +882,6 @@ public class FailoverTest extends FailoverTestBase {
* @throws Exception * @throws Exception
*/ */
private void simpleFailover(boolean isReplicated, boolean doFailBack) throws Exception { private void simpleFailover(boolean isReplicated, boolean doFailBack) throws Exception {
locator.setFailoverOnInitialConnection(true);
createSessionFactory(); createSessionFactory();
ClientSession session = createSessionAndQueue(); ClientSession session = createSessionAndQueue();
@ -1029,7 +1026,7 @@ public class FailoverTest extends FailoverTestBase {
// https://jira.jboss.org/jira/browse/HORNETQ-285 // https://jira.jboss.org/jira/browse/HORNETQ-285
@Test(timeout = 120000) @Test(timeout = 120000)
public void testFailoverOnInitialConnection() throws Exception { public void testFailoverOnInitialConnection() throws Exception {
locator.setBlockOnNonDurableSend(true).setBlockOnDurableSend(true).setFailoverOnInitialConnection(true).setReconnectAttempts(300).setRetryInterval(100); locator.setBlockOnNonDurableSend(true).setBlockOnDurableSend(true).setReconnectAttempts(300).setRetryInterval(100);
sf = createSessionFactoryAndWaitForTopology(locator, 2); sf = createSessionFactoryAndWaitForTopology(locator, 2);
@ -1653,7 +1650,7 @@ public class FailoverTest extends FailoverTestBase {
@Test(timeout = 120000) @Test(timeout = 120000)
public void testCreateNewFactoryAfterFailover() throws Exception { public void testCreateNewFactoryAfterFailover() throws Exception {
locator.setBlockOnNonDurableSend(true).setBlockOnDurableSend(true).setFailoverOnInitialConnection(true); locator.setBlockOnNonDurableSend(true).setBlockOnDurableSend(true);
sf = createSessionFactoryAndWaitForTopology(locator, 2); sf = createSessionFactoryAndWaitForTopology(locator, 2);
ClientSession session = sendAndConsume(sf, true); ClientSession session = sendAndConsume(sf, true);
@ -2195,7 +2192,6 @@ public class FailoverTest extends FailoverTestBase {
if (!(backupServer.getServer().getHAPolicy() instanceof SharedStoreSlavePolicy)) { if (!(backupServer.getServer().getHAPolicy() instanceof SharedStoreSlavePolicy)) {
return; return;
} }
locator.setFailoverOnInitialConnection(true);
createSessionFactory(); createSessionFactory();
ClientSession session = sendAndConsume(sf, true); ClientSession session = sendAndConsume(sf, true);
@ -2225,7 +2221,6 @@ public class FailoverTest extends FailoverTestBase {
@Test(timeout = 120000) @Test(timeout = 120000)
public void testLiveAndBackupLiveComesBack() throws Exception { public void testLiveAndBackupLiveComesBack() throws Exception {
locator.setFailoverOnInitialConnection(true);
createSessionFactory(); createSessionFactory();
final CountDownLatch latch = new CountDownLatch(1); final CountDownLatch latch = new CountDownLatch(1);
@ -2257,7 +2252,6 @@ public class FailoverTest extends FailoverTestBase {
@Test(timeout = 120000) @Test(timeout = 120000)
public void testLiveAndBackupLiveComesBackNewFactory() throws Exception { public void testLiveAndBackupLiveComesBackNewFactory() throws Exception {
locator.setFailoverOnInitialConnection(true);
createSessionFactory(); createSessionFactory();
final CountDownLatch latch = new CountDownLatch(1); final CountDownLatch latch = new CountDownLatch(1);
@ -2306,7 +2300,7 @@ public class FailoverTest extends FailoverTestBase {
@Test(timeout = 120000) @Test(timeout = 120000)
public void testLiveAndBackupBackupComesBackNewFactory() throws Exception { public void testLiveAndBackupBackupComesBackNewFactory() throws Exception {
locator.setBlockOnNonDurableSend(true).setBlockOnDurableSend(true).setFailoverOnInitialConnection(true).setReconnectAttempts(300).setRetryInterval(100); locator.setBlockOnNonDurableSend(true).setBlockOnDurableSend(true).setReconnectAttempts(300).setRetryInterval(100);
sf = createSessionFactoryAndWaitForTopology(locator, 2); sf = createSessionFactoryAndWaitForTopology(locator, 2);

View File

@ -218,7 +218,7 @@ public class LiveToLiveFailoverTest extends FailoverTest {
@Override @Override
@Test @Test
public void testFailoverOnInitialConnection() throws Exception { public void testFailoverOnInitialConnection() throws Exception {
locator.setBlockOnNonDurableSend(true).setBlockOnDurableSend(true).setFailoverOnInitialConnection(true).setReconnectAttempts(300).setRetryInterval(100); locator.setBlockOnNonDurableSend(true).setBlockOnDurableSend(true).setReconnectAttempts(300).setRetryInterval(100);
sf = createSessionFactoryAndWaitForTopology(locator, 2); sf = createSessionFactoryAndWaitForTopology(locator, 2);
@ -245,7 +245,7 @@ public class LiveToLiveFailoverTest extends FailoverTest {
@Override @Override
@Test @Test
public void testCreateNewFactoryAfterFailover() throws Exception { public void testCreateNewFactoryAfterFailover() throws Exception {
locator.setBlockOnNonDurableSend(true).setBlockOnDurableSend(true).setFailoverOnInitialConnection(true); locator.setBlockOnNonDurableSend(true).setBlockOnDurableSend(true);
sf = createSessionFactoryAndWaitForTopology(locator, 2); sf = createSessionFactoryAndWaitForTopology(locator, 2);
ClientSession session = sendAndConsume(sf, true); ClientSession session = sendAndConsume(sf, true);

View File

@ -61,7 +61,7 @@ public class ConnectionTest extends JMSTestBase {
"transactionBatchSize=1048576&callTimeout=30000&preAcknowledge=false&" + "transactionBatchSize=1048576&callTimeout=30000&preAcknowledge=false&" +
"connectionLoadBalancingPolicyClassName=org.apache.activemq.artemis.api.core.client.loadbalance." + "connectionLoadBalancingPolicyClassName=org.apache.activemq.artemis.api.core.client.loadbalance." +
"RoundRobinConnectionLoadBalancingPolicy&dupsOKBatchSize=1048576&initialMessagePacketSize=1500&" + "RoundRobinConnectionLoadBalancingPolicy&dupsOKBatchSize=1048576&initialMessagePacketSize=1500&" +
"consumerMaxRate=-1&retryInterval=2000&failoverOnInitialConnection=false&producerWindowSize=65536&" + "consumerMaxRate=-1&retryInterval=2000&producerWindowSize=65536&" +
"port=61616&host=localhost#"); "port=61616&host=localhost#");
testThroughNewConnectionFactory(connectionFactory); testThroughNewConnectionFactory(connectionFactory);

View File

@ -262,7 +262,7 @@ public class ConnectionFactorySerializationTest extends JMSTestBase {
ArrayList<String> connectorNames = new ArrayList<>(); ArrayList<String> connectorNames = new ArrayList<>();
connectorNames.add(main.getName()); connectorNames.add(main.getName());
connectorNames.add(main2.getName()); connectorNames.add(main2.getName());
ConnectionFactoryConfiguration configuration = new ConnectionFactoryConfigurationImpl().setName("MyConnectionFactory").setHA(b).setConnectorNames(connectorNames).setClientID("clientID").setClientFailureCheckPeriod(-1).setConnectionTTL(-2).setFactoryType(JMSFactoryType.CF).setCallTimeout(-3).setCallFailoverTimeout(-4).setCacheLargeMessagesClient(b).setMinLargeMessageSize(-5).setConsumerWindowSize(-6).setConsumerMaxRate(-7).setConfirmationWindowSize(-8).setProducerWindowSize(-9).setProducerMaxRate(-10).setBlockOnAcknowledge(b).setBlockOnDurableSend(b).setBlockOnNonDurableSend(b).setAutoGroup(b).setPreAcknowledge(b).setLoadBalancingPolicyClassName("foobar").setTransactionBatchSize(-11).setDupsOKBatchSize(-12).setUseGlobalPools(b).setScheduledThreadPoolMaxSize(-13).setThreadPoolMaxSize(-14).setRetryInterval(-15).setRetryIntervalMultiplier(-16).setMaxRetryInterval(-17).setReconnectAttempts(-18).setFailoverOnInitialConnection(b).setGroupID("groupID") ConnectionFactoryConfiguration configuration = new ConnectionFactoryConfigurationImpl().setName("MyConnectionFactory").setHA(b).setConnectorNames(connectorNames).setClientID("clientID").setClientFailureCheckPeriod(-1).setConnectionTTL(-2).setFactoryType(JMSFactoryType.CF).setCallTimeout(-3).setCallFailoverTimeout(-4).setCacheLargeMessagesClient(b).setMinLargeMessageSize(-5).setConsumerWindowSize(-6).setConsumerMaxRate(-7).setConfirmationWindowSize(-8).setProducerWindowSize(-9).setProducerMaxRate(-10).setBlockOnAcknowledge(b).setBlockOnDurableSend(b).setBlockOnNonDurableSend(b).setAutoGroup(b).setPreAcknowledge(b).setLoadBalancingPolicyClassName("foobar").setTransactionBatchSize(-11).setDupsOKBatchSize(-12).setUseGlobalPools(b).setScheduledThreadPoolMaxSize(-13).setThreadPoolMaxSize(-14).setRetryInterval(-15).setRetryIntervalMultiplier(-16).setMaxRetryInterval(-17).setReconnectAttempts(-18).setGroupID("groupID")
.setInitialMessagePacketSize(1499); .setInitialMessagePacketSize(1499);
jmsServer.createConnectionFactory(false, configuration, "/MyConnectionFactory"); jmsServer.createConnectionFactory(false, configuration, "/MyConnectionFactory");