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/12 17:37:55 UTC

[maven-resolver] 02/02: Max priority for our SyncContextFactory

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 2e78944a673ac7267f9d40abdeb4816f00381797
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Wed Aug 12 19:30:59 2020 +0200

    Max priority for our SyncContextFactory
---
 maven-resolver-synccontext-redisson/pom.xml                 |  5 +++++
 .../aether/synccontext/RedissonSyncContextFactory.java      | 13 +++++++++++--
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/maven-resolver-synccontext-redisson/pom.xml b/maven-resolver-synccontext-redisson/pom.xml
index 333b6ce..618d667 100644
--- a/maven-resolver-synccontext-redisson/pom.xml
+++ b/maven-resolver-synccontext-redisson/pom.xml
@@ -61,6 +61,11 @@
       <optional>true</optional>
     </dependency>
     <dependency>
+    <groupId>javax.annotation</groupId>
+      <artifactId>javax.annotation-api</artifactId>
+      <version>1.3.2</version>
+    </dependency>
+    <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-api</artifactId>
     </dependency>
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 067d600..e3cd170 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
@@ -37,6 +37,10 @@ import java.util.LinkedList;
 import java.util.Map;
 import java.util.TreeSet;
 
+import javax.annotation.Priority;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
 import org.eclipse.aether.RepositorySystemSession;
 import org.eclipse.aether.SyncContext;
 import org.eclipse.aether.artifact.Artifact;
@@ -58,7 +62,11 @@ import org.slf4j.LoggerFactory;
  * if required. <br>
  * This factory is considered experimental and is intended to be used as a singleton.
  */
-public class RedissonSyncContextFactory implements SyncContextFactory
+@Named
+@Priority( Integer.MAX_VALUE )
+@Singleton
+public class RedissonSyncContextFactory
+    implements SyncContextFactory
 {
 
     private static final String DEFAULT_CONFIG_FILE_NAME = "maven-resolver-redisson.yaml";
@@ -149,7 +157,8 @@ public class RedissonSyncContextFactory implements SyncContextFactory
         return new RedissonSyncContext( session, localhostDiscriminator, redissonClient, shared );
     }
 
-    static class RedissonSyncContext implements SyncContext
+    static class RedissonSyncContext
+        implements SyncContext
     {
 
         private static final String CONFIG_DISCRIMINATOR = "aether.syncContext.redisson.discriminator";