74 lines
1.2 KiB
Markdown
74 lines
1.2 KiB
Markdown
<header>
|
|
<h1>XF</h1>
|
|
</header>
|
|
|
|
# Services
|
|
|
|
## Reactive
|
|
|
|
``` plantuml
|
|
@startuml
|
|
|
|
participant MainLand as main
|
|
participant Queue as queue
|
|
participant Behavior as behavior
|
|
participant XF as xf
|
|
|
|
main -> behavior: push(event)
|
|
behavior -> queue: add(event)
|
|
|
|
xf -> xf: dispatchEvent()
|
|
activate xf
|
|
xf -> queue : getEvent()
|
|
queue --> xf
|
|
xf -> behavior: processEvent()
|
|
deactivate xf
|
|
|
|
@enduml
|
|
```
|
|
|
|
## Timeout
|
|
``` plantuml
|
|
@startuml
|
|
|
|
participant TimerQueue as tq #cyan
|
|
participant Timeout as t #LawnGreen
|
|
participant TimeoutManager as tm #cyan
|
|
participant EventQueue as eq #cyan
|
|
participant MainLand as main #cyan
|
|
participant Reactive as r #yellow
|
|
|
|
r ->> tm: scheduleTimeout(tmid, evid, duration)
|
|
activate r #magenta
|
|
deactivate r
|
|
|
|
create t
|
|
tm -->> t: <<create>>
|
|
tm ->> tq: add(tm) <<synchronized>>
|
|
tm ->> tq: tick()
|
|
tq ->> t: decrement()
|
|
tm ->> tq: tick()
|
|
tq ->> t: decrement()
|
|
|
|
tm ->> eq: pushEvent(tm) <<synchronized>>
|
|
tm ->> tq: remove(id) <<synchronized>>
|
|
|
|
main ->> eq: popEvent() <<synchronized>>
|
|
activate main #yellow
|
|
eq -->> main: ev
|
|
main ->> t: getTarget()
|
|
t -->> main: reactive
|
|
main ->> r: processEvent(ev)
|
|
activate r #magenta
|
|
r -->> main
|
|
deactivate r
|
|
main -->> t !!: <<destroy>>
|
|
|
|
@enduml
|
|
```
|
|
|
|
## Protection
|
|
- Mutex, sémaphore
|
|
- éviter les conflits mémoire
|
|
|