Skip to content

Commit

Permalink
Fixed Checkstyle & Renamed File
Browse files Browse the repository at this point in the history
  • Loading branch information
Sn0w3y committed Oct 13, 2024
1 parent d2216e0 commit 65c2a43
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Check warning on line 22 in io.openems.backend.metadata.odoo/src/io/openems/backend/metadata/odoo/postgres/EdgeCachingWorker.java

View check run for this annotation

Codecov / codecov/patch

io.openems.backend.metadata.odoo/src/io/openems/backend/metadata/odoo/postgres/EdgeCachingWorker.java#L22

Added line #L22 was not covered by tests
protected final PostgresHandler parent;
private final HikariDataSource dataSource;
private final Runnable onFinished;
Expand All @@ -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) {

Check warning on line 34 in io.openems.backend.metadata.odoo/src/io/openems/backend/metadata/odoo/postgres/EdgeCachingWorker.java

View check run for this annotation

Codecov / codecov/patch

io.openems.backend.metadata.odoo/src/io/openems/backend/metadata/odoo/postgres/EdgeCachingWorker.java#L34

Added line #L34 was not covered by tests
this.parent = parent;
this.dataSource = dataSource;
this.onFinished = onFinished;
}

/**
* Starts the {@link InitializeEdgesWorker}.
* Starts the {@link EdgeCachingWorker}.
*/
public synchronized void start() {
this.executor.execute(() -> {
Expand Down Expand Up @@ -80,7 +80,7 @@ private void runCachingEdgesTask(Connection con) {
}

Check warning on line 80 in io.openems.backend.metadata.odoo/src/io/openems/backend/metadata/odoo/postgres/EdgeCachingWorker.java

View check run for this annotation

Codecov / codecov/patch

io.openems.backend.metadata.odoo/src/io/openems/backend/metadata/odoo/postgres/EdgeCachingWorker.java#L78-L80

Added lines #L78 - L80 were not covered by tests

/**
* Stops the {@link InitializeEdgesWorker}.
* Stops the {@link EdgeCachingWorker}.
*/
public synchronized void stop() {
// Shutdown executor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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, () -> {

Check warning on line 37 in io.openems.backend.metadata.odoo/src/io/openems/backend/metadata/odoo/postgres/PostgresHandler.java

View check run for this annotation

Codecov / codecov/patch

io.openems.backend.metadata.odoo/src/io/openems/backend/metadata/odoo/postgres/PostgresHandler.java#L36-L37

Added lines #L36 - L37 were not covered by tests
onInitialized.run();
});
this.initializeEdgesWorker.start();
Expand Down Expand Up @@ -90,7 +90,7 @@ private HikariDataSource getDataSource(Config config) throws SQLException {
}

public int getRefreshTime() {
return config.refreshTime();
return this.config.cacheRefreshInterval();

Check warning on line 93 in io.openems.backend.metadata.odoo/src/io/openems/backend/metadata/odoo/postgres/PostgresHandler.java

View check run for this annotation

Codecov / codecov/patch

io.openems.backend.metadata.odoo/src/io/openems/backend/metadata/odoo/postgres/PostgresHandler.java#L93

Added line #L93 was not covered by tests
}

protected Connection getConnection() throws SQLException {
Expand Down

0 comments on commit 65c2a43

Please sign in to comment.