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 `virtualmap` package #15946

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. VirtualNodeCache -- static getCleaningPool will be invoked from a non-static method and initialize cleaningPool.
  2. VirtualHasher -- static getHashingPool will be invoked from a non-static method and initialize hashingPool.

(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.

artemananiev commented 3 weeks ago

One option to fix this is to wait till https://github.com/hashgraph/hedera-services/issues/14395 and make the pools above instance fields rather than static fields. There will be just on VirtualMap (per node), and it will have one hasher and one node cache.