hashgraph / hedera-services

Crypto, token, consensus, file, and smart contract services for the Hedera public ledger
Apache License 2.0
313 stars 136 forks source link

Fix static field initialization from a non-static method in the `merkledb` package #15945

Open thenswan opened 3 weeks ago

thenswan commented 3 weeks ago

This is a follow-up for https://github.com/hashgraph/hedera-services/pull/15562. After it will be merged, there will be static field initialization from a non-static method in the following classes:

  1. MerkleDbCompactionCoordinator -- static getCompactionExecutor will be invoked from a non-static method and initialize compactionExecutor.
  2. HalfDiskHashMap -- static getFlushingPool will be invoked from a non-static method and initialize flushingPool.

(more detailed info will be in method-level docs)

The task is to refactor it so that there are no static fields but just instance fields. One option is to turn this static method into MerkleDb instance methods.

artemananiev commented 3 weeks ago

As a part of this ticket, MerkleDb (with its list of instances and data sources) should be moved to PlatformContext, or somehow changed to be one per PlatformContext