diff --git a/.github/workflows/merge-build.yml b/.github/workflows/merge-build.yml index c715798..e12af43 100644 --- a/.github/workflows/merge-build.yml +++ b/.github/workflows/merge-build.yml @@ -61,6 +61,7 @@ jobs: uses: actions/checkout@v4 with: repository: Commonjava/commonjava-images + ref: ubi9 path: commonjava-images - name: Locate artifacts diff --git a/pom.xml b/pom.xml index cf1ebed..cf4b283 100644 --- a/pom.xml +++ b/pom.xml @@ -122,7 +122,6 @@ io.quarkus quarkus-rest-client-mutiny - io.quarkus quarkus-vertx @@ -132,25 +131,28 @@ indy-model-core-java ${indyModelVersion} - org.keycloak keycloak-core ${keycloakVersion} + org.keycloak keycloak-adapter-core ${keycloakVersion} - - io.quarkus - quarkus-micrometer-registry-prometheus + io.opentelemetry + opentelemetry-sdk - io.quarkus - quarkus-opentelemetry-exporter-otlp + io.micrometer + micrometer-registry-prometheus + + + io.opentelemetry + opentelemetry-semconv @@ -174,14 +176,8 @@ - org.infinispan - infinispan-core-jakarta - ${infinispanVersion} - - - org.infinispan - infinispan-commons-jakarta - ${infinispanVersion} + io.quarkus + quarkus-caffeine com.google.guava diff --git a/src/main/java/org/commonjava/indy/service/httprox/util/CacheProducer.java b/src/main/java/org/commonjava/indy/service/httprox/util/CacheProducer.java index 86e339e..002782d 100644 --- a/src/main/java/org/commonjava/indy/service/httprox/util/CacheProducer.java +++ b/src/main/java/org/commonjava/indy/service/httprox/util/CacheProducer.java @@ -15,44 +15,39 @@ */ package org.commonjava.indy.service.httprox.util; -import org.infinispan.Cache; -import org.infinispan.configuration.cache.ConfigurationBuilder; -import org.infinispan.manager.DefaultCacheManager; -import org.infinispan.manager.EmbeddedCacheManager; - +import com.github.benmanes.caffeine.cache.Cache; +import com.github.benmanes.caffeine.cache.Caffeine; import jakarta.annotation.PostConstruct; import jakarta.enterprise.context.ApplicationScoped; + import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.TimeUnit; @ApplicationScoped public class CacheProducer { - private EmbeddedCacheManager cacheManager; - private Map caches = new ConcurrentHashMap<>(); @PostConstruct public void start() { - startEmbeddedManager(); - } - private void startEmbeddedManager() - { - cacheManager = new DefaultCacheManager(); } public synchronized Cache getCache( String named ) { - return caches.computeIfAbsent( named, ( k ) -> buildCache(named)); + return caches.computeIfAbsent( named, ( k ) -> buildCache()); } - private Cache buildCache(String named) + private Cache buildCache() { - cacheManager.defineConfiguration( named, new ConfigurationBuilder().build() ); - return cacheManager.getCache(named, Boolean.TRUE); + Cache cache = Caffeine.newBuilder() + .maximumSize( 50 ) + .expireAfterAccess(15, TimeUnit.MINUTES) + .build(); + return cache; } diff --git a/src/main/java/org/commonjava/indy/service/httprox/util/ProxyResponseHelper.java b/src/main/java/org/commonjava/indy/service/httprox/util/ProxyResponseHelper.java index 879151e..2ffc1d7 100644 --- a/src/main/java/org/commonjava/indy/service/httprox/util/ProxyResponseHelper.java +++ b/src/main/java/org/commonjava/indy/service/httprox/util/ProxyResponseHelper.java @@ -33,7 +33,7 @@ import org.commonjava.indy.service.httprox.handler.ProxyCreationResult; import org.commonjava.indy.service.httprox.handler.ProxyRepositoryCreator; import org.commonjava.indy.service.httprox.model.TrackingKey; -import org.infinispan.Cache; +import com.github.benmanes.caffeine.cache.Cache; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -151,9 +151,9 @@ private ArtifactStore doGetArtifactStore(String trackingId, final URL url ) if ( trackingId != null ) { - if ( cache.get( groupName ) != null ) + if ( cache.getIfPresent( groupName ) != null ) { - return (ArtifactStore) cache.get( groupName ); + return (ArtifactStore) cache.getIfPresent( groupName ); } Group group = null; @@ -165,7 +165,7 @@ private ArtifactStore doGetArtifactStore(String trackingId, final URL url ) if ( response != null && response.getStatus() == HttpStatus.SC_OK ) { group = (Group)response.readEntity(ArtifactStore.class); - cache.put(groupName, group, 15, TimeUnit.MINUTES); + cache.put(groupName, group); } } catch ( WebApplicationException e ) @@ -176,7 +176,7 @@ private ArtifactStore doGetArtifactStore(String trackingId, final URL url ) url, trackingId ); ProxyCreationResult result = createRepo( trackingId, url, null ); group = result.getGroup(); - cache.put(groupName, group, 15, TimeUnit.MINUTES); + cache.put(groupName, group); return group; } else