This is an automated email from the ASF dual-hosted git repository.
toulmean pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-tuweni.git
The following commit(s) were added to refs/heads/main by this push:
new f93645d Close cache manager (#291)
f93645d is described below
commit f93645dbd1e67ed497f92e3cfd115ed20830c677
Author: sudo-update <[email protected]>
AuthorDate: Mon Jun 28 01:59:12 2021 -0700
Close cache manager (#291)
* Close the DefaultCacheManager
* Closed headersCache
* Gradle Formatting Error
* Removed close headersCache, it shouldn't have been closed
* Fix for proper coding practices
* Formatting
* Ran spottlessApply
Co-authored-by: sudo-update <[email protected]>
---
.../src/main/kotlin/org/apache/tuweni/ethclient/EthereumClient.kt | 6 ++++++
1 file changed, 6 insertions(+)
diff --git
a/eth-client/src/main/kotlin/org/apache/tuweni/ethclient/EthereumClient.kt
b/eth-client/src/main/kotlin/org/apache/tuweni/ethclient/EthereumClient.kt
index ecd8069..f18919c 100644
--- a/eth-client/src/main/kotlin/org/apache/tuweni/ethclient/EthereumClient.kt
+++ b/eth-client/src/main/kotlin/org/apache/tuweni/ethclient/EthereumClient.kt
@@ -75,6 +75,8 @@ class EthereumClient(
private val dnsClients = HashMap<String, DNSClient>()
private val synchronizers = HashMap<String, Synchronizer>()
+ private val managerHandler = mutableListOf<DefaultCacheManager>()
+
suspend fun start() {
logger.info("Starting Ethereum client...")
val metricsService = MetricsService(
@@ -106,6 +108,7 @@ class EthereumClient(
val builder =
GlobalConfigurationBuilder().serialization().marshaller(PersistenceMarshaller())
val manager = DefaultCacheManager(builder.build())
+ managerHandler.add(manager)
val headersCache: Cache<Bytes, Bytes> = manager.createCache(
"headers",
ConfigurationBuilder().persistence().addStore(RocksDBStoreConfigurationBuilder::class.java)
@@ -263,6 +266,9 @@ class EthereumClient(
synchronizers.values.forEach {
it.stop()
}
+ managerHandler.forEach {
+ it.stop()
+ }
AsyncCompletion.allOf(services.values.map(RLPxService::stop)).await()
storageRepositories.values.forEach(BlockchainRepository::close)
metricsService?.close()
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]