question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JdbcRespository methods Deadlock - Circular dependencies with Hazelcast getMap() in a repository setup.

See original GitHub issue

MN 1.3.3 MN Data 1.0.1 Kotlin 1.3.50

Consider:

@JdbcRepository(dialect = Dialect.H2)
interface MapStoreRepository : CrudRepository<MapObjectEntity, UUID> {

    fun listKey(): List<UUID>
    fun deleteByKeyIn(key: List<UUID>)

}
@Singleton
class H2MapStore(
        private val persistenceRepository: MapStoreRepository
) : MapStore<UUID, HazelcastCrudableObject<UUID>> {

    init {
        println(persistenceRepository.count())
    }

...
    override fun loadAllKeys(): MutableIterable<UUID> {

        println(persistenceRepository.count())

        val keys =  persistenceRepository.listKey().toMutableList()

    }
...
}

If .count() is called in init{}then everything works when loadAllKeys() is called. If the init{} is not there, then when loadAllKeys() is called, it hangs on println(persistenceRepository.count()), where .count() never sees to returned / blocked thread?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:17 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
graemerochercommented, Mar 30, 2020

Might help using lazy (https://kotlinlang.org/docs/reference/delegated-properties.html) on

val mapService = jetService.jet.getMap<K, O>(mapName)

This appears to be being called in the constructor which is initializing parts of hazelcast that then have a circular dependency because it comes back into your H2MapStore:

	at formsmanager.respository.H2MapStore.loadAllKeys(MapPersistence.kt:83)
	at com.hazelcast.map.impl.MapStoreWrapper.loadAllKeys(MapStoreWrapper.java:156)
	at com.hazelcast.map.impl.mapstore.BasicMapStoreContext.loadAllKeys(BasicMapStoreContext.java:169)
	at com.hazelcast.map.impl.MapKeyLoader.sendKeysInBatches(MapKeyLoader.java:416)
0reactions
StephenOTTcommented, Mar 30, 2020

@mmedenjak @graemerocher thank you for your assistance.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Hazelcast MapStore with Spring Boot Data JPA Circular ...
I've implemented com.hazelcast.map.MapLoader , but when I try to run the application it fails to start because of a circular dependency. It ...
Read more >
micronaut-projects/micronaut-data v1.0.2 on GitHub - NewReleases.io
JdbcRespository methods Deadlock - Circular dependencies with Hazelcast getMap() in a repository setup. #464; Access to DialectResolutionInfo cannot be null ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found