You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2020/08/13 08:31:07 UTC

[maven-resolver] 01/02: Create Client with Constructor

This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch redisson
in repository https://gitbox.apache.org/repos/asf/maven-resolver.git

commit d44712d326923fdc07eeea4588af13e34b858f04
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Thu Aug 13 10:30:29 2020 +0200

    Create Client with Constructor
---
 .../aether/synccontext/RedissonSyncContextFactory.java        | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/maven-resolver-synccontext-redisson/src/main/java/org/eclipse/aether/synccontext/RedissonSyncContextFactory.java b/maven-resolver-synccontext-redisson/src/main/java/org/eclipse/aether/synccontext/RedissonSyncContextFactory.java
index 1f3207f..14c5d7d 100644
--- a/maven-resolver-synccontext-redisson/src/main/java/org/eclipse/aether/synccontext/RedissonSyncContextFactory.java
+++ b/maven-resolver-synccontext-redisson/src/main/java/org/eclipse/aether/synccontext/RedissonSyncContextFactory.java
@@ -80,8 +80,9 @@ public class RedissonSyncContextFactory
 
     private static final Logger LOGGER = LoggerFactory.getLogger( RedissonSyncContextFactory.class );
 
-    private static RedissonClient redissonClient = createRedissonClient();
-    private static String localhostDiscriminator = createLocalhostDiscriminator();
+    // We are in a singleton so these should exist only once!
+    private RedissonClient redissonClient;
+    private String localhostDiscriminator;
 
     public RedissonSyncContextFactory()
     {
@@ -89,9 +90,11 @@ public class RedissonSyncContextFactory
                       System.identityHashCode( Thread.currentThread().getContextClassLoader() ) );
         LOGGER.trace( "CCL '{}', id '{}'", getClass().getClassLoader(),
                       System.identityHashCode( getClass().getClassLoader() ) );
+        this.redissonClient = createRedissonClient();
+        this.localhostDiscriminator = createLocalhostDiscriminator();
     }
 
-    private static RedissonClient createRedissonClient()
+    private RedissonClient createRedissonClient()
     {
         Path configFilePath = null;
 
@@ -147,7 +150,7 @@ public class RedissonSyncContextFactory
         return redissonClient;
     }
 
-    private static String createLocalhostDiscriminator()
+    private String createLocalhostDiscriminator()
     {
         try
         {