From 65c2a4390051a5d1ffae17474349ac28a0158e50 Mon Sep 17 00:00:00 2001 From: Sn0w3y Date: Sun, 13 Oct 2024 18:47:16 +0200 Subject: [PATCH] Fixed Checkstyle & Renamed File --- ...itializeEdgesWorker.java => EdgeCachingWorker.java} | 10 +++++----- .../metadata/odoo/postgres/PostgresHandler.java | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) rename io.openems.backend.metadata.odoo/src/io/openems/backend/metadata/odoo/postgres/{InitializeEdgesWorker.java => EdgeCachingWorker.java} (93%) diff --git a/io.openems.backend.metadata.odoo/src/io/openems/backend/metadata/odoo/postgres/InitializeEdgesWorker.java b/io.openems.backend.metadata.odoo/src/io/openems/backend/metadata/odoo/postgres/EdgeCachingWorker.java similarity index 93% rename from io.openems.backend.metadata.odoo/src/io/openems/backend/metadata/odoo/postgres/InitializeEdgesWorker.java rename to io.openems.backend.metadata.odoo/src/io/openems/backend/metadata/odoo/postgres/EdgeCachingWorker.java index e36e6860a0..a94af65cf2 100644 --- a/io.openems.backend.metadata.odoo/src/io/openems/backend/metadata/odoo/postgres/InitializeEdgesWorker.java +++ b/io.openems.backend.metadata.odoo/src/io/openems/backend/metadata/odoo/postgres/EdgeCachingWorker.java @@ -17,9 +17,9 @@ import io.openems.backend.metadata.odoo.Field.EdgeDevice; import io.openems.common.utils.ThreadPoolUtils; -public class InitializeEdgesWorker { +public class EdgeCachingWorker { - private final Logger log = LoggerFactory.getLogger(InitializeEdgesWorker.class); + private final Logger log = LoggerFactory.getLogger(EdgeCachingWorker.class); protected final PostgresHandler parent; private final HikariDataSource dataSource; private final Runnable onFinished; @@ -31,14 +31,14 @@ public class InitializeEdgesWorker { */ private final ExecutorService executor = Executors.newSingleThreadExecutor(); - public InitializeEdgesWorker(PostgresHandler parent, HikariDataSource dataSource, Runnable onFinished) { + public EdgeCachingWorker(PostgresHandler parent, HikariDataSource dataSource, Runnable onFinished) { this.parent = parent; this.dataSource = dataSource; this.onFinished = onFinished; } /** - * Starts the {@link InitializeEdgesWorker}. + * Starts the {@link EdgeCachingWorker}. */ public synchronized void start() { this.executor.execute(() -> { @@ -80,7 +80,7 @@ private void runCachingEdgesTask(Connection con) { } /** - * Stops the {@link InitializeEdgesWorker}. + * Stops the {@link EdgeCachingWorker}. */ public synchronized void stop() { // Shutdown executor diff --git a/io.openems.backend.metadata.odoo/src/io/openems/backend/metadata/odoo/postgres/PostgresHandler.java b/io.openems.backend.metadata.odoo/src/io/openems/backend/metadata/odoo/postgres/PostgresHandler.java index dac587b135..337c4ffb53 100644 --- a/io.openems.backend.metadata.odoo/src/io/openems/backend/metadata/odoo/postgres/PostgresHandler.java +++ b/io.openems.backend.metadata.odoo/src/io/openems/backend/metadata/odoo/postgres/PostgresHandler.java @@ -24,7 +24,7 @@ public class PostgresHandler { private final Config config; private final MetadataOdoo parent; private final HikariDataSource dataSource; - private final InitializeEdgesWorker initializeEdgesWorker; + private final EdgeCachingWorker initializeEdgesWorker; private final PeriodicWriteWorker periodicWriteWorker; public PostgresHandler(MetadataOdoo parent, EdgeCache edgeCache, Config config, Runnable onInitialized) @@ -34,7 +34,7 @@ public PostgresHandler(MetadataOdoo parent, EdgeCache edgeCache, Config config, this.dataSource = this.getDataSource(config); this.edge = new PgEdgeHandler(this.dataSource); this.config = config; - this.initializeEdgesWorker = new InitializeEdgesWorker(this, this.dataSource, () -> { + this.initializeEdgesWorker = new EdgeCachingWorker(this, this.dataSource, () -> { onInitialized.run(); }); this.initializeEdgesWorker.start(); @@ -90,7 +90,7 @@ private HikariDataSource getDataSource(Config config) throws SQLException { } public int getRefreshTime() { - return config.refreshTime(); + return this.config.cacheRefreshInterval(); } protected Connection getConnection() throws SQLException {