Good morning. I have 2 java modules. Let's call it module A and module B. A module is responsible for pure db interaction. B module is service layer. In B for example on some event which it receive starting flow(Let's imagine it's like step 1, step 2, ..) we creating a context and after some step it's using static method from module A and increment db counter if there is such record or add new.
Problem: In db to this table we need to add 1 more column, it's some id which we can only receive from Context. Each thread have their own context. The program working like: we receiving some event -> INIT(context is created) -> step 1(do smth) and call static method increment from module A The context is passed all over the steps in module B.
In A module there is a place where if i would have my id(which is different per each context) from B, it would work.
increment(Enum, id)
Enum(int id1, int id2, int id3). There is a base interface which each enum is implementing and in each enum class it's creating object and in flow used like increment(EnumRealisation.someObject, int id)
Issue
The obvious way is to overload this static increment in A and add this variable from context where increment is called, the problem is that there is like > 600 calls of this method and we can do this but this is the long way. I'm trying to find the solution that I would be able to keep, pass or autowire somehow my variable from context and retrieve it in module A. Guys, maybe you know some way how can I implement my issue? Or some library.
Aucun commentaire:
Enregistrer un commentaire