[
https://issues.apache.org/jira/browse/ARTEMIS-5889?focusedWorklogId=1005895&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1005895
]
ASF GitHub Bot logged work on ARTEMIS-5889:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 18/Feb/26 17:05
Start Date: 18/Feb/26 17:05
Worklog Time Spent: 10m
Work Description: tabish121 commented on code in PR #6240:
URL: https://github.com/apache/artemis/pull/6240#discussion_r2823447411
##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/server/routing/ConnectionRouterManager.java:
##########
@@ -46,52 +46,108 @@
import java.lang.invoke.MethodHandles;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+import java.util.function.Function;
+import java.util.stream.Collectors;
public final class ConnectionRouterManager implements ActiveMQComponent {
+
private static final Logger logger =
LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
public static final String CACHE_ID_PREFIX = "$.BC.";
-
- private final Configuration config;
-
private final ActiveMQServer server;
private final ScheduledExecutorService scheduledExecutor;
private volatile boolean started = false;
- private Map<String, ConnectionRouter> connectionRouters = new HashMap<>();
+ private final ReentrantReadWriteLock stateLock = new
ReentrantReadWriteLock();
+ private Map<String, ConnectionRouterConfiguration> configurations = new
HashMap<>();
+ private Map<String, ConnectionRouter> connectionRouters = new HashMap<>();
@Override
public boolean isStarted() {
return started;
}
-
- public ConnectionRouterManager(final Configuration config, final
ActiveMQServer server, ScheduledExecutorService scheduledExecutor) {
- this.config = config;
+ public ConnectionRouterManager(final ActiveMQServer server,
ScheduledExecutorService scheduledExecutor) {
this.server = server;
this.scheduledExecutor = scheduledExecutor;
}
- public void deploy() throws Exception {
- for (ConnectionRouterConfiguration connectionRouterConfig :
config.getConnectionRouters()) {
- deployConnectionRouter(connectionRouterConfig);
+ public void deploy(Configuration config) throws Exception {
+ stateLock.writeLock().lock();
+ try {
+ for (ConnectionRouterConfiguration connectionRouterConfig :
config.getConnectionRouters()) {
+ deployConnectionRouter(connectionRouterConfig);
+ }
+ } finally {
+ stateLock.writeLock().unlock();
+ }
+ }
+
+ public void update(Configuration config) throws Exception {
+ stateLock.writeLock().lock();
+ try {
+ final List<ConnectionRouterConfiguration> activeConfiguration =
Objects.requireNonNullElse(config.getConnectionRouters(),
Collections.emptyList());
+
+ // Find any updated configurations and stop them, we will deploy at
the end all new and updated configurations
Review Comment:
Fixed thanks
Issue Time Tracking
-------------------
Worklog Id: (was: 1005895)
Time Spent: 40m (was: 0.5h)
> support connectionRouter config reload
> --------------------------------------
>
> Key: ARTEMIS-5889
> URL: https://issues.apache.org/jira/browse/ARTEMIS-5889
> Project: Artemis
> Issue Type: Improvement
> Components: Configuration
> Affects Versions: 2.50.0
> Reporter: Gary Tully
> Assignee: Timothy A. Bish
> Priority: Major
> Labels: pull-request-available
> Time Spent: 40m
> Remaining Estimate: 0h
>
> The connectionRouter config is not currently reloadable, no action is taken
> on config refresh.
> the typical CUD operations should be supported like for the recent reload of
> acceptors.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]