/
getting-service.puml
55 lines (49 loc) · 1.53 KB
/
getting-service.puml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
@startuml
!include jb-plantuml-theme.puml
:getService;
note right
In any thread.
Get on demand only.
Do not cache result.
Do not request in constructor unless needed.
end note
if (Is [[http://www.jetbrains.org/intellij/sdk/docs/basics/plugin_structure/plugin_services.html?search=ser#light-service Light Service]]) then (yes)
else (no)
if (Is [[http://www.jetbrains.org/intellij/sdk/docs/basics/plugin_structure/plugin_services.html?search=ser#how-to-declare-a-service Service Declaration]] Found) then (yes)
else (no)
:Return ""null"";
detach
endif
endif
if (Is Created and Initialized?) then (yes)
else (no)
if (Is Container Active?) then (active)
partition "synchronized on service class" {
if (Is Created and Initialized?) then (yes)
else (no)
if (Is Initializing?) then (yes)
:Throw ""PluginException""
Cyclic Service Initialization;
detach
else (no)
partition "non cancelable" {
:Create Instance]
note right
Avoid getting other services to reduce initialization tree.
As less dependencies, as more faster and reliable.
end note
:Register to be Disposed on Container Dispose
if Implements ""Disposable""]
:Load Persistent State
if Implements ""PersistentStateComponent""]
}
endif
endif
}
else (disposed or dispose in progress)
:Throw ""ProcessCanceledException"";
detach
endif
endif
:Return Instance;
@enduml