[
https://issues.apache.org/jira/browse/ARTEMIS-5852?focusedWorklogId=1001854&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1001854
]
ASF GitHub Bot logged work on ARTEMIS-5852:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 26/Jan/26 19:54
Start Date: 26/Jan/26 19:54
Worklog Time Spent: 10m
Work Description: tabish121 commented on code in PR #6191:
URL: https://github.com/apache/artemis/pull/6191#discussion_r2728991415
##########
artemis-lockmanager/artemis-lockmanager-etcd/src/main/java/org/apache/activemq/artemis/lockmanager/etcd/EtcdDistributedLockManagerFactory.java:
##########
@@ -0,0 +1,70 @@
+/*
+ * 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.lockmanager.etcd;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import org.apache.activemq.artemis.lockmanager.DistributedLockManager;
+import org.apache.activemq.artemis.lockmanager.DistributedLockManagerFactory;
+
+public class EtcdDistributedLockManagerFactory implements
DistributedLockManagerFactory {
+
+ @Override
+ public DistributedLockManager build(Map<String, String> config) {
+
+ EtcdLockConfiguration lockConfiguration = new EtcdLockConfiguration()
+ .setUser(config.getOrDefault(USER, DEFAULT_USER))
+ .setPassword(config.getOrDefault(PASSWORD, DEFAULT_PASSWORD))
+ .setAuthority(config.getOrDefault(AUTHORITY, DEFAULT_AUTHORITY))
+ .setLeasePeriod(Integer.parseInt(config.getOrDefault(LEASE_PERIOD,
DEFAULT_LEASE_PERIOD)))
+ .setEndpoints(config.get(CONNECT_STRING));
+
+ return new EtcdDistributedLockManager(lockConfiguration);
+ }
+
+ @Override
+ public String getName() {
+ return "etcd";
+ }
+
+ @Override
+ public String getImplName() {
+ return EtcdDistributedLockManager.class.getName();
+ }
+
+ public static String CONNECT_STRING = "connect-string";
+ public static String USER = "user";
+ public static String DEFAULT_USER = null;
+ public static String PASSWORD = "password";
+ public static String DEFAULT_PASSWORD = null;
+ public static String AUTHORITY = "authority";
+ public static String DEFAULT_AUTHORITY = null;
+ public static String LEASE_PERIOD = "lease-period";
+ public static String DEFAULT_LEASE_PERIOD = "10";
+
+ public static final Set<String> VALID_PARAMS = Stream.of(
+ USER, PASSWORD, AUTHORITY, LEASE_PERIOD).collect(Collectors.toSet());
Review Comment:
For a collection like this where you are holding validation data which I
would guess should not be modified by any user the
`Collectors.toUnmodifiableSet` API would seem like a better fit.
##########
artemis-lockmanager/artemis-lockmanager-ri/src/main/java/org/apache/activemq/artemis/lockmanager/file/FileBasedLockManagerFactory.java:
##########
@@ -0,0 +1,59 @@
+/*
+ * 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.lockmanager.file;
+
+import java.io.File;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import org.apache.activemq.artemis.lockmanager.DistributedLockManager;
+import org.apache.activemq.artemis.lockmanager.DistributedLockManagerFactory;
+
+public class FileBasedLockManagerFactory implements
DistributedLockManagerFactory {
+
+ private static final String LOCK_FOLDER = "locks-folder";
+
+ private static final Set<String> VALID_PARAMS =
Stream.of(LOCK_FOLDER).collect(Collectors.toSet());
Review Comment:
Same as above `Collectors.toUnmodifiableSet`
##########
artemis-lockmanager/artemis-lockmanager-ri/src/main/java/org/apache/activemq/artemis/lockmanager/zookeeper/CuratorDistributedLockManagerFactory.java:
##########
@@ -0,0 +1,73 @@
+/*
+ * 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.lockmanager.zookeeper;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import org.apache.activemq.artemis.lockmanager.DistributedLockManager;
+import org.apache.activemq.artemis.lockmanager.DistributedLockManagerFactory;
+
+public class CuratorDistributedLockManagerFactory implements
DistributedLockManagerFactory {
+
+ private static final String CONNECT_STRING_PARAM = "connect-string";
+ private static final String NAMESPACE_PARAM = "namespace";
+ private static final String SESSION_MS_PARAM = "session-ms";
+ private static final String SESSION_PERCENT_PARAM = "session-percent";
+ private static final String CONNECTION_MS_PARAM = "connection-ms";
+ private static final String RETRIES_PARAM = "retries";
+ private static final String RETRIES_MS_PARAM = "retries-ms";
+ private static final Set<String> VALID_PARAMS =
Stream.of(CONNECT_STRING_PARAM, NAMESPACE_PARAM, SESSION_MS_PARAM,
SESSION_PERCENT_PARAM, CONNECTION_MS_PARAM, RETRIES_PARAM,
RETRIES_MS_PARAM).collect(Collectors.toSet());
Review Comment:
Same as above `Collectors.toUnmodifiableSet`
Issue Time Tracking
-------------------
Worklog Id: (was: 1001854)
Time Spent: 20m (was: 10m)
> Leader/Follower pattern on acceptors
> ------------------------------------
>
> Key: ARTEMIS-5852
> URL: https://issues.apache.org/jira/browse/ARTEMIS-5852
> Project: Artemis
> Issue Type: New Feature
> Components: Broker
> Affects Versions: 2.50.0
> Reporter: Clebert Suconic
> Priority: Major
> Labels: pull-request-available
> Fix For: 2.51.0
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> This opens the possibility of using Mirroring for Failover, in replacement of
> replication.
> You set a LeaderManager on the configuration, and configure Acceptors to only
> start after a distributed lock is acquired.
> this current implementation is being done on top of DistributedLockManager,
> and I'm adding etcd as an option also.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]