You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I checked what factories are flagged with this annotation:
Circuit Breaker Action
HTTP Action
Knot Action
In-Memory Cache Action
Inline Payload Action
Inline Body Action
The stateful action is Circuit Breaker Action.
Other actions are stateless - it means that we would not break the logic by creating new instances each time. We added this annotation for better performance (I am guessing).
There are a few options what we can do:
we remove this annotation and we care about instances in action factories - each factory decides if the new or existing instance is returned
we need to have a cache per action factory instance
custom action implementations are more complex
we duplicate the same code in many places
move the annotation @Singleton to the io.knotx.fragments.action.api.ActionFactory#create method,
it is singleton per "action name", it means that we would get different instances for different action names
it is not easy to guess what is the reason for being singleton - stateful nature or some performance improvements
introduce @Stateful and @Singleton annotations, they would have the same "behaviour" but they will be self-descriptive.
I checked what factories are flagged with this annotation:
Circuit Breaker Action
HTTP Action
Knot Action
In-Memory Cache Action
Inline Payload Action
Inline Body Action
The stateful action is
Circuit Breaker Action
.Other actions are stateless - it means that we would not break the logic by creating new instances each time. We added this annotation for better performance (I am guessing).
There are a few options what we can do:
@Singleton
to theio.knotx.fragments.action.api.ActionFactory#create
method,@Stateful
and@Singleton
annotations, they would have the same "behaviour" but they will be self-descriptive.Originally posted by @tomaszmichalak in #154
The text was updated successfully, but these errors were encountered: