From f4c31b68ef05bd8682d7017a555592fe5659155e Mon Sep 17 00:00:00 2001 From: Stefan Freyr Stefansson Date: Tue, 3 Oct 2023 18:46:52 +0000 Subject: [PATCH] Minor refactoring to unify the names of the Redis cache implementations. --- .../{RedisQuarkusCache.java => QuarkusRedisCache.java} | 6 +++--- .../client/{RedisCache.java => VertxRedisCache.java} | 10 +++++----- .../app/DeviceConnectionInfoProducer.java | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) rename client-device-connection-redis/src/main/java/org/eclipse/hono/deviceconnection/redis/client/{RedisQuarkusCache.java => QuarkusRedisCache.java} (96%) rename client-device-connection-redis/src/main/java/org/eclipse/hono/deviceconnection/redis/client/{RedisCache.java => VertxRedisCache.java} (97%) diff --git a/client-device-connection-redis/src/main/java/org/eclipse/hono/deviceconnection/redis/client/RedisQuarkusCache.java b/client-device-connection-redis/src/main/java/org/eclipse/hono/deviceconnection/redis/client/QuarkusRedisCache.java similarity index 96% rename from client-device-connection-redis/src/main/java/org/eclipse/hono/deviceconnection/redis/client/RedisQuarkusCache.java rename to client-device-connection-redis/src/main/java/org/eclipse/hono/deviceconnection/redis/client/QuarkusRedisCache.java index 34585fe1d9..c623b84643 100644 --- a/client-device-connection-redis/src/main/java/org/eclipse/hono/deviceconnection/redis/client/RedisQuarkusCache.java +++ b/client-device-connection-redis/src/main/java/org/eclipse/hono/deviceconnection/redis/client/QuarkusRedisCache.java @@ -32,8 +32,8 @@ * An implementation of the Redis device connection class using the Quarkus Redis client library. */ //@javax.enterprise.context.ApplicationScoped -public class RedisQuarkusCache implements Cache { - private static final Logger LOG = LoggerFactory.getLogger(RedisCache.class); +public class QuarkusRedisCache implements Cache { + private static final Logger LOG = LoggerFactory.getLogger(QuarkusRedisCache.class); //private final RedisAPI redisApi; private final ReactiveRedisDataSource reactiveRedisDataSource; @@ -43,7 +43,7 @@ public class RedisQuarkusCache implements Cache { * TODO. * @param reactiveRedisDataSource TODO */ - public RedisQuarkusCache(final ReactiveRedisDataSource reactiveRedisDataSource) { + public QuarkusRedisCache(final ReactiveRedisDataSource reactiveRedisDataSource) { //this.redisApi = redisApi; this.reactiveRedisDataSource = reactiveRedisDataSource; valueCommands = reactiveRedisDataSource.value(String.class, String.class); diff --git a/client-device-connection-redis/src/main/java/org/eclipse/hono/deviceconnection/redis/client/RedisCache.java b/client-device-connection-redis/src/main/java/org/eclipse/hono/deviceconnection/redis/client/VertxRedisCache.java similarity index 97% rename from client-device-connection-redis/src/main/java/org/eclipse/hono/deviceconnection/redis/client/RedisCache.java rename to client-device-connection-redis/src/main/java/org/eclipse/hono/deviceconnection/redis/client/VertxRedisCache.java index 413b977267..005634585a 100644 --- a/client-device-connection-redis/src/main/java/org/eclipse/hono/deviceconnection/redis/client/RedisCache.java +++ b/client-device-connection-redis/src/main/java/org/eclipse/hono/deviceconnection/redis/client/VertxRedisCache.java @@ -42,9 +42,9 @@ /** * TODO. */ -public class RedisCache implements Cache, Lifecycle { +public class VertxRedisCache implements Cache, Lifecycle { - private static final Logger LOG = LoggerFactory.getLogger(RedisCache.class); + private static final Logger LOG = LoggerFactory.getLogger(VertxRedisCache.class); private static final int MAX_RECONNECT_RETRIES = 16; @@ -61,7 +61,7 @@ public class RedisCache implements Cache, Lifecycle { * @param vertx TODO. * @param properties TODO. */ - private RedisCache(final Vertx vertx, final RedisRemoteConfigurationProperties properties) { + private VertxRedisCache(final Vertx vertx, final RedisRemoteConfigurationProperties properties) { Objects.requireNonNull(vertx); Objects.requireNonNull(properties); @@ -83,13 +83,13 @@ private RedisCache(final Vertx vertx, final RedisRemoteConfigurationProperties p * * @return TODO. */ - public static RedisCache from( + public static VertxRedisCache from( final Vertx vertx, final RedisRemoteConfigurationProperties properties) { Objects.requireNonNull(vertx); Objects.requireNonNull(properties); - return new RedisCache(vertx, properties); + return new VertxRedisCache(vertx, properties); } @Override diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/app/DeviceConnectionInfoProducer.java b/services/command-router/src/main/java/org/eclipse/hono/commandrouter/app/DeviceConnectionInfoProducer.java index 6fd06d6c31..366cd6aa30 100644 --- a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/app/DeviceConnectionInfoProducer.java +++ b/services/command-router/src/main/java/org/eclipse/hono/commandrouter/app/DeviceConnectionInfoProducer.java @@ -37,9 +37,9 @@ import org.eclipse.hono.deviceconnection.infinispan.client.HotrodCache; import org.eclipse.hono.deviceconnection.infinispan.client.InfinispanRemoteConfigurationOptions; import org.eclipse.hono.deviceconnection.infinispan.client.InfinispanRemoteConfigurationProperties; -import org.eclipse.hono.deviceconnection.redis.client.RedisCache; -import org.eclipse.hono.deviceconnection.redis.client.RedisQuarkusCache; +import org.eclipse.hono.deviceconnection.redis.client.QuarkusRedisCache; import org.eclipse.hono.deviceconnection.redis.client.RedisRemoteConfigurationProperties; +import org.eclipse.hono.deviceconnection.redis.client.VertxRedisCache; import org.eclipse.hono.util.Strings; import org.eclipse.microprofile.config.inject.ConfigProperty; import org.infinispan.configuration.parsing.ConfigurationBuilderHolder; @@ -93,13 +93,13 @@ Cache cache( final String cacheBackend = System.getProperty("cache.backend"); LOG.info("######################### Cache Backend: {}", cacheBackend); if (true) { - return new RedisQuarkusCache(reactiveRedisDataSource); + return new QuarkusRedisCache(reactiveRedisDataSource); } if ("redis".equalsIgnoreCase(cacheBackend)) { LOG.info("Creating a new REDIS cache."); final var p = new RedisRemoteConfigurationProperties(); p.setConnectionString("redis://redis:6379"); - return RedisCache.from(vertx, p); + return VertxRedisCache.from(vertx, p); } else if (Strings.isNullOrEmpty(infinispanCacheConfig.getServerList())) { LOG.info("configuring embedded cache"); return new EmbeddedCache<>(