Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENTMQBR-2706 : Fix xa-recovery repeated logging issue #321

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -0,0 +1,88 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF 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.apache.activemq.artemis.api.config;

import org.apache.activemq.artemis.api.core.client.ActiveMQClient;

public class ServerLocatorConfig {
public boolean failoverOnInitialConnection = ActiveMQClient.DEFAULT_FAILOVER_ON_INITIAL_CONNECTION;
public long clientFailureCheckPeriod = ActiveMQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD;
public long connectionTTL = ActiveMQClient.DEFAULT_CONNECTION_TTL;
public long callTimeout = ActiveMQClient.DEFAULT_CALL_TIMEOUT;
public long callFailoverTimeout = ActiveMQClient.DEFAULT_CALL_FAILOVER_TIMEOUT;
public int minLargeMessageSize = ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE;
public int consumerWindowSize = ActiveMQClient.DEFAULT_CONSUMER_WINDOW_SIZE;
public int consumerMaxRate = ActiveMQClient.DEFAULT_CONSUMER_MAX_RATE;
public int confirmationWindowSize = ActiveMQClient.DEFAULT_CONFIRMATION_WINDOW_SIZE;
public int producerWindowSize = ActiveMQClient.DEFAULT_PRODUCER_WINDOW_SIZE;
public int producerMaxRate = ActiveMQClient.DEFAULT_PRODUCER_MAX_RATE;
public boolean blockOnAcknowledge = ActiveMQClient.DEFAULT_BLOCK_ON_ACKNOWLEDGE;
public boolean blockOnDurableSend = ActiveMQClient.DEFAULT_BLOCK_ON_DURABLE_SEND;
public boolean blockOnNonDurableSend = ActiveMQClient.DEFAULT_BLOCK_ON_NON_DURABLE_SEND;
public boolean autoGroup = ActiveMQClient.DEFAULT_AUTO_GROUP;
public boolean preAcknowledge = ActiveMQClient.DEFAULT_PRE_ACKNOWLEDGE;
public int ackBatchSize = ActiveMQClient.DEFAULT_ACK_BATCH_SIZE;
public String connectionLoadBalancingPolicyClassName = ActiveMQClient.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME;
public boolean useGlobalPools = ActiveMQClient.DEFAULT_USE_GLOBAL_POOLS;
public int threadPoolMaxSize = ActiveMQClient.DEFAULT_THREAD_POOL_MAX_SIZE;
public int scheduledThreadPoolMaxSize = ActiveMQClient.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE;
public long retryInterval = ActiveMQClient.DEFAULT_RETRY_INTERVAL;
public double retryIntervalMultiplier = ActiveMQClient.DEFAULT_RETRY_INTERVAL_MULTIPLIER;
public long maxRetryInterval = ActiveMQClient.DEFAULT_MAX_RETRY_INTERVAL;
public int reconnectAttempts = ActiveMQClient.DEFAULT_RECONNECT_ATTEMPTS;
public int initialConnectAttempts = ActiveMQClient.INITIAL_CONNECT_ATTEMPTS;
public int initialMessagePacketSize = ActiveMQClient.DEFAULT_INITIAL_MESSAGE_PACKET_SIZE;
public boolean cacheLargeMessagesClient = ActiveMQClient.DEFAULT_CACHE_LARGE_MESSAGE_CLIENT;
public boolean compressLargeMessage = ActiveMQClient.DEFAULT_COMPRESS_LARGE_MESSAGES;
public boolean useTopologyForLoadBalancing = ActiveMQClient.DEFAULT_USE_TOPOLOGY_FOR_LOADBALANCING;

public ServerLocatorConfig() {
}

public ServerLocatorConfig(final ServerLocatorConfig locator) {
failoverOnInitialConnection = locator.failoverOnInitialConnection;
compressLargeMessage = locator.compressLargeMessage;
cacheLargeMessagesClient = locator.cacheLargeMessagesClient;
clientFailureCheckPeriod = locator.clientFailureCheckPeriod;
connectionTTL = locator.connectionTTL;
callTimeout = locator.callTimeout;
callFailoverTimeout = locator.callFailoverTimeout;
minLargeMessageSize = locator.minLargeMessageSize;
consumerWindowSize = locator.consumerWindowSize;
consumerMaxRate = locator.consumerMaxRate;
confirmationWindowSize = locator.confirmationWindowSize;
producerWindowSize = locator.producerWindowSize;
producerMaxRate = locator.producerMaxRate;
blockOnAcknowledge = locator.blockOnAcknowledge;
blockOnDurableSend = locator.blockOnDurableSend;
blockOnNonDurableSend = locator.blockOnNonDurableSend;
autoGroup = locator.autoGroup;
preAcknowledge = locator.preAcknowledge;
connectionLoadBalancingPolicyClassName = locator.connectionLoadBalancingPolicyClassName;
ackBatchSize = locator.ackBatchSize;
useGlobalPools = locator.useGlobalPools;
scheduledThreadPoolMaxSize = locator.scheduledThreadPoolMaxSize;
threadPoolMaxSize = locator.threadPoolMaxSize;
retryInterval = locator.retryInterval;
retryIntervalMultiplier = locator.retryIntervalMultiplier;
maxRetryInterval = locator.maxRetryInterval;
reconnectAttempts = locator.reconnectAttempts;
initialConnectAttempts = locator.initialConnectAttempts;
initialMessagePacketSize = locator.initialMessagePacketSize;
useTopologyForLoadBalancing = locator.useTopologyForLoadBalancing;
}
}
Expand Up @@ -19,6 +19,7 @@
import java.util.concurrent.Executor;
import java.util.concurrent.ScheduledExecutorService;

import org.apache.activemq.artemis.api.config.ServerLocatorConfig;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration;
import org.apache.activemq.artemis.api.core.Interceptor;
Expand Down Expand Up @@ -802,4 +803,8 @@ ClientSessionFactory createSessionFactory(TransportConfiguration transportConfig

/** This will only instantiate internal objects such as the topology */
void initialize() throws ActiveMQException;

ServerLocatorConfig getLocatorConfig();

void setLocatorConfig(ServerLocatorConfig serverLocatorConfig);
}
Expand Up @@ -32,6 +32,7 @@
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

import org.apache.activemq.artemis.api.config.ServerLocatorConfig;
import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.api.core.ActiveMQInterruptedException;
Expand Down Expand Up @@ -156,13 +157,7 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C

public ClientSessionFactoryImpl(final ServerLocatorInternal serverLocator,
final TransportConfiguration connectorConfig,
final long callTimeout,
final long callFailoverTimeout,
final long clientFailureCheckPeriod,
final long connectionTTL,
final long retryInterval,
final double retryIntervalMultiplier,
final long maxRetryInterval,
final ServerLocatorConfig locatorConfig,
final int reconnectAttempts,
final Executor threadPool,
final ScheduledExecutorService scheduledThreadPool,
Expand All @@ -182,27 +177,27 @@ public ClientSessionFactoryImpl(final ServerLocatorInternal serverLocator,

checkTransportKeys(connectorFactory, connectorConfig);

this.callTimeout = callTimeout;
this.callTimeout = locatorConfig.callTimeout;

this.callFailoverTimeout = callFailoverTimeout;
this.callFailoverTimeout = locatorConfig.callFailoverTimeout;

// HORNETQ-1314 - if this in an in-vm connection then disable connection monitoring
if (connectorFactory.isReliable() &&
clientFailureCheckPeriod == ActiveMQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD &&
connectionTTL == ActiveMQClient.DEFAULT_CONNECTION_TTL) {
locatorConfig.clientFailureCheckPeriod == ActiveMQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD &&
locatorConfig.connectionTTL == ActiveMQClient.DEFAULT_CONNECTION_TTL) {
this.clientFailureCheckPeriod = ActiveMQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD_INVM;
this.connectionTTL = ActiveMQClient.DEFAULT_CONNECTION_TTL_INVM;
} else {
this.clientFailureCheckPeriod = clientFailureCheckPeriod;
this.clientFailureCheckPeriod = locatorConfig.clientFailureCheckPeriod;

this.connectionTTL = connectionTTL;
this.connectionTTL = locatorConfig.connectionTTL;
}

this.retryInterval = retryInterval;
this.retryInterval = locatorConfig.retryInterval;

this.retryIntervalMultiplier = retryIntervalMultiplier;
this.retryIntervalMultiplier = locatorConfig.retryIntervalMultiplier;

this.maxRetryInterval = maxRetryInterval;
this.maxRetryInterval = locatorConfig.maxRetryInterval;

this.reconnectAttempts = reconnectAttempts;

Expand Down