Divyansh200102 commented on code in PR #5421:
URL: https://github.com/apache/shenyu/pull/5421#discussion_r1467585106
##########
shenyu-client/shenyu-client-core/src/main/java/org/apache/shenyu/client/core/register/ShenyuClientRegisterRepositoryFactory.java:
##########
@@ -29,9 +30,32 @@
* The type shenyu client register repository factory.
*/
public final class ShenyuClientRegisterRepositoryFactory {
-
+
private static final Map<String, ShenyuClientRegisterRepository>
REPOSITORY_MAP = new ConcurrentHashMap<>();
-
+
+ /**
+ * Get the REPOSITORY_MAP.
+ *
+ * @return the REPOSITORY_MAP
+ */
+ //getter
+ public static Map<String, ShenyuClientRegisterRepository>
getRepositoryMap() {
+ return Collections.unmodifiableMap(REPOSITORY_MAP);
+ }
+
+ /**
+ * Sets the repository map with the provided map of
ShenyuClientRegisterRepository instances.
+ * Clears the existing repository map and adds all entries from the
provided map.
+ *
+ * @param repositoryMap The map containing ShenyuClientRegisterRepository
instances,
+ * where each entry's key is the repository type
identifier.
+ */
+ // Setter for testing purposes
Review Comment:
I am trying to use call `getRepositoryMap().clear();` but am facing this
error `Immutable object cannot be modified` even though I was using the getter
so to fix this I read somewhere it can be fixed using setter along with getter
to create a new map copy for testing purposes but still it didn't end up
working . @moremind
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]