Files
openide/platform/docs/getting-service.puml
Vladimir Krivosheev c74e7ad54c add link: How to Declare a Service
GitOrigin-RevId: 8bbef0ec73fadf03ba8f4ef8cf8663f4fbdb7eff
2020-01-20 18:02:16 +00:00

55 lines
1.5 KiB
Plaintext

@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