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
The chained profile concept outlined in opensmarthouse/opensmarthouse-core#35 which was supplied in this repository have been implemented in 2021 and quickly redesigned in 2022. First and redesigned implementation embedded ThreadLocal to pass invocation which initially worked well.
However, this design have a large drawback of retaining invocation state within a shared object. The main point of it was really to separate creation and invocation time, which could not be shared.
Looking closer at the issue of sharing state, it actually can be bridged between creation and invocation time without ThreadLocal and major multi threading risks. When invocation chain is initialized, chain elements are initialized sequentially. It means that they know own position and can reference chain. In order to simplify invocation, we can also swap use of iterator and rely on chain element index manipulation (+1 from handler to item, -1 from item to handler), in order to avoid direct references.
While I know it sounds very complex, actual change (despite of its size) will result in much simpler code providing the same functionality.
The text was updated successfully, but these errors were encountered:
The chained profile concept outlined in opensmarthouse/opensmarthouse-core#35 which was supplied in this repository have been implemented in 2021 and quickly redesigned in 2022. First and redesigned implementation embedded
ThreadLocal
to pass invocation which initially worked well.However, this design have a large drawback of retaining invocation state within a shared object. The main point of it was really to separate creation and invocation time, which could not be shared.
Looking closer at the issue of sharing state, it actually can be bridged between creation and invocation time without
ThreadLocal
and major multi threading risks. When invocation chain is initialized, chain elements are initialized sequentially. It means that they know own position and can reference chain. In order to simplify invocation, we can also swap use of iterator and rely on chain element index manipulation (+1 from handler to item, -1 from item to handler), in order to avoid direct references.While I know it sounds very complex, actual change (despite of its size) will result in much simpler code providing the same functionality.
The text was updated successfully, but these errors were encountered: