mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2024-12-26 00:31:07 -06:00
237 lines
42 KiB
XML
237 lines
42 KiB
XML
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?><!--
|
||
|
- Copyright (c) 2022 nosqlbench
|
||
|
-
|
||
|
- Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
- you may not use this file except in compliance with the License.
|
||
|
- You may obtain a copy of the License at
|
||
|
-
|
||
|
- http://www.apache.org/licenses/LICENSE-2.0
|
||
|
-
|
||
|
- Unless required by applicable law or agreed to in writing, software
|
||
|
- distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
- See the License for the specific language governing permissions and
|
||
|
- limitations under the License.
|
||
|
-->
|
||
|
|
||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentStyleType="text/css" height="4174.3px" preserveAspectRatio="none" style="width:1504px;height:4174px;background:#FFFFFF;" version="1.1" viewBox="0 0 1504 4174" width="1504.8px" zoomAndPan="magnify"><defs/><g><rect fill="none" height="55.229" id="_title" style="stroke:none;stroke-width:1.8999999999999997;" width="309.7" x="589.95" y="19"/><text fill="#000000" font-family="sans-serif" font-size="26.6" font-weight="bold" lengthAdjust="spacing" textLength="290.7" x="599.45" y="56.9353">Lifecycle of an activity</text><rect fill="#FFFFFF" height="245.3243" style="stroke:#181818;stroke-width:1.8999999999999997;" width="19" x="263.15" y="1202.7971"/><rect fill="#FFFFFF" height="904.8677" style="stroke:#181818;stroke-width:1.8999999999999997;" width="19" x="263.15" y="1666.8457"/><rect fill="#FFFFFF" height="343.5657" style="stroke:#181818;stroke-width:1.8999999999999997;" width="19" x="263.15" y="2718.7962"/><rect fill="#FFFFFF" height="528.09" style="stroke:#181818;stroke-width:1.8999999999999997;" width="19" x="263.15" y="3303.3276"/><rect fill="#FFFFFF" height="64.729" style="stroke:#181818;stroke-width:1.8999999999999997;" width="19" x="749.55" y="2122.7357"/><rect fill="#FFFFFF" height="548.5605" style="stroke:#181818;stroke-width:1.8999999999999997;" width="19" x="926.25" y="1983.2528"/><rect fill="#FFFFFF" height="26.6" style="stroke:#181818;stroke-width:1.8999999999999997;" width="19" x="926.25" y="3533.4519"/><rect fill="#FFFFFF" height="26.6" style="stroke:#181818;stroke-width:1.8999999999999997;" width="19" x="926.25" y="3671.0348"/><rect fill="#FFFFFF" height="26.6" style="stroke:#181818;stroke-width:1.8999999999999997;" width="19" x="1260.65" y="1323.28"/><rect fill="#FFFFFF" height="26.6" style="stroke:#181818;stroke-width:1.8999999999999997;" width="19" x="1260.65" y="2948.9205"/><rect fill="none" height="646.2434" style="stroke:#000000;stroke-width:2.8499999999999996;" width="1325.25" x="147.25" y="1900.77"/><rect fill="none" height="124.2829" style="stroke:#000000;stroke-width:2.8499999999999996;" width="913.9" x="147.25" y="3588.5519"/><line style="stroke:#181818;stroke-width:0.9499999999999998;stroke-dasharray:5.0,5.0;" x1="49.4" x2="49.4" y1="255.1162" y2="4004.542"/><line style="stroke:#181818;stroke-width:0.9499999999999998;stroke-dasharray:5.0,5.0;" x1="272.65" x2="272.65" y1="437.9721" y2="4004.542"/><line style="stroke:#181818;stroke-width:0.9499999999999998;stroke-dasharray:5.0,5.0;" x1="609.9" x2="609.9" y1="590.2302" y2="4004.542"/><line style="stroke:#181818;stroke-width:0.9499999999999998;stroke-dasharray:5.0,5.0;" x1="759.05" x2="759.05" y1="778.7173" y2="4004.542"/><line style="stroke:#181818;stroke-width:0.9499999999999998;stroke-dasharray:5.0,5.0;" x1="935.75" x2="935.75" y1="1024.8583" y2="4004.542"/><line style="stroke:#181818;stroke-width:0.9499999999999998;stroke-dasharray:5.0,5.0;" x1="1129.55" x2="1129.55" y1="255.1162" y2="4004.542"/><line style="stroke:#181818;stroke-width:0.9499999999999998;stroke-dasharray:5.0,5.0;" x1="1270.15" x2="1270.15" y1="255.1162" y2="4004.542"/><line style="stroke:#181818;stroke-width:0.9499999999999998;stroke-dasharray:5.0,5.0;" x1="1395.55" x2="1395.55" y1="2119.5588" y2="4004.542"/><text fill="#000000" font-family="sans-serif" font-size="26.6" lengthAdjust="spacing" textLength="70.3" x="9.5" y="247.3224">caller</text><ellipse cx="50.35" cy="188.4871" fill="#E2E2F0" rx="22.8" ry="22.8" style="stroke:#181818;stroke-width:0.9499999999999998;"/><polygon fill="#181818" points="42.75,165.6871,54.15,156.1871,50.35,165.6871,54.15,175.1871,42.75,165.6871" style="stroke:#181818;stroke-width:1.8999999999999997;"/><text fill="#000000" font-family="sans-serif" font-size="26.6" lengthAdjust="spacing" textLength="70.3" x="9.5" y="4031.0772">caller</text><ellipse cx="50.35" cy="4069.271" fill="#E2E2F0" rx="22.8" ry="22.8" style="stroke:#181818;stroke-width:0.9499999999999998;"/><polygon fill="#181818" points="42.75,4046.471,54.15,4036.971,50.35,4046.471,54.15,4055.971,42.75,4046.471"
|
||
|
@startuml
|
||
|
'https://plantuml.com/sequence-diagram
|
||
|
title: Lifecycle of an activity
|
||
|
|
||
|
control caller as caller
|
||
|
control ActivityExecutor as ae
|
||
|
control "Activity\nException\nHandler" as aeh
|
||
|
control "Activity\nThread\nFactory" as atf
|
||
|
control ExecutorService as aes
|
||
|
control Annotator as ann
|
||
|
control Activity as activity
|
||
|
|
||
|
== startup sequence ==
|
||
|
caller -> ae**: create
|
||
|
ae -> aeh**: create
|
||
|
ae -> atf**: create(\w Exception Handler)
|
||
|
aeh -> atf: <injected\nvia ctor>
|
||
|
ae -> aes**: create(\w Thread Factory)
|
||
|
atf -> aes: <injected\nvia ctor>
|
||
|
|
||
|
caller -> ae: startActivity()
|
||
|
activate ae
|
||
|
ae -> ann: Annotate Activity Start
|
||
|
|
||
|
ae -> activity: initActivity()
|
||
|
activate activity
|
||
|
ae <- activity
|
||
|
deactivate activity
|
||
|
|
||
|
note over ae,aes: align threadcount as explained below
|
||
|
|
||
|
caller <- ae
|
||
|
deactivate ae
|
||
|
|
||
|
== dynamic threadcount update ==
|
||
|
note over ae, aes: threads can be changed dynamically
|
||
|
|
||
|
caller -> ae: apply params
|
||
|
activate ae
|
||
|
ae->ae: align motor count
|
||
|
ae->aes: stop extra motors
|
||
|
ae->aes: <start missing motors>
|
||
|
group for each new thread/motor
|
||
|
ae -> aes: execute(<motor>)
|
||
|
activate aes
|
||
|
aes -> atf: get()
|
||
|
atf -> thread**: create
|
||
|
activate atf
|
||
|
aes <- atf: <thread>
|
||
|
deactivate atf
|
||
|
aes - -> thread: run()
|
||
|
note over ann, thread: At this point, the\nmotor thread starts running\nthe defined activity's action\nover cycles
|
||
|
ae->ae: await thread state update
|
||
|
|
||
|
ae<-aes:
|
||
|
deactivate aes
|
||
|
end group
|
||
|
caller <- ae
|
||
|
deactivate ae
|
||
|
|
||
|
== shutdown sequence [after startup] ==
|
||
|
|
||
|
caller -> ae: stopActivity()
|
||
|
activate ae
|
||
|
|
||
|
ae -> ae: request stop motors
|
||
|
ae -> ae: await all stop
|
||
|
|
||
|
ae -> activity: shutdownActivity()
|
||
|
activate activity
|
||
|
ae <- activity
|
||
|
deactivate activity
|
||
|
|
||
|
ae -> ann: Annotate Activity Finish
|
||
|
|
||
|
caller <- ae
|
||
|
deactivate ae
|
||
|
|
||
|
== on exception in motor thread ==
|
||
|
thread -> aeh: catch(<thrown exception>)
|
||
|
aeh -> ae: notifyException\n(<thread>,<throwable>)
|
||
|
activate ae
|
||
|
ae -> ae: save exception
|
||
|
ae -> ae: forceStopActivity()
|
||
|
ae -> aes: shutdown();
|
||
|
activate aes
|
||
|
ae <- aes:
|
||
|
deactivate aes
|
||
|
|
||
|
group if needed [after timeout]]
|
||
|
ae -> aes: shutdownNow();
|
||
|
activate aes
|
||
|
ae <- aes
|
||
|
deactivate aes
|
||
|
end group
|
||
|
|
||
|
ae -> activity: shutdownActivity();
|
||
|
ae -> activity: closeAutoCloseables();
|
||
|
|
||
|
note over thread: action\nthread\nterminates
|
||
|
destroy thread
|
||
|
deactivate ae
|
||
|
|
||
|
|
||
|
@enduml
|
||
|
|
||
|
@startuml
|
||
|
title: Lifecycle of an activity
|
||
|
|
||
|
control caller as caller
|
||
|
control ActivityExecutor as ae
|
||
|
control "Activity\nException\nHandler" as aeh
|
||
|
control "Activity\nThread\nFactory" as atf
|
||
|
control ExecutorService as aes
|
||
|
control Annotator as ann
|
||
|
control Activity as activity
|
||
|
|
||
|
== startup sequence ==
|
||
|
caller -> ae**: create
|
||
|
ae -> aeh**: create
|
||
|
ae -> atf**: create(\w Exception Handler)
|
||
|
aeh -> atf: <injected\nvia ctor>
|
||
|
ae -> aes**: create(\w Thread Factory)
|
||
|
atf -> aes: <injected\nvia ctor>
|
||
|
|
||
|
caller -> ae: startActivity()
|
||
|
activate ae
|
||
|
ae -> ann: Annotate Activity Start
|
||
|
|
||
|
ae -> activity: initActivity()
|
||
|
activate activity
|
||
|
ae <- activity
|
||
|
deactivate activity
|
||
|
|
||
|
note over ae,aes: align threadcount as explained below
|
||
|
|
||
|
caller <- ae
|
||
|
deactivate ae
|
||
|
|
||
|
== dynamic threadcount update ==
|
||
|
note over ae, aes: threads can be changed dynamically
|
||
|
|
||
|
caller -> ae: apply params
|
||
|
activate ae
|
||
|
ae->ae: align motor count
|
||
|
ae->aes: stop extra motors
|
||
|
ae->aes: <start missing motors>
|
||
|
group for each new thread/motor
|
||
|
ae -> aes: execute(<motor>)
|
||
|
activate aes
|
||
|
aes -> atf: get()
|
||
|
atf -> thread**: create
|
||
|
activate atf
|
||
|
aes <- atf: <thread>
|
||
|
deactivate atf
|
||
|
aes - -> thread: run()
|
||
|
note over ann, thread: At this point, the\nmotor thread starts running\nthe defined activity's action\nover cycles
|
||
|
ae->ae: await thread state update
|
||
|
|
||
|
ae<-aes:
|
||
|
deactivate aes
|
||
|
end group
|
||
|
caller <- ae
|
||
|
deactivate ae
|
||
|
|
||
|
== shutdown sequence [after startup] ==
|
||
|
|
||
|
caller -> ae: stopActivity()
|
||
|
activate ae
|
||
|
|
||
|
ae -> ae: request stop motors
|
||
|
ae -> ae: await all stop
|
||
|
|
||
|
ae -> activity: shutdownActivity()
|
||
|
activate activity
|
||
|
ae <- activity
|
||
|
deactivate activity
|
||
|
|
||
|
ae -> ann: Annotate Activity Finish
|
||
|
|
||
|
caller <- ae
|
||
|
deactivate ae
|
||
|
|
||
|
== on exception in motor thread ==
|
||
|
thread -> aeh: catch(<thrown exception>)
|
||
|
aeh -> ae: notifyException\n(<thread>,<throwable>)
|
||
|
activate ae
|
||
|
ae -> ae: save exception
|
||
|
ae -> ae: forceStopActivity()
|
||
|
ae -> aes: shutdown();
|
||
|
activate aes
|
||
|
ae <- aes:
|
||
|
deactivate aes
|
||
|
|
||
|
group if needed [after timeout]]
|
||
|
ae -> aes: shutdownNow();
|
||
|
activate aes
|
||
|
ae <- aes
|
||
|
deactivate aes
|
||
|
end group
|
||
|
|
||
|
ae -> activity: shutdownActivity();
|
||
|
ae -> activity: closeAutoCloseables();
|
||
|
|
||
|
note over thread: action\nthread\nterminates
|
||
|
destroy thread
|
||
|
deactivate ae
|
||
|
|
||
|
|
||
|
@enduml
|
||
|
|
||
|
PlantUML version 1.2022.12(Sun Oct 23 13:12:26 CDT 2022)
|
||
|
(GPL source distribution)
|
||
|
Java Runtime: OpenJDK Runtime Environment
|
||
|
JVM: OpenJDK 64-Bit Server VM
|
||
|
Default Encoding: UTF-8
|
||
|
Language: en
|
||
|
Country: US
|
||
|
--></g></svg>
|