-
Notifications
You must be signed in to change notification settings - Fork 1
/
hmily.drawio
1217 lines (1217 loc) · 248 KB
/
hmily.drawio
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<mxfile host="Electron" modified="2024-05-22T06:51:47.260Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/21.6.5 Chrome/114.0.5735.243 Electron/25.3.1 Safari/537.36" etag="gSk5xuZ3THxorFIbDKeI" version="21.6.5" type="device" pages="2">
<diagram name="hmily" id="uB3T4hW82Nwa9GDvWSnv">
<mxGraphModel dx="3682" dy="702" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="ILePiL2lHhwXlFeLtQY4-19" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.75;entryDx=0;entryDy=0;fillColor=#dae8fc;strokeColor=#6c8ebf;" edge="1" parent="1" source="ILePiL2lHhwXlFeLtQY4-14" target="YnnrP53jlHVHSCE78MQg-6">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="3100" y="3000" />
<mxPoint x="3100" y="1940" />
<mxPoint x="1220" y="1940" />
<mxPoint x="1220" y="1485" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="YnnrP53jlHVHSCE78MQg-5" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="YnnrP53jlHVHSCE78MQg-2" target="b_DPwCItqDpnZili3_qI-9" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="1450" y="2480" />
<mxPoint x="1450" y="1920" />
<mxPoint x="500" y="1920" />
<mxPoint x="500" y="830" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-1" value="<h1 style="font-size: 18px;"><font style="font-size: 18px;">Hmily TCC 模式工作原理流程</font></h1><div style="font-size: 12px;"><div style=""><font style="font-size: 12px;">源码版本:2.1.2</font></div></div><div style="font-size: 12px;">测试DEMO: hmily/hmily-demo/hmily-demo-tcc/hmily-demo-tcc-grpc (源码下载下来调下参数就可以执行,直接在源码中调试吧)</div><div style=""><span style="font-size: 12px;">前置知识:</span><b style="font-size: 12px;">TCC理论</b><span style="font-size: 12px;">、</span><b style="font-size: 12px;">Disruptor、</b><span style="background-color: initial;"><b style=""><font style="font-size: 12px;">LogNet/grpc-spring-boot-starter、JUC&nbsp;</font></b></span><b style="background-color: initial;"><font style="font-size: 12px;">ConcurrentSkipListMap、common-lang3 MethodUtils</font></b></div><div style=""><b style="background-color: initial;"><br></b></div><div style="font-size: 12px;">这是一个 SpringBoot 项目;创建了<b>3个数据库,分别有一张表</b>, 使用Mybatis访问数据表;系统包含3个服务(订单、库存、账户,服务间通过 grpc 通信,订单服务是前台服务),模拟购买商品下单、扣库存、支付扣款流程。</div><div style="font-size: 12px;"><br></div>" style="text;html=1;strokeColor=none;fillColor=none;spacing=5;spacingTop=-20;whiteSpace=wrap;overflow=hidden;rounded=0;fontSize=16;" parent="1" vertex="1">
<mxGeometry x="40" y="10" width="820" height="130" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-6" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="b_DPwCItqDpnZili3_qI-2" target="b_DPwCItqDpnZili3_qI-5" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-2" value="业务事务处理" style="rounded=1;whiteSpace=wrap;html=1;fontSize=11;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="40" y="560" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-3" value="OrderController" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=11;" parent="1" vertex="1">
<mxGeometry x="330" y="530" width="100" height="30" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-60" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="b_DPwCItqDpnZili3_qI-4" target="b_DPwCItqDpnZili3_qI-59" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-4" value="Hmily事务管理器初始化" style="rounded=1;whiteSpace=wrap;html=1;fontSize=11;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="40" y="160" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-8" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;fontSize=11;" parent="1" source="b_DPwCItqDpnZili3_qI-5" target="b_DPwCItqDpnZili3_qI-7" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-5" value="orderService.orderPay(count, amount)<br style="font-size: 11px;"><font color="#007fff" style="font-size: 11px;">count 是商品数量,amount是支付金额</font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=11;" parent="1" vertex="1">
<mxGeometry x="280" y="560" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-12" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;fontSize=11;" parent="1" source="b_DPwCItqDpnZili3_qI-7" target="b_DPwCItqDpnZili3_qI-11" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-88" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;dashed=1;" parent="1" source="b_DPwCItqDpnZili3_qI-7" target="b_DPwCItqDpnZili3_qI-86" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="620" y="660" />
<mxPoint x="380" y="660" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-143" value="<font color="#007fff">切面代理类</font>" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="b_DPwCItqDpnZili3_qI-88" vertex="1" connectable="0">
<mxGeometry x="-0.9512" y="1" relative="1" as="geometry">
<mxPoint x="-1" y="-1" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-7" value="Order order = saveOrder(count, amount);" style="rounded=1;whiteSpace=wrap;html=1;fontSize=11;" parent="1" vertex="1">
<mxGeometry x="520" y="560" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-15" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="b_DPwCItqDpnZili3_qI-9" target="b_DPwCItqDpnZili3_qI-14" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-45" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="b_DPwCItqDpnZili3_qI-9" target="b_DPwCItqDpnZili3_qI-44" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-46" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="b_DPwCItqDpnZili3_qI-9" target="b_DPwCItqDpnZili3_qI-43" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-9" value="@<b>HmilyTCC</b>(confirmMethod = "confirmOrderStatus", cancelMethod = "cancelOrderStatus")<br>paymentService.<b>makePayment</b>(order);" style="rounded=1;whiteSpace=wrap;html=1;fontSize=11;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="520" y="800" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-11" value="<b>orderMapper</b>.<b>save</b>(order);" style="rounded=1;whiteSpace=wrap;html=1;fontSize=11;" parent="1" vertex="1">
<mxGeometry x="760" y="560" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-13" value="OrderServiceImpl" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=11;" parent="1" vertex="1">
<mxGeometry x="565" y="530" width="110" height="30" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-17" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="b_DPwCItqDpnZili3_qI-14" target="b_DPwCItqDpnZili3_qI-16" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-14" value="order.setStatus(orderStatus.getCode());<br><b>orderMapper</b>.<b>update</b>(order);<br><font color="#007fff">订单服务本地修改订单<br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=11;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="760" y="800" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-19" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="b_DPwCItqDpnZili3_qI-16" target="b_DPwCItqDpnZili3_qI-18" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-23" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="b_DPwCItqDpnZili3_qI-16" target="b_DPwCItqDpnZili3_qI-20" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-16" value="accountClient.<b>payment</b>(<br>String.valueOf(order.getUserId()), String.valueOf(order.getTotalAmount()<br>.doubleValue()));<br><font color="#007fff">RPC调用扣减账户余额</font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=11;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="760" y="880" width="200" height="80" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-25" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="b_DPwCItqDpnZili3_qI-18" target="b_DPwCItqDpnZili3_qI-24" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-18" value="inventoryClient.<b>decrease</b>(<br>order.getProductId(), order.getCount());<br><font color="#007fff">RPC调用扣减库存,事务的处理和<br>账户服务扣减余额一样,不细讲了<br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=11;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="759.75" y="1110" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-27" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;" parent="1" source="b_DPwCItqDpnZili3_qI-20" target="b_DPwCItqDpnZili3_qI-26" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-28" value="..." style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="b_DPwCItqDpnZili3_qI-27" vertex="1" connectable="0">
<mxGeometry x="-0.0244" y="-2" relative="1" as="geometry">
<mxPoint y="-2" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="YnnrP53jlHVHSCE78MQg-9" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.75;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="b_DPwCItqDpnZili3_qI-20" target="YnnrP53jlHVHSCE78MQg-6" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="1220" y="935" />
<mxPoint x="1220" y="1470" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-20" value="AccountResponse response = <b style="font-size: 10px;">grpcHmilyClient</b>.<b style="font-size: 10px;">syncInvoke</b>(<br style="font-size: 10px;"><b>accountServiceBlockingStub</b>, "payment", request, AccountResponse.class);" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;fillColor=#d5e8d4;strokeColor=#82b366;" parent="1" vertex="1">
<mxGeometry x="1000" y="890" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-24" value="InventoryResponse response = <b>grpcHmilyClient</b>.<b>syncInvoke</b>(<br style="font-size: 10px;"><b>inventoryServiceBlockingStub</b>, "decrease", request, InventoryResponse.class);" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;fillColor=#d5e8d4;strokeColor=#82b366;" parent="1" vertex="1">
<mxGeometry x="999.75" y="1110" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-35" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="b_DPwCItqDpnZili3_qI-26" target="b_DPwCItqDpnZili3_qI-34" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-4" value="..." style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="b_DPwCItqDpnZili3_qI-35" vertex="1" connectable="0">
<mxGeometry x="-0.0873" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-26" value="accountServiceBeanImpl<br style="font-size: 11px;">.<b>payment</b>(accountDTO)" style="rounded=1;whiteSpace=wrap;html=1;fontSize=11;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="1480.75" y="890" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-30" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;dashed=1;" parent="1" source="b_DPwCItqDpnZili3_qI-24" target="b_DPwCItqDpnZili3_qI-32" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="1209.75" y="1139.5" as="sourcePoint" />
<mxPoint x="1250.75" y="1139.5" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-31" value="..." style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="b_DPwCItqDpnZili3_qI-30" vertex="1" connectable="0">
<mxGeometry x="-0.0244" y="-2" relative="1" as="geometry">
<mxPoint y="-2" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-48" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="b_DPwCItqDpnZili3_qI-32" target="b_DPwCItqDpnZili3_qI-47" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-10" value="..." style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="b_DPwCItqDpnZili3_qI-48" vertex="1" connectable="0">
<mxGeometry x="-0.2521" y="-1" relative="1" as="geometry">
<mxPoint x="5" y="-1" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-32" value="inventoryServiceBean<br>.<b>decrease</b>(inventoryDTO)" style="rounded=1;whiteSpace=wrap;html=1;fontSize=11;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="1480" y="1110" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-33" value="AccountServiceImpl" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=11;" parent="1" vertex="1">
<mxGeometry x="1520.75" y="860" width="120" height="30" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-37" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;" parent="1" source="b_DPwCItqDpnZili3_qI-34" target="b_DPwCItqDpnZili3_qI-36" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-40" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;dashed=1;" parent="1" source="b_DPwCItqDpnZili3_qI-34" target="b_DPwCItqDpnZili3_qI-39" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-34" value="<div>@<b>HmilyTCC</b>(confirmMethod = "<b>confirm</b>", cancelMethod = "<b>cancel</b>")</div><div>public boolean payment(AccountDTO accountDTO) {</div><div>&nbsp; &nbsp; return accountMapper.<b>update</b>(accountDTO) &gt; 0;</div><div>}</div><div><font color="#007fff">扣减账户余额, balance 扣减</font></div>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=11;align=left;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="1719.75" y="880" width="440" height="80" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-36" value="@Transactional(rollbackFor = Exception.class) <font color="#007fff">//</font><div><div>public boolean <b>confirm</b>(AccountDTO accountDTO) {</div><div>&nbsp; &nbsp; accountMapper.<b>confirm</b>(accountDTO);</div><div><span style="background-color: initial;">&nbsp; &nbsp; return Boolean.TRUE;</span></div><div>}</div></div><div><font color="#007fff">确认付款,将freeze_amount(用于回滚)也进行扣减</font></div>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=11;align=left;fillColor=#fff2cc;strokeColor=#d6b656;arcSize=9;" parent="1" vertex="1">
<mxGeometry x="2199.75" y="880" width="440" height="80" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-39" value="<div>@Transactional(rollbackFor = Exception.class)</div><div>public boolean <b>cancel</b>(AccountDTO accountDTO) {</div><div>&nbsp; &nbsp; final AccountDO accountDO = accountMapper.<b>findByUserId</b>(</div><div><span style="white-space: pre;">	</span>accountDTO.getUserId());</div><div>&nbsp; &nbsp; accountMapper.<b>cancel</b>(accountDTO);</div><div>&nbsp; &nbsp; return Boolean.TRUE;</div><div>}</div><div><font color="#007fff">取消付款,将 balance 加回去,freeze_amount 减掉</font></div>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=11;align=left;fillColor=#fff2cc;strokeColor=#d6b656;arcSize=10;" parent="1" vertex="1">
<mxGeometry x="2199.75" y="980" width="440" height="100" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-42" value="<font color="#007fff">这一步其实是控制的<b>修改订单</b>操作,<br>后面扣款、扣库存其实管不到</font>" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="520" y="865" width="220" height="40" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-43" value="<div style="">public void <b>confirmOrderStatus</b>(Order order) {</div><div style="">&nbsp; &nbsp; updateOrderStatus(order, OrderStatusEnum.<b>PAY_SUCCESS</b>);</div>}<br><font color="#007fff">Confirm阶段,确认订单支付成功</font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=11;fillColor=#fff2cc;strokeColor=#d6b656;align=left;" parent="1" vertex="1">
<mxGeometry x="759.75" y="640" width="440.25" height="60" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-44" value="<div>public void <b>cancelOrderStatus</b>(Order order) {</div><div>&nbsp; &nbsp; updateOrderStatus(order, OrderStatusEnum.<b>PAY_FAIL</b>);</div><div>}</div><font color="#007fff">Cancel阶段,取消订单支付成功(支付失败)</font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=11;fillColor=#fff2cc;strokeColor=#d6b656;align=left;" parent="1" vertex="1">
<mxGeometry x="760" y="720" width="440" height="60" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-52" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;dashed=1;" parent="1" source="b_DPwCItqDpnZili3_qI-47" target="b_DPwCItqDpnZili3_qI-50" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-53" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;dashed=1;" parent="1" source="b_DPwCItqDpnZili3_qI-47" target="b_DPwCItqDpnZili3_qI-51" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-47" value="<div>@<b>HmilyTCC</b>(confirmMethod = "<b>confirmMethod</b>", cancelMethod = "<b>cancelMethod</b>")</div><div>&nbsp; &nbsp; public boolean decrease(InventoryDTO inventoryDTO) {</div><div>&nbsp; &nbsp; return inventoryMapper.<b>decrease</b>(inventoryDTO) &gt; 0;</div><div>}</div><div>扣减库存, total_inventory 扣减</div>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=11;fillColor=#fff2cc;strokeColor=#d6b656;align=left;" parent="1" vertex="1">
<mxGeometry x="1719.75" y="1100" width="440" height="80" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-49" value="InventoryServiceImpl" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=11;" parent="1" vertex="1">
<mxGeometry x="1515.75" y="1080" width="130" height="30" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-50" value="<div>public Boolean <b>confirmMethod</b>(InventoryDTO inventoryDTO) {</div><div>&nbsp; &nbsp; inventoryMapper.confirm(inventoryDTO);</div><div>&nbsp; &nbsp; return true;</div><div>}</div><div><font color="#007fff">确认扣减库存, 将 lock_inventory (用于回滚) 也进行扣减</font></div>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=11;align=left;fillColor=#fff2cc;strokeColor=#d6b656;arcSize=9;" parent="1" vertex="1">
<mxGeometry x="2199.75" y="1100" width="440" height="80" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-51" value="<div><div>public Boolean <b>cancelMethod</b>(InventoryDTO inventoryDTO) {</div><div>&nbsp; &nbsp; inventoryMapper.cancel(inventoryDTO);</div><div>&nbsp; &nbsp; return true;</div><div>}</div></div><div><font color="#007fff">取消扣减库存,将 total_inventory 加回去,lock_inventory 减掉</font></div>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=11;align=left;fillColor=#fff2cc;strokeColor=#d6b656;arcSize=10;" parent="1" vertex="1">
<mxGeometry x="2199.75" y="1200" width="440" height="80" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-54" value="<div><font color="#007fff">insert into `order` (create_time,number,status,product_id,total_amount,count,user_id)&nbsp;</font></div><div><font color="#007fff">" values ( #{createTime},#{number},#{status},#{productId},#{totalAmount},#{count},#{userId})</font></div>" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="970" y="570" width="510" height="40" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-55" value="<font color="#007fff">update `order` set status = #{status}&nbsp; where number = #{number}</font>" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="1210" y="655" width="370" height="30" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-56" value="<font color="#007fff">update `order` set status = #{status}&nbsp; where number = #{number}</font>" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="960" y="815" width="370" height="30" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-57" value="<font color="#007fff">update `order` set status = #{status}&nbsp; where number = #{number}</font>" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="1210" y="735" width="370" height="30" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-87" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;dashed=1;" parent="1" source="b_DPwCItqDpnZili3_qI-58" target="b_DPwCItqDpnZili3_qI-86" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-58" value="Hmily事务管理器协调" style="rounded=1;whiteSpace=wrap;html=1;fontSize=11;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="40" y="1960" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-62" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="b_DPwCItqDpnZili3_qI-59" target="b_DPwCItqDpnZili3_qI-61" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-72" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="b_DPwCItqDpnZili3_qI-59" target="b_DPwCItqDpnZili3_qI-64" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-59" value="<b>hmily-spring-boot-starter-grpc<br><font color="#007fff">这个是引入的核心组件</font><br></b>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=11;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="280" y="160" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-71" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="b_DPwCItqDpnZili3_qI-61" target="b_DPwCItqDpnZili3_qI-70" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-61" value="继承:<br><b>hmily-spring-boot-starter<br></b>依赖:<br><b>hmily-spring-boot-starter-parent<br></b>hmily-grpc" style="rounded=1;whiteSpace=wrap;html=1;fontSize=11;align=left;" parent="1" vertex="1">
<mxGeometry x="520" y="150" width="200" height="80" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-69" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="b_DPwCItqDpnZili3_qI-64" target="b_DPwCItqDpnZili3_qI-68" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-64" value="<span style="font-weight: normal;"><span>GrpcHmilyConfiguration</span><br><span><font color="#007fff">自动配置类,仅仅创建一个Bean</font></span></span>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=11;fillColor=#dae8fc;strokeColor=#6c8ebf;fontStyle=1" parent="1" vertex="1">
<mxGeometry x="520" y="240" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-68" value="<b>@Bean&nbsp;GrpcHmilyClient<br><font color="#007fff">Grpc客户端</font></b><span style="font-family: &quot;JetBrains Mono&quot;, monospace; font-size: 9.8pt; background-color: rgb(43, 43, 43); color: rgb(169, 183, 198);"></span>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=11;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="760" y="240" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-74" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="b_DPwCItqDpnZili3_qI-70" target="b_DPwCItqDpnZili3_qI-73" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-79" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="b_DPwCItqDpnZili3_qI-70" target="b_DPwCItqDpnZili3_qI-75" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-80" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="b_DPwCItqDpnZili3_qI-70" target="b_DPwCItqDpnZili3_qI-78" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-70" value="HmilyAutoConfiguration<br><div style=""><font color="#007fff">hmily-spring-boot-starter-parent</font></div><div style=""><font color="#007fff">中的自动配置类</font></div>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=11;align=center;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="760" y="160" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-85" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;" parent="1" source="b_DPwCItqDpnZili3_qI-73" target="b_DPwCItqDpnZili3_qI-84" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-73" value="<b style="font-size: 10px;">@Bean <br>SpringHmilyTransactionAspect</b>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="1000" y="160" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-93" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="b_DPwCItqDpnZili3_qI-75" target="b_DPwCItqDpnZili3_qI-92" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-75" value="<b style="font-size: 10px;">@Bean&nbsp;<br></b><b>RefererAnnotationBeanPostProcessor</b><br><font style="" color="#007fff">这是一个BeanPostProcessor</font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="1000" y="240" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-96" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="b_DPwCItqDpnZili3_qI-78" target="b_DPwCItqDpnZili3_qI-95" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="Jgbx7IJgLmi5tVRdjDKV-3" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="b_DPwCItqDpnZili3_qI-78" target="Jgbx7IJgLmi5tVRdjDKV-1" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="Jgbx7IJgLmi5tVRdjDKV-4" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="b_DPwCItqDpnZili3_qI-78" target="Jgbx7IJgLmi5tVRdjDKV-2" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-78" value="<b style="font-size: 10px;">@Bean&nbsp;<br></b><b>HmilyApplicationContextAware</b><br><font color="#007fff">实现 ApplicationContextAware, BeanFactoryPostProcessor<br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="999.75" y="320" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-108" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;endArrow=open;endFill=0;" parent="1" source="b_DPwCItqDpnZili3_qI-81" target="b_DPwCItqDpnZili3_qI-107" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-81" value="<p style="margin: 4px 0px 0px; text-align: center; font-size: 11px;"><b style="font-size: 11px;">AbstractHmilyTransactionAspect (A)</b><br style="font-size: 11px;"></p><hr style="font-size: 11px;"><p style="margin: 0px 0px 0px 4px; font-size: 11px;"><font style="font-size: 11px;" color="#007fff"><b style="font-size: 11px;">Hmily切面抽象类,</b>实现了Hmily切面注解(@HmilyTCC、@HmilyTAC)拦截的全部逻辑</font></p><p style="margin: 0px 0px 0px 4px; font-size: 11px;"><font color="#007fff" style="font-size: 11px;"><b style="font-size: 11px;">切点</b>为 @HmilyTCC 或 @HmilyTAC 注解的方法</font></p><p style="margin: 0px 0px 0px 4px; font-size: 11px;"><br style="font-size: 11px;"></p><p style="margin: 0px 0px 0px 4px; font-size: 11px;"><font color="#007fff" style="font-size: 11px;">//切面拦截器,拦截逻辑都在这里面定义</font></p><p style="margin: 0px 0px 0px 4px; font-size: 11px;">private final <b style="font-size: 11px;">HmilyTransactionInterceptor</b> <b style="font-size: 11px;">interceptor</b> = new HmilyGlobalInterceptor();<br style="font-size: 11px;"></p><hr style="font-size: 11px;"><p style="margin: 0px 0px 0px 4px; font-size: 11px;"><font color="#007fff" style="font-size: 11px;">//只定义了一个环绕通知,内部调用 inteceptor.invoke() 执行切面拦截逻辑</font></p><p style="margin: 0px 0px 0px 4px; font-size: 11px;">@Around("hmilyInterceptor()")</p><p style="margin: 0px 0px 0px 4px; font-size: 11px;">public Object <b style="font-size: 11px;">interceptTccMethod</b>(final ProceedingJoinPoint proceedingJoinPoint) throws Throwable</p>" style="verticalAlign=top;align=left;overflow=fill;fontSize=11;fontFamily=Helvetica;html=1;whiteSpace=wrap;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="-480" y="160" width="440" height="200" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-83" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;endArrow=block;endFill=1;" parent="1" source="b_DPwCItqDpnZili3_qI-82" target="b_DPwCItqDpnZili3_qI-81" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-82" value="<p style="margin: 4px 0px 0px; text-align: center; font-size: 11px;"><b style="font-size: 11px;">SpringHmilyTransactionAspect</b><br style="font-size: 11px;"></p><hr style="font-size: 11px;"><p style="margin: 0px 0px 0px 4px; font-size: 11px;"><font color="#007fff" style="font-size: 11px;"><b style="font-size: 11px;">只是额外实现了Ordered接口,并定义了Bean实例化的最高优先级</b></font></p><p style="margin: 0px 0px 0px 4px; font-size: 11px;"><br style="font-size: 11px;"></p><hr style="font-size: 11px;"><p style="margin: 0px 0px 0px 4px; font-size: 11px;"><br style="font-size: 11px;"></p>" style="verticalAlign=top;align=left;overflow=fill;fontSize=11;fontFamily=Helvetica;html=1;whiteSpace=wrap;" parent="1" vertex="1">
<mxGeometry x="-480" y="400" width="440" height="120" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-84" value="<b>HmilyGlobalInterceptor<br><font color="#007fff">这个类的逻辑后面讲事务协调时细说</font><br></b>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="1240.25" y="160" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-98" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="b_DPwCItqDpnZili3_qI-86" target="b_DPwCItqDpnZili3_qI-97" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-86" value="<b>HmilyGlobalInterceptor#invoke</b>(<br>final ProceedingJoinPoint pjp)" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="280" y="1960" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-92" value="<b>SingletonHolder.INST</b><br><b>.register(field.getType(), ref);</b><br><font style="" color="#007fff">后面用到再细看</font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="1240" y="240" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-95" value="<div style="">SpringBeanUtils.INSTANCE.setCfgContext(</div><div style="">(ConfigurableApplicationContext) applicationContext);</div>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="1240" y="320" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-100" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="b_DPwCItqDpnZili3_qI-97" target="b_DPwCItqDpnZili3_qI-99" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-103" value="..." style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="b_DPwCItqDpnZili3_qI-100" vertex="1" connectable="0">
<mxGeometry x="0.5603" y="-1" relative="1" as="geometry">
<mxPoint x="1" y="-11" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-148" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="b_DPwCItqDpnZili3_qI-97" target="b_DPwCItqDpnZili3_qI-147" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-97" value="<span style="font-weight: normal;">HmilyTransactionContext context = parameterLoader.load();</span>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;fontStyle=1" parent="1" vertex="1">
<mxGeometry x="520" y="1960" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-106" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="b_DPwCItqDpnZili3_qI-99" target="b_DPwCItqDpnZili3_qI-105" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-99" value="<span style="font-weight: normal;">MethodSignature signature = (MethodSignature) point.getSignature();</span>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;fontStyle=1" parent="1" vertex="1">
<mxGeometry x="519.75" y="2039.9999999999998" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-104" value="<font color="#007fff" style="font-size: 10px;">代码很容易理解,这里就省略一些不重要的细节</font>" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="280" y="2020" width="230" height="30" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-113" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="b_DPwCItqDpnZili3_qI-105" target="b_DPwCItqDpnZili3_qI-112" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-105" value="<span style="font-weight: normal;">return </span>getRegistry<span style="font-weight: normal;">(signature.getMethod())<br>.</span>select<span style="font-weight: normal;">(context)<br>.</span>handleTransaction(point, context);<br><font color="#007fff">根据事务模式选择对应的 HmilyTransactionHandlerRegistry,再根据上下文选择对应事务处理器,最后处理</font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;fontStyle=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="519.75" y="2120" width="200" height="80" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-107" value="<p style="margin: 4px 0px 0px; text-align: center; font-size: 11px;"><b style="font-size: 11px;">HmilyGlobalInterceptor</b><br style="font-size: 11px;"></p><hr style="font-size: 11px;"><p style="margin: 0px 0px 0px 4px; font-size: 11px;"><font color="#007fff" style="font-size: 11px;"><b style="font-size: 11px;">只是额外实现了Ordered接口,并定义了Bean实例化的最高优先级</b></font></p><p style="margin: 0px 0px 0px 4px; font-size: 11px;"><br style="font-size: 11px;"></p><p style="margin: 0px 0px 0px 4px; font-size: 11px;"><font color="#007fff">//参数加载器</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;">private static RpcParameterLoader <b>parameterLoader</b>&nbsp;= (RpcParameterLoader)Optional.ofNullable(<br>&nbsp; &nbsp; ExtensionLoaderFactory.load(<b>RpcParameterLoader</b>.class)).orElse(new LocalParameterLoader());<br style="font-size: 11px;"></p><p style="margin: 0px 0px 0px 4px; font-size: 11px;"><font color="#007fff" style="font-size: 11px;">//Hmily支持 TCC TAC XA三种模式,每种模式对应一种分布式事务管理器实现(HmilyTransactionHandlerRegistry)</font></p><p style="margin: 0px 0px 0px 4px; font-size: 11px;">private static final EnumMap&lt;TransTypeEnum, <b style="font-size: 11px;">HmilyTransactionHandlerRegistry</b>&gt; <span style="font-size: 11px;"><span style="font-size: 11px;">&nbsp;&nbsp;&nbsp;&nbsp;</span></span><b style="font-size: 11px;">REGISTRY</b> = new EnumMap&lt;&gt;(TransTypeEnum.class);<br style="font-size: 11px;"></p><hr style="font-size: 11px;"><p style="margin: 0px 0px 0px 4px; font-size: 11px;">public Object invoke(final ProceedingJoinPoint pjp) throws Throwable&nbsp;<br style="font-size: 11px;"></p>" style="verticalAlign=top;align=left;overflow=fill;fontSize=11;fontFamily=Helvetica;html=1;whiteSpace=wrap;" parent="1" vertex="1">
<mxGeometry x="-1000" y="160" width="480" height="200" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-115" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="b_DPwCItqDpnZili3_qI-112" target="b_DPwCItqDpnZili3_qI-114" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-116" value="<font color="#007fff" style="font-size: 10px;">TransTypeEnum<br>.TCC</font>" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="b_DPwCItqDpnZili3_qI-115" vertex="1" connectable="0">
<mxGeometry x="-0.0774" y="-3" relative="1" as="geometry">
<mxPoint x="5" y="-3" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-112" value="<span style="font-weight: 400;">工作模式<br><font color="#007fff">代理模式</font><br></span>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;fontStyle=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="760" y="2130" width="120.25" height="60" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-151" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="b_DPwCItqDpnZili3_qI-114" target="b_DPwCItqDpnZili3_qI-150" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-114" value="HmilyTccTransactionHandlerRegistry#<br>select(context)" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;fontStyle=1;" parent="1" vertex="1">
<mxGeometry x="999.74" y="2130" width="200.26" height="60" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-117" value="<p style="margin: 4px 0px 0px; text-align: center;"><b>HmilyTransactionHandlerRegistry (I)</b><br style="font-size: 11px;"></p><hr style="font-size: 11px;"><p style="margin: 0px 0px 0px 4px; font-size: 11px;"><font color="#007fff"><b>Hmily分布式事务注册器接口</b></font></p><p style="margin: 0px 0px 0px 4px; font-size: 11px;"><br></p><p style="margin: 0px 0px 0px 4px; font-size: 11px;"><font color="#007fff">//获取Hmily事务处理器</font></p><p style="margin: 0px 0px 0px 4px; font-size: 11px;"><span style="background-color: initial;">HmilyTransactionHandler select(HmilyTransactionContext context);</span><br></p>" style="verticalAlign=top;align=left;overflow=fill;fontSize=11;fontFamily=Helvetica;html=1;whiteSpace=wrap;fillColor=#d5e8d4;strokeColor=#82b366;" parent="1" vertex="1">
<mxGeometry x="-1480" y="160" width="440" height="120" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-120" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;endArrow=block;endFill=1;dashed=1;" parent="1" source="b_DPwCItqDpnZili3_qI-118" target="b_DPwCItqDpnZili3_qI-117" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-122" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;endArrow=open;endFill=0;" parent="1" source="b_DPwCItqDpnZili3_qI-118" target="b_DPwCItqDpnZili3_qI-121" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="-1020" y="380" />
<mxPoint x="-1020" y="940" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-118" value="<p style="margin: 4px 0px 0px; text-align: center;"><b>AbstractHmilyTransactionHandlerRegistry (A)</b><br style="font-size: 11px;"></p><hr style="font-size: 11px;"><p style="margin: 0px 0px 0px 4px; font-size: 11px;"><font color="#007fff">//定义了6种角色</font></p><p style="margin: 0px 0px 0px 4px; font-size: 11px;"><font color="#007fff">//TCC用到4种角色,每种角色对应一种事务处理器</font></p><p style="margin: 0px 0px 0px 4px;">private final Map&lt;<b>HmilyRoleEnum</b>, <b>HmilyTransactionHandler</b>&gt; <b>handlers</b> = new EnumMap&lt;&gt;(HmilyRoleEnum.class);<br style="font-size: 11px;"></p><p style="margin: 0px 0px 0px 4px; font-size: 11px;"><br></p><hr style="font-size: 11px;"><p style="margin: 0px 0px 0px 4px; font-size: 11px;"><br style="font-size: 11px;"></p>" style="verticalAlign=top;align=left;overflow=fill;fontSize=11;fontFamily=Helvetica;html=1;whiteSpace=wrap;" parent="1" vertex="1">
<mxGeometry x="-1480" y="320" width="440" height="120" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-123" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;endArrow=block;endFill=1;" parent="1" source="b_DPwCItqDpnZili3_qI-119" target="b_DPwCItqDpnZili3_qI-118" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-119" value="<p style="margin: 4px 0px 0px; text-align: center;"><b>HmilyTccTransactionHandlerRegistry</b><br style="font-size: 11px;"></p><hr style="font-size: 11px;"><p style="margin: 0px 0px 0px 4px;"><font color="#007fff"><b>TCC模式的分布式事务注册器实现,通过&nbsp;</b><span style="background-color: initial;"><b>@HmilySPI("tcc") 加载</b></span></font></p><p style="margin: 0px 0px 0px 4px; font-size: 11px;"><br style="font-size: 11px;"></p><p style="margin: 0px 0px 0px 4px; font-size: 11px;"><br></p><hr style="font-size: 11px;"><p style="margin: 0px 0px 0px 4px; font-size: 11px;"><br style="font-size: 11px;"></p>" style="verticalAlign=top;align=left;overflow=fill;fontSize=11;fontFamily=Helvetica;html=1;whiteSpace=wrap;" parent="1" vertex="1">
<mxGeometry x="-1480" y="480" width="440" height="120" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-121" value="<div style="text-align: center;"><b>HmilyTransactionHandler&nbsp;</b><b style="background-color: initial;">(I)</b></div><hr style="font-size: 11px;"><p style="margin: 0px 0px 0px 4px; font-size: 11px;"><b><font color="#007fff">分布式事务处理器接口</font></b></p><p style="margin: 0px 0px 0px 4px; font-size: 11px;"><br></p><p style="margin: 0px 0px 0px 4px;">Object <b>handleTransaction</b>(ProceedingJoinPoint point, HmilyTransactionContext hmilyTransactionContext) throws Throwable;</p>" style="verticalAlign=top;align=left;overflow=fill;fontSize=11;fontFamily=Helvetica;html=1;whiteSpace=wrap;fillColor=#d5e8d4;strokeColor=#82b366;" parent="1" vertex="1">
<mxGeometry x="-1000" y="880" width="440" height="120" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-133" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="b_DPwCItqDpnZili3_qI-124" target="b_DPwCItqDpnZili3_qI-128" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="420" y="2440" />
<mxPoint x="420" y="2730" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-134" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="b_DPwCItqDpnZili3_qI-124" target="b_DPwCItqDpnZili3_qI-129" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="420" y="2440" />
<mxPoint x="420" y="2830" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-135" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="b_DPwCItqDpnZili3_qI-124" target="b_DPwCItqDpnZili3_qI-131" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="420" y="2440" />
<mxPoint x="420" y="2930" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-124" value="上下文角色" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;fontStyle=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="279.75" y="2410" width="120.01" height="60" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-154" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="b_DPwCItqDpnZili3_qI-126" target="b_DPwCItqDpnZili3_qI-153" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-126" value="StarterHmilyTccTransactionHandler<span style="font-weight: normal;">#<br></span><div><span style="font-weight: normal;">handleTransaction(point, context)</span></div><div><font style="" color="#007fff">事务发起者发起事务</font></div>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;fontStyle=1;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="519.5" y="2280" width="200.26" height="60" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-16" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="b_DPwCItqDpnZili3_qI-128" target="_u3hFmiMN6U5vcW2F68K-15" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="740" y="2730" />
<mxPoint x="740" y="3070" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-128" value="ParticipantHmilyTccTransactionHandler<span style="font-weight: normal;">#<br style="border-color: var(--border-color);"></span><div style="border-color: var(--border-color);"><span style="font-weight: normal;">handleTransaction(point, context)</span></div>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;fontStyle=1;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="520" y="2700" width="200.26" height="60" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-129" value="ConsumeHmilyTccTransactionHandler<span style="font-weight: normal;">#</span><div><span style="font-weight: normal;">handleTransaction(point, context)</span></div><div><span style="font-weight: normal;"><font color="#007fff">方法实现是空的</font></span></div>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;fontStyle=1;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="519.9999999999998" y="2800" width="200.26" height="60" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-131" value="LocalHmilyTccTransactionHandler<span style="font-weight: normal;">#</span><div><span style="font-weight: normal;">handleTransaction(point, context)</span></div><div><span style="font-weight: normal;"><font color="#007fff">方法实现是空的</font></span><br></div>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;fontStyle=1;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="520.2599999999995" y="2900" width="200.26" height="60" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-127" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="b_DPwCItqDpnZili3_qI-124" target="b_DPwCItqDpnZili3_qI-126" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="419.76" y="2440" />
<mxPoint x="419.76" y="2310" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-140" value="HmilyRoleEnum<br>.START" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fontSize=10;fontColor=#007FFF;" parent="b_DPwCItqDpnZili3_qI-127" vertex="1" connectable="0">
<mxGeometry x="0.5421" y="-2" relative="1" as="geometry">
<mxPoint x="7" y="-2" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-138" value="HmilyRoleEnum<br>.CONSUMER" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fontSize=10;fontColor=#007FFF;" parent="b_DPwCItqDpnZili3_qI-127" vertex="1" connectable="0">
<mxGeometry x="0.5421" y="-2" relative="1" as="geometry">
<mxPoint x="7" y="518" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-139" value="HmilyRoleEnum<br>.LOCAL" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fontSize=10;fontColor=#007FFF;" parent="b_DPwCItqDpnZili3_qI-127" vertex="1" connectable="0">
<mxGeometry x="0.5421" y="-2" relative="1" as="geometry">
<mxPoint x="7" y="618" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-137" value="HmilyRoleEnum<br>.PARTICIPANT" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fontSize=10;fontColor=#007FFF;" parent="b_DPwCItqDpnZili3_qI-127" vertex="1" connectable="0">
<mxGeometry x="0.5421" y="-2" relative="1" as="geometry">
<mxPoint x="7" y="418" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-144" value="<div style="text-align: center;"><b>RpcParameterLoader</b><b style="background-color: initial;">&nbsp;(I)</b></div><hr style="font-size: 11px;"><p style="margin: 0px 0px 0px 4px; font-size: 11px;"><font color="#007fff"><b>RPC参数加载器接口,这里的参数是 HmilyTransactionContext</b></font></p><p style="margin: 0px 0px 0px 4px; font-size: 11px;"><br></p><p style="margin: 0px 0px 0px 4px; font-size: 11px;"><font color="#007fff">//获取Hmily事务处理器(从源码可以看到是从<b>线程本地</b>获取 HmilyTransactionContext)</font></p><p style="margin: 0px 0px 0px 4px;">HmilyTransactionContext load();<br></p>" style="verticalAlign=top;align=left;overflow=fill;fontSize=11;fontFamily=Helvetica;html=1;whiteSpace=wrap;fillColor=#d5e8d4;strokeColor=#82b366;" parent="1" vertex="1">
<mxGeometry x="-1480" y="640" width="440" height="80" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-146" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;endArrow=block;endFill=1;dashed=1;" parent="1" source="b_DPwCItqDpnZili3_qI-145" target="b_DPwCItqDpnZili3_qI-144" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-145" value="<p style="margin: 4px 0px 0px; text-align: center;"><b>GrpcParameterLoader</b><br style="font-size: 11px;"></p><hr style="font-size: 11px;"><p style="margin: 0px 0px 0px 4px;"><font color="#007fff"><b>Grpc 参数加载器,</b>通过&nbsp;<span style="background-color: initial;">@HmilySPI("grpc") 加载, 获取 HmilyTranactionContext时,先尝试从 GrpcHmilyContext 获取再尝试从 HmilyTransationHolder 获取</span></font></p><hr style="font-size: 11px;"><p style="margin: 0px 0px 0px 4px; font-size: 11px;"><br style="font-size: 11px;"></p>" style="verticalAlign=top;align=left;overflow=fill;fontSize=11;fontFamily=Helvetica;html=1;whiteSpace=wrap;" parent="1" vertex="1">
<mxGeometry x="-1480" y="760" width="440" height="80" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-147" value="<div><span style="font-weight: normal;">return (HmilyTransactionContext)Optional.ofNullable(</span>RpcMediator<span style="font-weight: normal;">.getInstance().acquire((key) -&gt; {</span></div><div><span style="font-weight: normal;"><font color="#007fff">&nbsp; &nbsp; //key:&nbsp; _HMILY_TRANSACTION_CONTEXT, HmilyContext 是 ThreadLocal&lt;String&gt;</font></span></div><div><span style="font-weight: normal;"><font color="#007fff">&nbsp; &nbsp; //这一句是获取 ThreadLocal&lt;String&gt; 中的字符串</font></span></div><div><span style="font-weight: normal;">&nbsp; &nbsp; return (String)</span>GrpcHmilyContext<span style="font-weight: normal;">.getHmilyContext().get();&nbsp;</span></div><div><span style="font-weight: normal;">})).orElse(HmilyContextHolder.get());</span></div><div><font style="font-weight: normal;" color="#007fff">RpcMediator 获取线程本地的字符串后如果字符串不为空则反序列化为 HmilyTransactionContext 并返回,如果字符串为空则从 HmilyContextHolder 获取</font></div>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=left;fontStyle=1;arcSize=4;" parent="1" vertex="1">
<mxGeometry x="760" y="1950" width="440" height="80" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-149" value="GrpcParameterLoader" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="909.75" y="1920" width="140" height="30" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-152" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="b_DPwCItqDpnZili3_qI-150" target="b_DPwCItqDpnZili3_qI-124" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="1620" y="2160" />
<mxPoint x="1620" y="2240" />
<mxPoint x="260" y="2240" />
<mxPoint x="260" y="2440" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-150" value="<div><span style="font-weight: normal;">if (Objects.</span>isNull<span style="font-weight: normal;">(context)) {</span></div><div><span style="font-weight: normal;">&nbsp; &nbsp; return getHandler(HmilyRoleEnum.</span>START<span style="font-weight: normal;">);</span></div><div><span style="font-weight: normal;">} else {</span></div><div><span style="font-weight: normal;">&nbsp; &nbsp; if (context.getRole() == HmilyRoleEnum.LOCAL.getCode()) {</span></div><div><span style="font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; return getHandler(HmilyRoleEnum.</span>LOCAL<span style="font-weight: normal;">);</span></div><div><span style="font-weight: normal;">&nbsp; &nbsp; } else if (context.getRole() == HmilyRoleEnum.PARTICIPANT.getCode()</span></div><div><span style="font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; || context.getRole() == HmilyRoleEnum.START.getCode()) {</span></div><div><span style="font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; return getHandler(HmilyRoleEnum.</span>PARTICIPANT<span style="font-weight: normal;">);</span></div><div><span style="font-weight: normal;">&nbsp; &nbsp; }</span></div><div><span style="font-weight: normal;">&nbsp; &nbsp; return getHandler(HmilyRoleEnum.</span>CONSUMER<span style="font-weight: normal;">);</span></div><div><span style="font-weight: normal;">}</span></div>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;fontStyle=1;align=left;arcSize=5;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="1239.74" y="2090" width="360.26" height="140" as="geometry" />
</mxCell>
<mxCell id="Jgbx7IJgLmi5tVRdjDKV-11" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="b_DPwCItqDpnZili3_qI-153" target="Jgbx7IJgLmi5tVRdjDKV-9" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="Jgbx7IJgLmi5tVRdjDKV-16" value="1" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="Jgbx7IJgLmi5tVRdjDKV-11" vertex="1" connectable="0">
<mxGeometry x="0.8729" y="-3" relative="1" as="geometry">
<mxPoint x="-2" y="-3" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="YnnrP53jlHVHSCE78MQg-3" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="b_DPwCItqDpnZili3_qI-153" target="YnnrP53jlHVHSCE78MQg-2" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="YnnrP53jlHVHSCE78MQg-4" value="2" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="YnnrP53jlHVHSCE78MQg-3" vertex="1" connectable="0">
<mxGeometry x="0.2242" y="-1" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-62" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="b_DPwCItqDpnZili3_qI-153" target="_u3hFmiMN6U5vcW2F68K-60" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-65" value="3" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="_u3hFmiMN6U5vcW2F68K-62" vertex="1" connectable="0">
<mxGeometry x="0.7888" y="-2" relative="1" as="geometry">
<mxPoint x="-3" y="-2" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-76" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="b_DPwCItqDpnZili3_qI-153" target="_u3hFmiMN6U5vcW2F68K-75" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-77" value="4|5" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="_u3hFmiMN6U5vcW2F68K-76" vertex="1" connectable="0">
<mxGeometry x="0.8789" y="-1" relative="1" as="geometry">
<mxPoint x="-7" y="-1" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-153" value="<div><span style="font-weight: normal;">Object returnValue;</span></div><div><span style="font-weight: normal;">try {</span></div><div><span style="font-weight: normal;">&nbsp; &nbsp; </span><font style="" color="#007fff">//1 事务发起者Try阶段处理(核心就是创建事务实例并持久化)</font></div><div><span style="font-weight: normal;">&nbsp; &nbsp; HmilyTransaction hmilyTransaction = this.</span>executor<span style="font-weight: normal;">.</span>preTry<span style="font-weight: normal;">(point);</span></div><div><span style="font-weight: normal;">&nbsp; &nbsp; try {</span></div><div><span style=""><span style="">&nbsp; <font color="#007fff">&nbsp; &nbsp; &nbsp; </font></span></span><font color="#007fff">//2&nbsp;继续执行业务代码,内部“递归”调用各个参与者 TRY 阶段(TRYING状态</font><font color="#007fff">)处理</font><br></div><div><span style="font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; returnValue = </span>point<span style="font-weight: normal;">.</span>proceed<span style="font-weight: normal;">();</span></div><div><span style="font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; hmilyTransaction.</span>setStatus<span style="font-weight: normal;">(HmilyActionEnum.</span>TRYING<span style="font-weight: normal;">.getCode()); </span><font color="#cc0000">//TRYING 状态</font></div><font style="font-size: 9px;" color="#007fff"><span style=""><span style="white-space: pre;">&nbsp;&nbsp;&nbsp;&nbsp;</span></span>&nbsp;<span style="white-space: pre;">	</span>&nbsp;//3&nbsp;<span style="font-weight: normal;">通过 HmilyRepositoryEventPublish</span></font><font style="font-size: 9px;"><font style="font-size: 9px;" color="#007fff"><span style="font-weight: normal;">er 发布 </span>UPDATE_HMILY_PARTICIPANT_STATUS<span style="font-weight: normal;">、</span><span style="font-weight: normal; white-space: pre;">	</span><br></font><font style="font-weight: normal; font-size: 9px;" color="#007fff">&nbsp;<span style="white-space: pre;">	</span>&nbsp;</font><font style="font-size: 9px;" color="#007fff">UPDATE_HMILY_PARTICIPANT_STATUS</font><font style="font-weight: normal; font-size: 9px;" color="#007fff"> 事件(分别更新事务和发起者的状态)</font></font><div style="font-size: 9px;"><span style="font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;this.</span>executor<span style="font-weight: normal;">.</span>updateStartStatus<span style="font-weight: normal;">(hmilyTransaction);</span></div><div><span style="font-weight: normal;">&nbsp; &nbsp; } catch (Throwable var11) { <font color="#007fff">//业务抛出异常</font></span></div><div><span style="font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; HmilyTransaction currentTransaction = HmilyTransactionHolder.getInstance()</span></div><div><span style="font-weight: normal;"><span style=""><span style="">&nbsp;&nbsp;&nbsp;&nbsp;</span></span>&nbsp; &nbsp; &nbsp; &nbsp; .getCurrentTransaction();</span></div><div><span style="font-weight: normal;"><span style=""><span style="">&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span><span style="">&nbsp;&nbsp;&nbsp;&nbsp;</span><font style="background-color: initial; border-color: var(--border-color);" color="#007fff">//4 取消,内部“递归”调用各个参与者 CANCEL 阶段(CANCELING状态)处理</font></div><div><span style="font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; this.disruptor.getProvider().</span><span style="font-weight: normal;">(() -&gt; {</span></div><div><span style="font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.executor.globalCancel(currentTransaction);</span></div><div><span style="font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; });</span></div><div><span style="font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; throw var11;</span></div><div><span style="font-weight: normal;">&nbsp; &nbsp; }</span></div><div><span style="font-weight: normal;">&nbsp; &nbsp;&nbsp;</span><span style="background-color: initial;"><span style="">&nbsp;&nbsp;&nbsp;&nbsp;</span></span><span style="font-weight: 400;"></span></div><div><div style="border-color: var(--border-color);"><font style="border-color: var(--border-color);" color="#007fff">&nbsp; &nbsp; //5 确认提交,内部“递归”调用各个参与者 CONFIRM 阶段(CONFIRMING状态)处理</font></div></div><div><span style="font-weight: normal;">&nbsp; &nbsp; HmilyTransaction currentTransaction = HmilyTransactionHolder.getInstance()</span></div><div><span style="font-weight: normal;"><span style=""><span style="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span></span>.getCurrentTransaction();</span></div><div><span style="font-weight: normal;">&nbsp; &nbsp; this.disruptor.getProvider().</span>onData<span style="font-weight: normal;">(() -&gt; {</span></div><div><span style="font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; this.executor.</span>globalConfirm<span style="font-weight: normal;">(currentTransaction);</span></div><div><span style="font-weight: normal;">&nbsp; &nbsp; });</span></div><div><span style="font-weight: normal;">} finally {</span></div><div><span style="font-weight: normal;">&nbsp; &nbsp; HmilyContextHolder.remove();</span></div><div><span style="font-weight: normal;">&nbsp; &nbsp; this.executor.remove();<font color="#007fff"> //线程因为是复用的,退出先需要先remove() 防止内存泄漏,因为已经持久化了,这里也就没有存在的必要了</font></span></div><div><span style="font-weight: normal;">}</span></div><div><span style="font-weight: normal;">return returnValue;</span></div>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;fontStyle=1;align=left;arcSize=2;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="759.75" y="2280" width="440" height="400" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-158" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;endArrow=block;endFill=1;dashed=1;" parent="1" source="b_DPwCItqDpnZili3_qI-156" target="b_DPwCItqDpnZili3_qI-121" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="Jgbx7IJgLmi5tVRdjDKV-15" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=-0.003;exitY=0.283;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;endArrow=open;endFill=0;exitPerimeter=0;" parent="1" source="b_DPwCItqDpnZili3_qI-156" target="Jgbx7IJgLmi5tVRdjDKV-14" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="-540" y="1131" />
<mxPoint x="-540" y="1580" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-156" value="<p style="margin: 4px 0px 0px; text-align: center;"><b>StarterHmilyTccTransactionHandler</b><br style="font-size: 11px;"></p><hr style="font-size: 11px;"><p style="margin: 0px 0px 0px 4px; font-size: 11px;"><b><font color="#007fff">分布式事务启动处理器</font></b></p><p style="margin: 0px 0px 0px 4px;"><br></p><p style="margin: 0px 0px 0px 4px;"><font color="#007fff">//里面定义了<b>基于TCC协议的事务处理器流程方法</b>(虽然名字带着Executor但并没有线程池)</font></p><p style="margin: 0px 0px 0px 4px;">private final <b>HmilyTccTransactionExecutor</b> <b>executor</b> = HmilyTccTransactionExecutor</p><p style="margin: 0px 0px 0px 4px;"><span style=""><span style="">&nbsp;&nbsp;&nbsp;&nbsp;</span></span>.getInstance();</p><p style="margin: 0px 0px 0px 4px;"><br></p><p style="margin: 0px 0px 0px 4px;"><span style="background-color: initial;">private HmilyDisruptor&lt;HmilyTransactionTask&gt; <b>disruptor</b>;</span></p><hr style="font-size: 11px;"><p style="margin: 0px 0px 0px 4px;">public HmilyTransaction <b>preTry</b>(ProceedingJoinPoint point)<br style="font-size: 11px;"></p><p style="margin: 0px 0px 0px 4px;">public HmilyParticipant <b>preTryParticipant</b>(HmilyTransactionContext context, ProceedingJoinPoint point)<br></p><p style="margin: 0px 0px 0px 4px;">public void <b>globalConfirm</b>(HmilyTransaction currentTransaction) throws HmilyRuntimeException<br></p><p style="margin: 0px 0px 0px 4px;">public Object <b>participantConfirm</b>(List&lt;HmilyParticipant&gt; hmilyParticipantList, Long selfParticipantId)<br></p><p style="margin: 0px 0px 0px 4px;">public void <b>globalCancel</b>(HmilyTransaction currentTransaction)<br></p><p style="margin: 0px 0px 0px 4px;">public Object <b>participantCancel</b>(List&lt;HmilyParticipant&gt; hmilyParticipants, Long selfParticipantId)<br></p><p style="margin: 0px 0px 0px 4px;">public void <b>updateStartStatus</b>(HmilyTransaction hmilyTransaction)<br></p><p style="margin: 0px 0px 0px 4px;">public void remove()<br></p>" style="verticalAlign=top;align=left;overflow=fill;fontSize=11;fontFamily=Helvetica;html=1;whiteSpace=wrap;" parent="1" vertex="1">
<mxGeometry x="-520" y="1040" width="440" height="320" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-162" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;endArrow=block;endFill=1;dashed=1;" parent="1" source="b_DPwCItqDpnZili3_qI-159" target="b_DPwCItqDpnZili3_qI-121" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-159" value="<p style="margin: 4px 0px 0px; text-align: center;"><b>ParticipantHmilyTccTransactionHandler</b><br style="font-size: 11px;"></p><hr style="font-size: 11px;"><p style="margin: 0px 0px 0px 4px; font-size: 11px;"><b><font color="#007fff">分布式事务参与者处理器</font></b></p><p style="margin: 0px 0px 0px 4px;"><br></p><p style="margin: 0px 0px 0px 4px;">private final <b>HmilyTccTransactionExecutor</b> <b>executor</b> = HmilyTccTransactionExecutor</p><p style="margin: 0px 0px 0px 4px;"><span style=""><span style="">&nbsp;&nbsp;&nbsp;&nbsp;</span></span>.getInstance();</p><hr style="font-size: 11px;"><p style="margin: 0px 0px 0px 4px; font-size: 11px;"><br style="font-size: 11px;"></p>" style="verticalAlign=top;align=left;overflow=fill;fontSize=11;fontFamily=Helvetica;html=1;whiteSpace=wrap;" parent="1" vertex="1">
<mxGeometry x="-1000" y="1040" width="440" height="160" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-163" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;endArrow=block;endFill=1;dashed=1;" parent="1" source="b_DPwCItqDpnZili3_qI-160" target="b_DPwCItqDpnZili3_qI-121" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-160" value="<p style="margin: 4px 0px 0px; text-align: center;"><b>ConsumeHmilyTccTransactionHandler</b><br style="font-size: 11px;"></p><hr style="font-size: 11px;"><p style="margin: 0px 0px 0px 4px; font-size: 11px;"><font style="" color="#007fff"><b>分布式事务消费者处理器,</b>看源码只是调用切点 proceed() 方法,继续执行业务方法</font></p><hr style="font-size: 11px;"><p style="margin: 0px 0px 0px 4px; font-size: 11px;"><br style="font-size: 11px;"></p>" style="verticalAlign=top;align=left;overflow=fill;fontSize=11;fontFamily=Helvetica;html=1;whiteSpace=wrap;" parent="1" vertex="1">
<mxGeometry x="-1480" y="1040" width="440" height="160" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-164" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;endArrow=block;endFill=1;dashed=1;" parent="1" source="b_DPwCItqDpnZili3_qI-161" target="b_DPwCItqDpnZili3_qI-121" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="b_DPwCItqDpnZili3_qI-161" value="<p style="margin: 4px 0px 0px; text-align: center;"><b>LocalHmilyTccTransactionHandler</b><br style="font-size: 11px;"></p><hr style="font-size: 11px;"><p style="margin: 0px 0px 0px 4px; font-size: 11px;"><font style="" color="#007fff"><b>分布式事务本地处理器,</b>看源码只是调用切点 proceed() 和 ConsumeHmilyTccTransactionHandler 一样</font></p><p style="margin: 0px 0px 0px 4px;"><br></p><hr style="font-size: 11px;"><p style="margin: 0px 0px 0px 4px; font-size: 11px;"><br style="font-size: 11px;"></p>" style="verticalAlign=top;align=left;overflow=fill;fontSize=11;fontFamily=Helvetica;html=1;whiteSpace=wrap;" parent="1" vertex="1">
<mxGeometry x="-1960" y="1040" width="440" height="160" as="geometry" />
</mxCell>
<mxCell id="Jgbx7IJgLmi5tVRdjDKV-1" value="<div style=""><span style="background-color: initial;">SingletonHolder.INST.</span><b style="background-color: initial;">register</b><span style="background-color: initial;">(</span></div><div style=""><span style="background-color: initial;">ObjectProvide.class, new SpringBeanProvide());</span></div>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="1240" y="400" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="fOvBRnHRea66At2AQrMF-2" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="Jgbx7IJgLmi5tVRdjDKV-2" target="fOvBRnHRea66At2AQrMF-1" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="Jgbx7IJgLmi5tVRdjDKV-2" value="<div style=""><span style="background-color: initial;">HmilyBootstrap.getInstance().</span><b style="background-color: initial;">start</b><span style="background-color: initial;">();</span><br></div><div style=""><font color="#007fff">后面用到再细看</font><br></div>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="1240" y="480" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="Jgbx7IJgLmi5tVRdjDKV-5" value="<font color="#007fff">Registry 怎么加载的?在哪里注册的事务处理器</font>" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="240" y="2145" width="270" height="30" as="geometry" />
</mxCell>
<mxCell id="Jgbx7IJgLmi5tVRdjDKV-6" value="<font color="#007fff">上下文角色哪里分配的?怎么分配的</font>" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="40" y="2420" width="220" height="30" as="geometry" />
</mxCell>
<mxCell id="Jgbx7IJgLmi5tVRdjDKV-13" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="Jgbx7IJgLmi5tVRdjDKV-9" target="Jgbx7IJgLmi5tVRdjDKV-12" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="Jgbx7IJgLmi5tVRdjDKV-9" value="<span style="font-weight: normal;">HmilyTransaction hmilyTransaction = this.executor.</span>preTry<span style="font-weight: normal;">(point);</span>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;fontStyle=1;" parent="1" vertex="1">
<mxGeometry x="1239.99" y="2280" width="200.26" height="60" as="geometry" />
</mxCell>
<mxCell id="Jgbx7IJgLmi5tVRdjDKV-10" value="HmilyTccTransactionExecutor" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="1610" y="2760" width="180" height="30" as="geometry" />
</mxCell>
<mxCell id="Jgbx7IJgLmi5tVRdjDKV-19" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;fontColor=#007FFF;dashed=1;" parent="1" source="Jgbx7IJgLmi5tVRdjDKV-12" target="Jgbx7IJgLmi5tVRdjDKV-18" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="Jgbx7IJgLmi5tVRdjDKV-20" value="1" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="Jgbx7IJgLmi5tVRdjDKV-19" vertex="1" connectable="0">
<mxGeometry x="0.7943" y="1" relative="1" as="geometry">
<mxPoint y="1" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="Jgbx7IJgLmi5tVRdjDKV-28" value="订阅<br>回调" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fontColor=#007FFF;" parent="Jgbx7IJgLmi5tVRdjDKV-19" vertex="1" connectable="0">
<mxGeometry x="0.0023" y="-1" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="Jgbx7IJgLmi5tVRdjDKV-12" value="<div><span style="background-color: initial; font-weight: normal;"><font style="" color="#007fff">//创建Hmily事务对象(事务ID、事务类型、事务状态)</font></span></div><div><span style="font-weight: normal; background-color: initial;">HmilyTransaction hmilyTransaction = </span><span style="background-color: initial;">createHmilyTransaction</span><span style="background-color: initial;"><span style="font-weight: normal;">(); </span><font style="" color="#cc0000">//PRE_TRY状态</font></span><br></div><div><span style="background-color: initial;"><font style="" color="#007fff">//1 通过 HmilyRepositoryEventPublisher 发布 CREATE_HMILY_TRANSACTION 事件</font></span></div><div><span style="font-weight: normal;">HmilyRepositoryStorage.</span>createHmilyTransaction<span style="font-weight: normal;">(hmilyTransaction);</span></div><div><span style="font-weight: normal;"><font color="#007fff">//创建事务参与者并注册到事务参与者列表</font></span></div><div><span style="font-weight: normal;">HmilyParticipant hmilyParticipant = </span>buildHmilyParticipant<span style="font-weight: normal;">(point, null, null, <span style=""><span style="">&nbsp;&nbsp;&nbsp;&nbsp;</span></span>HmilyRoleEnum.START.getCode(), hmilyTransaction.getTransId());</span></div><div><span style="font-weight: normal;">HmilyRepositoryStorage.createHmilyParticipant(hmilyParticipant);</span></div><div><span style="font-weight: normal;">hmilyTransaction.</span>registerParticipant<span style="font-weight: normal;">(hmilyParticipant);</span></div><font color="#007fff">//保存Hmily事务对象到ThreadLocal&lt;HmilyTransaction&gt;</font><div>HmilyTransactionHolder<span style="font-weight: normal;">.getInstance().</span>set<span style="font-weight: normal;">(hmilyTransaction);</span></div><div><span style="font-weight: normal;"><br></span></div><div><span style="color: rgb(0, 127, 255); background-color: initial;">//创建 Hmily 事务上下文保存在HmilyContextHolder 中的 HmilyContext</span><br></div><div><span style="font-weight: normal;">HmilyTransactionContext context = new </span>HmilyTransactionContext<span style="font-weight: normal;">();</span></div><div><span style="font-weight: normal; background-color: initial;">context.setAction(HmilyActionEnum.TRYING.getCode());</span><br></div><div><span style="font-weight: normal;">context.setTransId(hmilyTransaction.getTransId());</span></div><div><span style="font-weight: normal;">context.setRole(HmilyRoleEnum.START.getCode());</span></div><div><span style="font-weight: normal;">context.setTransType(TransTypeEnum.TCC.name());</span></div><div>HmilyContextHolder<span style="font-weight: normal;">.set(context);</span></div><div><span style="font-weight: normal;">return hmilyTransaction;</span></div>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;fontStyle=1;align=left;arcSize=2;" parent="1" vertex="1">
<mxGeometry x="1480" y="2280" width="440" height="240" as="geometry" />
</mxCell>
<mxCell id="Jgbx7IJgLmi5tVRdjDKV-14" value="<p style="margin: 4px 0px 0px; text-align: center;"><b>HmilyTccTransactionExecutor</b><br style="font-size: 11px;"></p><hr style="font-size: 11px;"><p style="margin: 0px 0px 0px 4px; font-size: 11px;"><font style="" color="#007fff"><b>分布式事务处理执行器,</b>单例模式,内部定义 Tcc 事务各种角色各阶段(Try-Confirm-Cancel)的流程方法</font></p><p style="margin: 0px 0px 0px 4px;"><br></p><hr style="font-size: 11px;"><p style="margin: 0px 0px 0px 4px;"><font color="#007fff">//事务发起者Try阶段(预留)执行</font></p><p style="margin: 0px 0px 0px 4px;">public HmilyTransaction <b>preTry</b>(final ProceedingJoinPoint point)<br style="font-size: 11px;"></p><p style="margin: 0px 0px 0px 4px;"><font color="#007fff">//事务参与者Try阶段执行</font></p><p style="margin: 0px 0px 0px 4px;">public HmilyParticipant <b>preTryParticipant</b>(final HmilyTransactionContext context, final ProceedingJoinPoint point)<br></p><p style="margin: 0px 0px 0px 4px;"><font color="#007fff">//事务发起者Confirm阶段(确认)执行</font></p><p style="margin: 0px 0px 0px 4px;">public void <b>globalConfirm</b>(final HmilyTransaction currentTransaction) throws HmilyRuntimeException<br></p><p style="margin: 0px 0px 0px 4px;"><font color="#007fff">//事务参与者participantConfirm阶段执行</font><br></p><p style="margin: 0px 0px 0px 4px;">public Object <b>participantConfirm</b>(final List&lt;HmilyParticipant&gt; hmilyParticipantList, final Long selfParticipantId)<br></p><p style="margin: 0px 0px 0px 4px;"><font color="#007fff">//事务发起者Cancel阶段(撤销)执行</font></p><p style="margin: 0px 0px 0px 4px;">public void <b>globalCancel</b>(final HmilyTransaction currentTransaction)<br></p><p style="margin: 0px 0px 0px 4px;"><font color="#007fff">//事务参与者Cancel阶段执行</font></p><p style="margin: 0px 0px 0px 4px;">public Object <b>participantCancel</b>(final List&lt;HmilyParticipant&gt; hmilyParticipants, final Long selfParticipantId)<br></p><p style="margin: 0px 0px 0px 4px;">public void <b>updateStartStatus</b>(final HmilyTransaction hmilyTransaction)<br></p><p style="margin: 0px 0px 0px 4px;">public void remove()<br></p>" style="verticalAlign=top;align=left;overflow=fill;fontSize=11;fontFamily=Helvetica;html=1;whiteSpace=wrap;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="-520" y="1400" width="440" height="360" as="geometry" />
</mxCell>
<mxCell id="ILePiL2lHhwXlFeLtQY4-18" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;endArrow=open;endFill=0;" edge="1" parent="1" source="Jgbx7IJgLmi5tVRdjDKV-17" target="_u3hFmiMN6U5vcW2F68K-23">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="Jgbx7IJgLmi5tVRdjDKV-17" value="<p style="margin: 4px 0px 0px; text-align: center;"><b>HmilyTransaction</b><br style="font-size: 11px;"></p><hr style="font-size: 11px;"><p style="margin: 0px 0px 0px 4px; font-size: 11px;"><font style="" color="#007fff"><b>Hmily分布式事务定义</b></font></p><p style="margin: 0px 0px 0px 4px; font-size: 11px;"><font style="" color="#007fff"><b><br></b></font></p><p style="margin: 0px 0px 0px 4px;"><font color="#007fff">//<b>事务ID</b>,看上去是雪花算法实现的UUID</font></p><p style="margin: 0px 0px 0px 4px;">private Long <b>transId</b>;</p><p style="margin: 0px 0px 0px 4px;"><font color="#007fff">//事务发起者应用名称</font></p><p style="margin: 0px 0px 0px 4px;">private String <b>appName</b>;</p><p style="margin: 0px 0px 0px 4px;"><font color="#007fff">//<b>事务的状态</b>,有6种状态:PRE_TRY TRYING CONFIRMING CANCELING DELETE DEATH</font></p><p style="margin: 0px 0px 0px 4px;">private int <b>status</b>;</p><p style="margin: 0px 0px 0px 4px;"><font color="#007fff">//事务类型:TCC TAC XA 等</font></p><p style="margin: 0px 0px 0px 4px;">private String <b>transType</b>;</p><p style="margin: 0px 0px 0px 4px;"><font color="#007fff">//重试次数,默认0,事务异常不重试</font></p><p style="margin: 0px 0px 0px 4px;">private Integer <b>retry</b> = 0;</p><p style="margin: 0px 0px 0px 4px;"><font color="#007fff">//版本号用于mysql优化锁控制?</font></p><p style="margin: 0px 0px 0px 4px;">private Integer <b>version</b> = 1;</p><p style="margin: 0px 0px 0px 4px;"><font color="#007fff">//事务创建时间</font></p><p style="margin: 0px 0px 0px 4px;">private Date <b>createTime</b>;</p><p style="margin: 0px 0px 0px 4px;"><font color="#007fff">//事务更新时间</font></p><p style="margin: 0px 0px 0px 4px;">private Date <b>updateTime</b>;</p><p style="margin: 0px 0px 0px 4px;"><font color="#007fff">//事务参与者集合,包括发起者(START)和参与者(PARTICIPANT)</font></p><p style="margin: 0px 0px 0px 4px;"></p><p style="margin: 0px 0px 0px 4px;">private List&lt;HmilyParticipant&gt; <b>hmilyParticipants</b>;</p><hr style="font-size: 11px;"><p style="margin: 0px 0px 0px 4px;"><br></p>" style="verticalAlign=top;align=left;overflow=fill;fontSize=11;fontFamily=Helvetica;html=1;whiteSpace=wrap;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="-1000" y="1400" width="440" height="320" as="geometry" />
</mxCell>
<mxCell id="Jgbx7IJgLmi5tVRdjDKV-22" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;dashed=1;" parent="1" source="Jgbx7IJgLmi5tVRdjDKV-18" target="Jgbx7IJgLmi5tVRdjDKV-21" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="Jgbx7IJgLmi5tVRdjDKV-18" value="HmilyRepositoryEventConsumer#<br>execute<span style="font-weight: normal;">(final HmilyRepositoryEvent event)</span><br><font color="#007fff">通过 Disruptor 实现的事件发布订阅</font>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;fontStyle=1;" parent="1" vertex="1">
<mxGeometry x="1960" y="2460" width="200.26" height="60" as="geometry" />
</mxCell>
<mxCell id="Jgbx7IJgLmi5tVRdjDKV-24" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="Jgbx7IJgLmi5tVRdjDKV-21" target="Jgbx7IJgLmi5tVRdjDKV-23" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="Jgbx7IJgLmi5tVRdjDKV-21" value="HmilyRepositoryEventDispatcher<br>.getInstance().doDispatch(event);" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;fontStyle=1;" parent="1" vertex="1">
<mxGeometry x="2199.7400000000002" y="2460" width="200.26" height="60" as="geometry" />
</mxCell>
<mxCell id="Jgbx7IJgLmi5tVRdjDKV-26" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="Jgbx7IJgLmi5tVRdjDKV-23" target="Jgbx7IJgLmi5tVRdjDKV-25" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="2560" y="2490" />
<mxPoint x="2560" y="2310" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="Jgbx7IJgLmi5tVRdjDKV-27" value="<font style="font-size: 9px;">CREATE_HMILY_TRANSACTION</font>" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="Jgbx7IJgLmi5tVRdjDKV-26" vertex="1" connectable="0">
<mxGeometry x="-0.087" y="-2" relative="1" as="geometry">
<mxPoint x="78" y="-47" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-28" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="Jgbx7IJgLmi5tVRdjDKV-23" target="_u3hFmiMN6U5vcW2F68K-27" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="2560" y="2490" />
<mxPoint x="2560" y="2390" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-29" value="CREATE_HMILY_PARTICIPANT" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fontSize=9;" parent="_u3hFmiMN6U5vcW2F68K-28" vertex="1" connectable="0">
<mxGeometry x="0.4249" y="-3" relative="1" as="geometry">
<mxPoint x="6" y="-3" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-47" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="Jgbx7IJgLmi5tVRdjDKV-23" target="_u3hFmiMN6U5vcW2F68K-43" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="2560" y="2490" />
<mxPoint x="2560" y="2470" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-48" value="<font style="font-size: 8px;">UPDATE_HMILY_PARTICIPANT_STATUS</font>" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="_u3hFmiMN6U5vcW2F68K-47" vertex="1" connectable="0">
<mxGeometry x="0.2711" y="-3" relative="1" as="geometry">
<mxPoint x="-10" y="-3" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-58" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="Jgbx7IJgLmi5tVRdjDKV-23" target="_u3hFmiMN6U5vcW2F68K-54" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="2560" y="2490" />
<mxPoint x="2560" y="2550" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-59" value="UPDATE_HMILY_TRANSACTION_STATUS" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fontSize=8;" parent="_u3hFmiMN6U5vcW2F68K-58" vertex="1" connectable="0">
<mxGeometry x="0.2932" y="-1" relative="1" as="geometry">
<mxPoint x="2" y="-1" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-73" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="Jgbx7IJgLmi5tVRdjDKV-23" target="_u3hFmiMN6U5vcW2F68K-69" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="2560" y="2490" />
<mxPoint x="2560" y="2630" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="Jgbx7IJgLmi5tVRdjDKV-23" value="事件类型" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;fontStyle=1;" parent="1" vertex="1">
<mxGeometry x="2440" y="2460" width="80" height="60" as="geometry" />
</mxCell>
<mxCell id="Lziyc9L5DbaSJwhcojb9-2" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="Jgbx7IJgLmi5tVRdjDKV-25" target="Lziyc9L5DbaSJwhcojb9-1" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="Jgbx7IJgLmi5tVRdjDKV-25" value="<span style="font-weight: normal;">HmilyRepositoryFacade.getInstance()<br>.</span>createHmilyTransaction<span style="font-weight: normal;">(</span><br><span style="font-weight: normal;">event.getHmilyTransaction());</span><br><font style="" color="#007fff"><span style="font-weight: normal;">HmilyRepository 有多种实现,这里以</span>MySQLRepository<span style="font-weight: normal;">为例</span></font>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;fontStyle=1;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="2720" y="2280" width="200.26" height="60" as="geometry" />
</mxCell>
<mxCell id="YnnrP53jlHVHSCE78MQg-1" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.75;exitDx=0;exitDy=0;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" source="fOvBRnHRea66At2AQrMF-1" target="Jgbx7IJgLmi5tVRdjDKV-12" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="2170" y="545" />
<mxPoint x="2170" y="2260" />
<mxPoint x="1700" y="2260" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="ILePiL2lHhwXlFeLtQY4-27" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="fOvBRnHRea66At2AQrMF-1" target="ILePiL2lHhwXlFeLtQY4-26">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="1940" y="510" />
<mxPoint x="1940" y="280" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="fOvBRnHRea66At2AQrMF-1" value="<div style=""><div>ConfigLoaderServer.load();</div><div>HmilyConfig hmilyConfig = ConfigEnv.getInstance().getConfig(HmilyConfig.class);</div><div>check(hmilyConfig);</div><div>registerProvide();</div><div><font color="#007fff">//初始化一些hmily的数据表等等(Hmily支持多种事务存储方式)</font></div><div>loadHmilyRepository(hmilyConfig);&nbsp;</div><div><font color="#007fff">//启动一些自恢复线程池、基于Disruptor的<b>事件发布器(这是生产者,消费者是注册</b></font><font color="#007fff"><b>HmilyTransactionHandlerRegistry时启动的</b></font><b style="color: rgb(0, 127, 255); background-color: initial;">)</b></div><div>registerAutoCloseable(new <b>HmilyTransactionSelfRecoveryScheduled</b>(), <br>&nbsp; &nbsp; HmilyRepositoryEventPublisher.getInstance());</div><div>initMetrics();</div></div>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=left;arcSize=5;" parent="1" vertex="1">
<mxGeometry x="1480" y="440" width="440" height="140" as="geometry" />
</mxCell>
<mxCell id="fOvBRnHRea66At2AQrMF-3" value="<font color="#007fff"><b>HmilyRepositoryEventPublisher&nbsp;<br>HmilyRepositoryEventConsumer<br>是一组单例模式对象</b></font>" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="1960" y="2520" width="210" height="60" as="geometry" />
</mxCell>
<mxCell id="Lziyc9L5DbaSJwhcojb9-6" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="Lziyc9L5DbaSJwhcojb9-1" target="Lziyc9L5DbaSJwhcojb9-5" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="Lziyc9L5DbaSJwhcojb9-1" value="<span style="font-weight: normal;">checkRows(hmilyRepository<br>.</span>createHmilyTransaction<span style="font-weight: normal;">(hmilyTransaction));</span>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;fontStyle=1;" parent="1" vertex="1">
<mxGeometry x="2960" y="2280" width="200.26" height="60" as="geometry" />
</mxCell>
<mxCell id="Lziyc9L5DbaSJwhcojb9-3" value="<p style="margin: 4px 0px 0px; text-align: center;"><b>HmilyRepositoryFacade</b><br style="font-size: 11px;"></p><hr style="font-size: 11px;"><p style="margin: 0px 0px 0px 4px; font-size: 11px;"><font style="" color="#007fff"><b>Hmily分布式事务持久化门面,支持多种持久化存储</b></font></p><p style="margin: 0px 0px 0px 4px; font-size: 11px;"><font style="" color="#007fff"><b><br></b></font></p><p style="margin: 0px 0px 0px 4px;"><span style="background-color: initial;">private static final HmilyRepositoryFacade INSTANCE = new HmilyRepositoryFacade();</span><br></p><p style="margin: 0px 0px 0px 4px;">private final HmilyConfig hmilyConfig = <br>&nbsp; &nbsp; ConfigEnv.getInstance().getConfig(HmilyConfig.class);<br></p><p style="margin: 0px 0px 0px 4px;"><b><font color="#007fff">//Hmily事务的状态等数据需要持久化存储,这个是持久化接口实例,提供有多种实现,比如MySQL、Redis、ETCD、MongoDB、ZK</font></b></p><p style="margin: 0px 0px 0px 4px;">private HmilyRepository <b>hmilyRepository</b>;<br></p><hr style="font-size: 11px;"><p style="margin: 0px 0px 0px 4px;"><br></p>" style="verticalAlign=top;align=left;overflow=fill;fontSize=11;fontFamily=Helvetica;html=1;whiteSpace=wrap;" parent="1" vertex="1">
<mxGeometry x="-520" y="1800" width="440" height="160" as="geometry" />
</mxCell>
<mxCell id="Lziyc9L5DbaSJwhcojb9-5" value="<div><span style="font-weight: normal;">INSERT INTO </span>hmily_transaction_global<span style="font-weight: normal;"> (trans_id, app_name, status, trans_type,</span></div><div><span style="font-weight: normal;">retry, version, create_time, update_time) VALUES(?, ?, ?, ?, ?, ?, ?, ?)</span></div>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;fontStyle=1;fillColor=#fff2cc;strokeColor=#d6b656;align=left;" parent="1" vertex="1">
<mxGeometry x="3200" y="2280" width="440" height="60" as="geometry" />
</mxCell>
<mxCell id="YnnrP53jlHVHSCE78MQg-2" value="returnValue = point.proceed();" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;fontStyle=1;" parent="1" vertex="1">
<mxGeometry x="1241" y="2450" width="200.26" height="60" as="geometry" />
</mxCell>
<mxCell id="YnnrP53jlHVHSCE78MQg-8" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="YnnrP53jlHVHSCE78MQg-6" target="YnnrP53jlHVHSCE78MQg-7" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="YnnrP53jlHVHSCE78MQg-12" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="YnnrP53jlHVHSCE78MQg-6" target="YnnrP53jlHVHSCE78MQg-11" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="1450" y="1470" />
<mxPoint x="1450" y="1470" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="YnnrP53jlHVHSCE78MQg-6" value="GrpcHmilyTransactionFilter<br><font color="#007fff">Grpc<b>客户端</b>拦截器,实现ClientInterceptor接口,发起RPC调用前执行</font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="1239.74" y="1440" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="YnnrP53jlHVHSCE78MQg-14" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="YnnrP53jlHVHSCE78MQg-7" target="YnnrP53jlHVHSCE78MQg-13" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="YnnrP53jlHVHSCE78MQg-7" value="Grpc Socket 通道" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;fillColor=#d5e8d4;strokeColor=#82b366;gradientColor=#97d077;" parent="1" vertex="1">
<mxGeometry x="1239.74" y="1640" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="YnnrP53jlHVHSCE78MQg-11" value="<div style="font-size: 9px;">public &lt;R, P&gt; ClientCall&lt;R, P&gt; interceptCall(MethodDescriptor&lt;R, P&gt; methodDescriptor, CallOptions callOptions, Channel channel) {</div><div style="font-size: 9px;">&nbsp; &nbsp; final HmilyTransactionContext <b>context</b> = HmilyContextHolder.get();</div><div style="font-size: 9px;">&nbsp; &nbsp; if (!Objects.isNull(context) &amp;&amp; !Objects.isNull(GrpcHmilyContext.getHmilyClass().get())) {</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; String[] clazzNameAndMethod = methodDescriptor.getFullMethodName().split("/");</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; try {</div><div style="font-size: 9px;"><font color="#007fff">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //通过反射从 clazzNameAndMethod 中解析要调用的类 clazz(Stub类)和方法 method</font></div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ...</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (method != null) {</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; final Long participantId = context.getParticipantId();</div><div style="font-size: 9px;"><font color="#007fff"><b>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //创建事务参与者实例,这个不是完整的实例,主要是里面的参与者ID,用于查找持久化后参与者完整的信息</b></font></div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; final HmilyParticipant hmilyParticipant = this.<b>buildParticipant</b>(context);</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Optional.ofNullable(hmilyParticipant).ifPresent((participant) -&gt; {</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; context.<b>setParticipantId</b>(participant.getParticipantId());</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; });</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (context.getRole() == HmilyRoleEnum.PARTICIPANT.getCode()) {</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; context.setParticipantRefId(participantId);</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div><div style="font-size: 9px;"><font color="#007fff">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //调用,TODO</font></div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <b>return</b> new ForwardingClientCall.SimpleForwardingClientCall&lt;R, P&gt;(channel.newCall(methodDescriptor, callOptions)) {</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void start(ClientCall.Listener&lt;P&gt; responseListener, Metadata headers) {</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RpcMediator.getInstance().transmit((key, value) -&gt; {&nbsp; <font color="#007fff">//这里用于<b>将&nbsp;HmilyTransactionContext 序列化为字符串</b></font></div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <b>headers</b>.put(GrpcHmilyContext.<b>HMILY_META_DATA</b>, value); <font color="#007fff">//事务上下文序列化后存入了<b>请求头</b>进行传输</font></div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }, <b>context</b>);</div><div style="font-size: 9px;"><font color="#007fff"><span style=""><span style="white-space: pre;">&nbsp;&nbsp;&nbsp;&nbsp;</span></span><span style=""><span style="white-space: pre;">&nbsp;&nbsp;&nbsp;&nbsp;</span></span><span style=""><span style="white-space: pre;">&nbsp;&nbsp;&nbsp;&nbsp;<span style="white-space: pre;">	</span><span style="white-space: pre;">	</span></span></span>//注册回调并发起调用</font><br></div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; super.<b>start</b>(new ForwardingClientCallListener.SimpleForwardingClientCallListener&lt;P&gt;(responseListener) {</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void <b>onClose</b>(Status status, Metadata trailers) { <font color="#007fff">//TODO 响应回调?</font></div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (status.getCode().value() == Code.OK.value()) { <font color="#007fff">//成功</font></div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (context.getRole() == HmilyRoleEnum.PARTICIPANT.getCode()) {</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; HmilyTransactionHolder.getInstance().<b>registerParticipantByNested</b>(participantId, hmilyParticipant);</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } else {</div><font color="#007fff"><span style="white-space: pre;">	</span><span style="white-space: pre;">	</span><span style="white-space: pre;">	</span><span style="white-space: pre;">	</span><span style="white-space: pre;">	</span>//保存一下这个半成品参与者实例到事务对象的参与者集合</font><div style="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; HmilyTransactionHolder.getInstance().<b style="font-size: 9px;">registerStarterParticipant</b>(hmilyParticipant);&nbsp;</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } else { <font color="#007fff">//失败</font></div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GrpcHmilyContext.getHmilyFailContext().set(true);</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div><div style="font-size: 9px;"><br style="font-size: 9px;"></div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GrpcHmilyContext.removeAfterInvoke();</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; super.onClose(status, trailers);</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }, <b>headers</b>);</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; };</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; } catch (Exception var13) {...}</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; return channel.newCall(methodDescriptor, callOptions);</div><div style="font-size: 9px;">&nbsp; &nbsp; } else {</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; return channel.newCall(methodDescriptor, callOptions);</div><div style="font-size: 9px;">&nbsp; &nbsp; }</div><div style="font-size: 9px;">}</div>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=9;align=left;arcSize=1;" parent="1" vertex="1">
<mxGeometry x="1481.25" y="1200" width="560.01" height="540" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-2" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="YnnrP53jlHVHSCE78MQg-13" target="_u3hFmiMN6U5vcW2F68K-1" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="YnnrP53jlHVHSCE78MQg-13" value="GrpcHmilyServerFilter<br><font color="#007fff">Grpc<b>服务端</b>拦截器</font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="1239.74" y="1810" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-3" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.75;entryDx=0;entryDy=0;" parent="1" source="_u3hFmiMN6U5vcW2F68K-1" target="b_DPwCItqDpnZili3_qI-26" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="1940" y="1840" />
<mxPoint x="1940" y="1750" />
<mxPoint x="1460" y="1750" />
<mxPoint x="1460" y="935" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-1" value="<div style="font-size: 9px;">public &lt;R, P&gt; ServerCall.Listener&lt;R&gt; interceptCall(ServerCall&lt;R, P&gt; serverCall, Metadata&nbsp; <br style="font-size: 9px;"><span style="font-size: 9px;"><span style="">&nbsp;&nbsp;&nbsp;&nbsp;</span></span>metadata, ServerCallHandler&lt;R, P&gt; serverCallHandler) {</div><div style=""><font style="font-size: 9px;" color="#007fff">&nbsp; &nbsp; //这里保存的字符串格式,在HmilyGlobalInterceptor 由 GrpcParameterLoader 反序列化为事务上下文</font><br style="font-size: 9px;"><span style="font-size: 9px; background-color: initial;">&nbsp; &nbsp; <b>GrpcHmilyContext</b>.getHmilyContext().<b>set</b>(metadata.get(GrpcHmilyContext.<b>HMILY_META_DATA</b>));</span></div><div style="font-size: 9px;">&nbsp; &nbsp; return serverCallHandler.<b>startCall</b>(new ForwardingServerCall.SimpleForwardingServerCall&lt;R, P&gt;(serverCall) {</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; public void sendMessage(P message) {</div><div style="font-size: 9px;"><span style="white-space: pre;">	</span>&nbsp; &nbsp; <font color="#007fff">//响应</font><br></div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GrpcHmilyContext.getHmilyContext().remove();</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; super.sendMessage(message);</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; }</div><div style="font-size: 9px;">&nbsp; &nbsp; }, <b>metadata</b>);</div><div style="font-size: 9px;">}</div>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=9;align=left;arcSize=6;" parent="1" vertex="1">
<mxGeometry x="1481.25" y="1760" width="440.01" height="160" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-8" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" source="_u3hFmiMN6U5vcW2F68K-7" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="1701.363636363636" y="930" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-9" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" source="_u3hFmiMN6U5vcW2F68K-7" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="1701.363636363636" y="1130" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-7" value="<div><b><font color="#007fff">这中间同样先经过切面代理处理</font></b></div><div><b><font color="#007fff">HmilyGlobalInterceptor#invoke(final ProceedingJoinPoint pjp)</font></b></div>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="1521.26" y="1000" width="360" height="30" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-11" value="<div><font color="#007fff"><b>Hmily 应用的 6 种角色</b>:</font></div><div><font color="#007fff">START(1, "发起者"),</font></div><div><font color="#007fff">CONSUMER(2, "消费者"),</font></div><div><font color="#007fff">PARTICIPANT(3, "参与者"),</font></div><div><font color="#007fff">LOCAL(4, "本地调用"),</font></div><div><font color="#007fff">INLINE(5, "内嵌RPC调用"),</font></div><div><font color="#007fff">SPRING_CLOUD(6, "SpringCloud");</font></div><div><font color="#007fff"><br></font></div><div><font color="#007fff">TCC模式实际也就只用到 <b>START</b>、<b>PARTICIPANT</b> 两种角色;</font></div>" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="-1000" y="400" width="400" height="140" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-12" value="<font color="#007fff" style="font-size: 10px;">这里的角色判定规则:<br style="font-size: 10px;"></font><div style="font-size: 10px;"><span style="background-color: initial; font-size: 10px;"><font color="#007fff" style="font-size: 10px;">事务上下文是由发起者创建的,事务上下文为null, 当前应用一定是发起者(START);</font></span></div><div style="font-size: 10px;"><font color="#007fff">事务上下文不为空,此事务上下文是传递过来,</font></div><div style="font-size: 10px;"></div><font color="#007fff">如果上下文中角色是 START(发起者调用当前服务)、PARTICIPANT(参与者调用当前服务,即多次嵌套),<br>当前应用一定是参与者(PARTICIPANT);<br>LOCAL -&gt; LOCAL&nbsp; (LOCAL CONSUMER 貌似TCC也并没有用到,看对应的事务处理器实现都是空的)<br>CONSUMER -&gt; CONSUMER<br><br></font>" style="text;html=1;align=left;verticalAlign=top;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="1620" y="2090" width="510" height="110" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-19" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="_u3hFmiMN6U5vcW2F68K-15" target="_u3hFmiMN6U5vcW2F68K-18" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-20" value="1" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="_u3hFmiMN6U5vcW2F68K-19" vertex="1" connectable="0">
<mxGeometry x="0.8975" y="-3" relative="1" as="geometry">
<mxPoint x="-7" y="-3" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-35" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="_u3hFmiMN6U5vcW2F68K-15" target="_u3hFmiMN6U5vcW2F68K-34" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-36" value="3" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="_u3hFmiMN6U5vcW2F68K-35" vertex="1" connectable="0">
<mxGeometry x="0.7756" y="-1" relative="1" as="geometry">
<mxPoint x="-12" y="-1" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-39" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="_u3hFmiMN6U5vcW2F68K-15" target="_u3hFmiMN6U5vcW2F68K-38" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-40" value="4" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="_u3hFmiMN6U5vcW2F68K-39" vertex="1" connectable="0">
<mxGeometry x="0.2139" relative="1" as="geometry">
<mxPoint x="5" y="27" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-15" value="<div><span style="font-weight: normal;">HmilyParticipant hmilyParticipant = null;</span></div><div><span style="font-weight: normal;">switch (HmilyActionEnum.acquireByCode(context.getAction())) {</span></div><div><span style="font-weight: normal;">&nbsp; &nbsp; case </span>TRYING<span style="font-weight: normal;">:</span></div><div><span style="font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; try {</span></div><div><div style=""><font color="#007fff">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //1 事务参与者Try阶段处理</font></div></div><div><span style="font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hmilyParticipant = executor.</span>preTryParticipant<span style="font-weight: normal;">(context, point);</span></div><div><font color="#007fff"><span style=""><span style=""> &nbsp;&nbsp;&nbsp;&nbsp;</span></span>&nbsp; &nbsp; &nbsp; &nbsp; //2 继续执行参与者业务代码</font><br></div><div><span style="font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; final Object proceed = point.</span>proceed<span style="font-weight: normal;">();</span></div><div><span style="font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hmilyParticipant.</span>setStatus<span style="font-weight: normal;">(HmilyActionEnum.</span>TRYING<span style="font-weight: normal;">.getCode()); </span><font color="#cc0000">//TRYING状态</font></div><font style="font-size: 9px;" color="#007fff"><span style=""><span style="">&nbsp;&nbsp;&nbsp;&nbsp;</span></span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//3 通过 HmilyRepositoryEventPublisher 发布UPDATE_HMILY_PARTICIPANT_STATUS&nbsp;事件</font><div style="font-size: 9px;"><span style="font-weight: normal; background-color: initial;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;HmilyRepositoryStorage.</span><span style="background-color: initial;">updateHmilyParticipantStatus</span><span style="font-weight: normal; background-color: initial;">(hmilyParticipant);</span><br></div><div><span style="font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return proceed;</span></div><div><span style="font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; } catch (Throwable throwable) {</span></div><div><span style="font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //if exception ,delete log.</span></div><div><span style="font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (Objects.nonNull(hmilyParticipant)) {</span></div><div><span style="font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; HmilyParticipantCacheManager.getInstance()</span></div><div><span style="font-weight: normal;"><span style=""><span style="">&nbsp;&nbsp;&nbsp;&nbsp;</span></span><span style=""><span style="">&nbsp;&nbsp;&nbsp;&nbsp;</span></span>&nbsp;<span style=""><span style="">&nbsp;&nbsp;&nbsp;&nbsp;</span></span>.</span>removeByKey<span style="font-weight: normal;">(hmilyParticipant.getParticipantId());</span></div><div><span style="font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</span></div><div><font color="#007fff"><span style=""><span style="">&nbsp;&nbsp;&nbsp;&nbsp;</span></span>&nbsp; &nbsp; &nbsp; &nbsp; <font style=""><font size="1">//4 通过 HmilyRepositoryEventPublisher 发布 REMOVE_HMILY_PARTICIPANT&nbsp;事件</font></font><br></font></div><div><span style="font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; HmilyRepositoryStorage.</span>removeHmilyParticipant<span style="font-weight: normal;">(hmilyParticipant);</span></div><div><span style="font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span>throw throwable<span style="font-weight: normal;">; <font color="#007fff">//如果发生异常,先清理再继续抛异常</font></span></div><div><span style="font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; } finally {</span></div><div><span style="font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; HmilyContextHolder.remove();</span></div><div><span style="font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; }</span></div><div><span style="font-weight: normal;">&nbsp; &nbsp; case </span>CONFIRMING<span style="font-weight: normal;">:</span></div><div><span style="font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; MetricsReporter.counterIncrement(LabelNames.TRANSACTION_STATUS, new String[]<br><span style=""><span style="">&nbsp;&nbsp;&nbsp;&nbsp;</span></span><span style=""><span style="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span></span>{TransTypeEnum.TCC.name(), HmilyRoleEnum.PARTICIPANT.name(), <br><span style=""><span style="">&nbsp;&nbsp;&nbsp;&nbsp;</span></span><span style=""><span style="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span></span>HmilyActionEnum.CONFIRMING.name()});</span></div><div><span style="font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; List&lt;HmilyParticipant&gt; confirmList = HmilyParticipantCacheManager.getInstance()</span></div><div><span style="font-weight: normal;"><span style=""><span style="">&nbsp;&nbsp;&nbsp;&nbsp;</span></span><span style=""><span style="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span></span>.get(context.getParticipantId());</span></div><div><span style="font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; return executor.participantConfirm(confirmList, context.getParticipantId());</span></div><div><span style="font-weight: normal;">&nbsp; &nbsp; case </span>CANCELING<span style="font-weight: normal;">:</span></div><div><span style="font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; MetricsReporter.counterIncrement(LabelNames.TRANSACTION_STATUS, new String[]<br><span style=""><span style="">&nbsp;&nbsp;&nbsp;&nbsp;</span></span><span style=""><span style="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span></span>{TransTypeEnum.TCC.name(), HmilyRoleEnum.PARTICIPANT.name(),&nbsp;</span></div><div><span style="font-weight: normal;"><span style=""><span style="">&nbsp;&nbsp;&nbsp;&nbsp;</span></span><span style=""><span style="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span></span>HmilyActionEnum.CANCELING.name()});</span></div><div><span style="font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; List&lt;HmilyParticipant&gt; cancelList = HmilyParticipantCacheManager.getInstance()<br><span style=""><span style="">&nbsp;&nbsp;&nbsp;&nbsp;</span></span><span style=""><span style="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span></span>.get(context.getParticipantId());</span></div><div><span style="font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; return executor.participantCancel(cancelList, context.getParticipantId());</span></div><div><span style="font-weight: normal;">&nbsp; &nbsp; default:</span></div><div><span style="font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; break;</span></div><div><span style="font-weight: normal;">}</span></div><div><span style="font-weight: normal;">Method method = ((MethodSignature) (point.getSignature())).getMethod();</span></div><div><span style="font-weight: normal;">return DefaultValueUtils.getDefaultValue(method.getReturnType());</span></div>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;fontStyle=1;align=left;arcSize=2;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="760" y="2700" width="440" height="540" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-22" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="_u3hFmiMN6U5vcW2F68K-18" target="_u3hFmiMN6U5vcW2F68K-21" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-18" value="<span style="font-weight: normal;">hmilyParticipant = executor.</span>preTryParticipant<span style="font-weight: normal;">(context, point);</span>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;fontStyle=1;" parent="1" vertex="1">
<mxGeometry x="1240.24" y="2830" width="200.26" height="60" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-26" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;dashed=1;" parent="1" source="_u3hFmiMN6U5vcW2F68K-21" target="Jgbx7IJgLmi5tVRdjDKV-18" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-21" value="<div><span style="font-weight: normal;"><font style="font-size: 9px;" color="#007fff">//创建Hmily参与者对象(内部包含事务的基本信息和当前参与者事务控制类和方法以及确认和撤销方法)</font></span></div><font color="#cc0000" size="1">//PRE_TRY状态</font><div><span style="font-weight: normal;">final HmilyParticipant hmilyParticipant = </span>buildHmilyParticipant<span style="font-weight: normal;">(point, context.getParticipantId(),&nbsp; <br>&nbsp; &nbsp; context.getParticipantRefId(), HmilyRoleEnum.PARTICIPANT.getCode(), context.getTransId());</span></div><div></div><span style="font-weight: normal;"><font color="#007fff">//缓存 参与者ID -&gt; 参与者对象 到 HmilyParticipantCacheManager</font></span><div><span style="font-weight: normal;">HmilyTransactionHolder.getInstance().</span>cacheHmilyParticipant<span style="font-weight: normal;">(hmilyParticipant);</span></div><div><div><font color="#007fff">//1 通过 HmilyRepositoryEventPublisher 发布 CREATE_HMILY_PARTICIPANT&nbsp;事件</font></div></div><div><span style="font-weight: normal;">HmilyRepositoryStorage.</span>createHmilyParticipant<span style="font-weight: normal;">(hmilyParticipant);</span></div><div><span style="font-weight: normal;">context.setRole(HmilyRoleEnum.PARTICIPANT.getCode());</span></div><div>HmilyContextHolder<span style="font-weight: normal;">.set(context);</span></div><div><span style="font-weight: normal;">return hmilyParticipant;</span></div>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;fontStyle=1;align=left;arcSize=5;" parent="1" vertex="1">
<mxGeometry x="1480" y="2790" width="440" height="140" as="geometry" />
</mxCell>
<mxCell id="ILePiL2lHhwXlFeLtQY4-17" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=-0.001;exitY=0.923;exitDx=0;exitDy=0;endArrow=open;endFill=0;exitPerimeter=0;" edge="1" parent="1" source="_u3hFmiMN6U5vcW2F68K-23" target="ILePiL2lHhwXlFeLtQY4-16">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-23" value="<p style="margin: 4px 0px 0px; text-align: center;"><b>HmilyParticipant</b><br style="font-size: 11px;"></p><hr style="font-size: 11px;"><p style="margin: 0px 0px 0px 4px; font-size: 11px;"><font style="" color="#007fff"><b>Hmily分布式事务参与者定义,发起者也使用此实例表示</b></font></p><p style="margin: 0px 0px 0px 4px; font-size: 11px;"><font style="" color="#007fff"><b><br></b></font></p><p style="margin: 0px 0px 0px 4px;"><span style="background-color: initial;"><font color="#007fff">//事务参与者应用ID</font></span></p><p style="margin: 0px 0px 0px 4px;"><span style="background-color: initial;">private Long <b>participantId</b>;</span><br></p><p style="margin: 0px 0px 0px 4px;"><font color="#007fff">// ???</font></p><p style="margin: 0px 0px 0px 4px;">private Long participantRefId;</p><p style="margin: 0px 0px 0px 4px;">private Long <b>transId</b>;</p><p style="margin: 0px 0px 0px 4px;"><font color="#007fff">//事务协议类型,比如TCC</font></p><p style="margin: 0px 0px 0px 4px;">private String <b>transType</b>;</p><p style="margin: 0px 0px 0px 4px;"><font color="#007fff">//事务状态</font></p><p style="margin: 0px 0px 0px 4px;">private Integer <b>status</b>;</p><p style="margin: 0px 0px 0px 4px;"><font color="#007fff">//事务参与者应用名称</font></p><p style="margin: 0px 0px 0px 4px;">private String <b>appName</b>;</p><p style="margin: 0px 0px 0px 4px;">private int <b>role</b>;</p><p style="margin: 0px 0px 0px 4px;">private int retry;</p><p style="margin: 0px 0px 0px 4px;"><font color="#007fff">//事务控制的目标类</font></p><p style="margin: 0px 0px 0px 4px;">private String <b>targetClass</b>;</p><p style="margin: 0px 0px 0px 4px;"><font color="#007fff">//事务控制的目标方法</font></p><p style="margin: 0px 0px 0px 4px;">private String <b>targetMethod</b>;</p><p style="margin: 0px 0px 0px 4px;">private String <b>confirmMethod</b>;</p><p style="margin: 0px 0px 0px 4px;">private String <b>cancelMethod</b>;</p><p style="margin: 0px 0px 0px 4px;">private Integer version = 1;</p><p style="margin: 0px 0px 0px 4px;">private Date createTime;</p><p style="margin: 0px 0px 0px 4px;">private Date updateTime;</p><p style="margin: 0px 0px 0px 4px;"><font color="#007fff">//用于后面Confirm Cancel阶段 本地调用、RPC调用</font></p><p style="margin: 0px 0px 0px 4px;">private HmilyInvocation <b>confirmHmilyInvocation</b>;</p><p style="margin: 0px 0px 0px 4px;">private HmilyInvocation <b>cancelHmilyInvocation</b>;</p><hr style="font-size: 11px;"><p style="margin: 0px 0px 0px 4px;"><br></p>" style="verticalAlign=top;align=left;overflow=fill;fontSize=11;fontFamily=Helvetica;html=1;whiteSpace=wrap;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="-1480" y="1400" width="440" height="400" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-24" value="<p style="margin: 4px 0px 0px; text-align: center;"><b>HmilyTransactionHolder</b><br style="font-size: 11px;"></p><hr style="font-size: 11px;"><p style="margin: 0px 0px 0px 4px; font-size: 11px;"><span style="background-color: initial;">private static final HmilyTransactionHolder </span><b style="background-color: initial;">INSTANCE</b><span style="background-color: initial;"> = new HmilyTransactionHolder();</span><br></p><p style="margin: 0px 0px 0px 4px;"><span style="background-color: initial;">private static final ThreadLocal&lt;HmilyTransaction&gt; <b>CURRENT</b> = new ThreadLocal&lt;&gt;();</span></p><hr style="font-size: 11px;"><p style="margin: 0px 0px 0px 4px; font-size: 11px;"><br style="font-size: 11px;"></p>" style="verticalAlign=top;align=left;overflow=fill;fontSize=11;fontFamily=Helvetica;html=1;whiteSpace=wrap;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="-480" y="560" width="440" height="80" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-25" value="<p style="margin: 4px 0px 0px; text-align: center;"><b>HmilyParticipantCacheManager</b><br style="font-size: 11px;"></p><hr style="font-size: 11px;"><p style="margin: 0px 0px 0px 4px;"><font color="#007fff">本质是个Guava 本地缓存,存储 <b>参与者ID -&gt; 参与者对象</b></font></p><p style="margin: 0px 0px 0px 4px;"><br></p><p style="margin: 0px 0px 0px 4px;">private static final HmilyParticipantCacheManager <b>INSTANCE</b> = new <br>&nbsp; &nbsp; HmilyParticipantCacheManager();<br></p><p style="margin: 0px 0px 0px 4px;">private static final LoadingCache&lt;Long, List&lt;HmilyParticipant&gt;&gt; <b>LOADING_CACHE</b> = ...;<br></p><hr style="font-size: 11px;"><p style="margin: 0px 0px 0px 4px; font-size: 11px;"><br style="font-size: 11px;"></p>" style="verticalAlign=top;align=left;overflow=fill;fontSize=11;fontFamily=Helvetica;html=1;whiteSpace=wrap;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="-480" y="680" width="440" height="120" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-31" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="_u3hFmiMN6U5vcW2F68K-27" target="_u3hFmiMN6U5vcW2F68K-30" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-27" value="<span style="font-weight: normal;">HmilyRepositoryFacade.getInstance()<br>.</span>createHmilyParticipant<span style="font-weight: normal;">(<br>event.getHmilyParticipant());</span>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;fontStyle=1;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="2720" y="2360" width="200.26" height="60" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-33" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="_u3hFmiMN6U5vcW2F68K-30" target="_u3hFmiMN6U5vcW2F68K-32" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-30" value="<span style="font-weight: normal;">checkRows(hmilyRepository<br>.</span>createHmilyParticipant<span style="font-weight: normal;">(hmilyParticipant));</span>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;fontStyle=1;" parent="1" vertex="1">
<mxGeometry x="2960" y="2360" width="200.26" height="60" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-32" value="<div><span style="font-weight: normal;">INSERT INTO </span>hmily_transaction_participant<span style="font-weight: normal;"> (participant_id, participant_ref_id, trans_id, trans_type, status, app_name,&nbsp;</span><span style="font-weight: normal; background-color: initial;">role, retry, target_class, target_method, confirm_method, cancel_method, confirm_invocation, cancel_invocation, version, create_time, update_time)</span></div><div><span style="font-weight: normal;">VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ,? , ? , ?, ?)</span></div>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;fontStyle=1;align=left;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="3200" y="2360" width="440" height="60" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-37" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;dashed=1;" parent="1" source="_u3hFmiMN6U5vcW2F68K-34" target="Jgbx7IJgLmi5tVRdjDKV-18" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="1940" y="2970" />
<mxPoint x="1940" y="2490" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-34" value="<div><span style="font-weight: normal;">HmilyRepositoryStorage</span></div><div><span style="font-weight: normal;">.</span>updateHmilyParticipantStatus<span style="font-weight: normal;">(</span></div><div><span style="font-weight: normal;">hmilyParticipant);</span></div><span style="font-weight: 400;"><font color="#007fff" style="font-size: 8px;">发布UPDATE_HMILY_PARTICIPANT_STATUS 事件</font></span>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;fontStyle=1;" parent="1" vertex="1">
<mxGeometry x="1241" y="2940" width="200.26" height="60" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-41" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;dashed=1;" parent="1" source="_u3hFmiMN6U5vcW2F68K-38" target="Jgbx7IJgLmi5tVRdjDKV-18" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="1940" y="3050" />
<mxPoint x="1940" y="2490" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-38" value="<div><span style="font-weight: normal;">HmilyRepositoryStorage</span></div><div><span style="font-weight: normal;">.</span>removeHmilyParticipant<span style="font-weight: normal;">(</span></div><div><span style="font-weight: normal;">hmilyParticipant);</span></div><font color="#007fff" style="font-weight: normal;">发布REMOVE_HMILY_PARTICIPANT&nbsp;事件</font>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;fontStyle=1;" parent="1" vertex="1">
<mxGeometry x="1241" y="3020" width="200.26" height="60" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-42" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="_u3hFmiMN6U5vcW2F68K-43" target="_u3hFmiMN6U5vcW2F68K-45" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-43" value="<span style="font-weight: normal;">HmilyRepositoryFacade.getInstance()</span><br><span style="font-weight: normal;">.</span>updateHmilyParticipantStatus<span style="font-weight: normal;">(<br>hmilyParticipant.getParticipantId(), hmilyParticipant.getStatus());</span>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;fontStyle=1;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="2720" y="2440" width="200.26" height="60" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-44" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="_u3hFmiMN6U5vcW2F68K-45" target="_u3hFmiMN6U5vcW2F68K-46" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-45" value="<span style="font-weight: normal;">checkRows(hmilyRepository<br>.</span>updateHmilyParticipantStatus<span style="font-weight: normal;">(<br>transId, status));</span>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;fontStyle=1;" parent="1" vertex="1">
<mxGeometry x="2960" y="2440" width="200.26" height="60" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-46" value="<span style="font-weight: normal;">update </span>hmily_transaction_participant<span style="font-weight: normal;"> set status=? where participant_id = ?</span>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;fontStyle=1;align=left;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="3200" y="2440" width="440" height="60" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-49" value="<font color="#007fff">参与者事务控制的代码发生异常,<br>怎么向事务发起者反馈以及触发撤销操作的?</font>" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="40" y="2710" width="260" height="40" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-51" value="HmilyTccTransactionExecutor" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="1611.26" y="2250" width="180" height="30" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-53" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="_u3hFmiMN6U5vcW2F68K-54" target="_u3hFmiMN6U5vcW2F68K-56" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-54" value="<span style="font-weight: normal;">HmilyRepositoryFacade.getInstance()<br>.</span>updateHmilyTransactionStatus<span style="font-weight: normal;">(<br>hmilyTransaction.getTransId(), hmilyTransaction.getStatus());</span>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;fontStyle=1;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="2720" y="2520" width="200.26" height="60" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-55" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="_u3hFmiMN6U5vcW2F68K-56" target="_u3hFmiMN6U5vcW2F68K-57" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-56" value="<span style="font-weight: normal;">checkRows(hmilyRepository<br>.updateHmilyTransactionStatus(<br>transId, status));</span>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;fontStyle=1;" parent="1" vertex="1">
<mxGeometry x="2960" y="2520" width="200.26" height="60" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-57" value="<span style="font-weight: normal;">update </span>hmily_transaction_global<span style="font-weight: normal;">&nbsp; set status=?&nbsp; where trans_id = ?&nbsp;</span>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;fontStyle=1;align=left;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="3200" y="2520" width="440" height="60" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-64" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="_u3hFmiMN6U5vcW2F68K-60" target="_u3hFmiMN6U5vcW2F68K-63" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-60" value="<span style="font-weight: normal;">this.executor.</span>updateStartStatus<span style="font-weight: normal;">(<br>hmilyTransaction);</span>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;fontStyle=1;" parent="1" vertex="1">
<mxGeometry x="1241.26" y="2540" width="200.26" height="60" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-66" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;dashed=1;" parent="1" source="_u3hFmiMN6U5vcW2F68K-63" target="Jgbx7IJgLmi5tVRdjDKV-18" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="1940" y="2570" />
<mxPoint x="1940" y="2490" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-63" value="<span style="font-weight: normal;">HmilyRepositoryStorage<br>.updateHmilyTransactionStatus(hmilyTransaction);<br>HmilyRepositoryStorage<br>.updateHmilyParticipantStatus(hmilyParticipant);</span>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;fontStyle=1;align=left;" parent="1" vertex="1">
<mxGeometry x="1479.74" y="2540" width="240.26" height="60" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-67" value="REMOVE_HMILY_PARTICIPANT" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fontSize=9;" parent="1" vertex="1" connectable="0">
<mxGeometry x="2639.7481310172366" y="2629.9970370370365" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-68" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="_u3hFmiMN6U5vcW2F68K-69" target="_u3hFmiMN6U5vcW2F68K-71" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-69" value="<span style="font-weight: normal;">HmilyRepositoryFacade.getInstance()<br>.</span>removeHmilyParticipant<span style="font-weight: normal;">(<br>hmilyParticipant.getParticipantId());</span>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;fontStyle=1;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="2719.6" y="2600" width="200.26" height="60" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-70" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="_u3hFmiMN6U5vcW2F68K-71" target="_u3hFmiMN6U5vcW2F68K-72" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-71" value="<span style="font-weight: normal;">checkRows(hmilyRepository<br>.</span>removeHmilyParticipant<span style="font-weight: normal;">(participantId));<br><font color="#007fff">默认是物理删除</font><br></span>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;fontStyle=1;" parent="1" vertex="1">
<mxGeometry x="2959.6" y="2600" width="200.26" height="60" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-72" value="<span style="font-weight: normal;">delete from </span>hmily_transaction_participant<span style="font-weight: normal;"> where participant_id = ?&nbsp;</span>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;fontStyle=1;align=left;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="3199.6" y="2600" width="440" height="60" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-80" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="_u3hFmiMN6U5vcW2F68K-74" target="_u3hFmiMN6U5vcW2F68K-79" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-74" value="HmilyTransactionEventConsumer#<br>execute<span style="font-weight: normal;">(final HmilyTransactionTask task)</span><br><font color="#007fff">通过 Disruptor 实现的事件发布订阅</font>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;fontStyle=1;" parent="1" vertex="1">
<mxGeometry x="1960" y="2620" width="200.26" height="60" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-78" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;dashed=1;" parent="1" source="_u3hFmiMN6U5vcW2F68K-75" target="_u3hFmiMN6U5vcW2F68K-74" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-75" value="<span style="font-weight: normal;">this.disruptor.getProvider().</span>onData(...)<br><font color="#007fff"><span style="font-weight: normal;">这里其实是相当于发布了一个 </span><span style="font-weight: 400;">HmilyTransactionTask</span></font>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;fontStyle=1;align=center;" parent="1" vertex="1">
<mxGeometry x="1239.48" y="2620" width="200.52" height="60" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-82" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="_u3hFmiMN6U5vcW2F68K-79" target="_u3hFmiMN6U5vcW2F68K-81" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="2420" y="2650" />
<mxPoint x="2420" y="2700" />
<mxPoint x="1950" y="2700" />
<mxPoint x="1950" y="2900" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="ILePiL2lHhwXlFeLtQY4-7" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="_u3hFmiMN6U5vcW2F68K-79" target="ILePiL2lHhwXlFeLtQY4-5">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="2420" y="2650" />
<mxPoint x="2420" y="2700" />
<mxPoint x="1950" y="2700" />
<mxPoint x="1950" y="3150" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-79" value="task.run()" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;fontStyle=1;" parent="1" vertex="1">
<mxGeometry x="2199.75" y="2620" width="200.26" height="60" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-84" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="_u3hFmiMN6U5vcW2F68K-81" target="_u3hFmiMN6U5vcW2F68K-83" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-81" value="<span style="font-weight: normal;">&nbsp;this.executor.</span>globalConfirm<span style="font-weight: normal;">(<br>currentTransaction);</span>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;fontStyle=1;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="1960.0000000000002" y="2870" width="200.26" height="60" as="geometry" />
</mxCell>
<mxCell id="ILePiL2lHhwXlFeLtQY4-11" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="_u3hFmiMN6U5vcW2F68K-83" target="ILePiL2lHhwXlFeLtQY4-10">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="_u3hFmiMN6U5vcW2F68K-83" value="<div style=""><font style="font-size: 10px;"><span style="font-weight: normal;">currentTransaction.setStatus(HmilyActionEnum.</span><font style="" color="#cc0000">CONFIRMING</font><span style="font-weight: normal;">.getCode());</span></font></div><font style="font-weight: normal; font-size: 10px;" color="#007fff">//通过 HmilyRepositoryEventPublisher 发布 UPDATE_HMILY_TRANSACTION_STATUS&nbsp;事件</font><div style=""><font style="font-size: 10px;"><span style="font-weight: normal;">HmilyRepositoryStorage.</span>updateHmilyTransactionStatus<span style="font-weight: normal;">(currentTransaction);</span></font></div><div style=""><span style="font-weight: normal;"><font style="font-size: 10px;">final List&lt;HmilyParticipant&gt; hmilyParticipants = currentTransaction.getHmilyParticipants();</font></span></div><div style=""><span style="font-weight: normal;"><font style="font-size: 10px;">List&lt;Boolean&gt; successList = new ArrayList&lt;&gt;();</font></span></div><div style=""><font style="font-size: 10px;"><span style="font-weight: normal;">for (HmilyParticipant hmilyParticipant : </span>hmilyParticipants<span style="font-weight: normal;">) { </span><font style="font-size: 10px;" color="#007fff">//通知所有参与者确认提交</font></font></div><div style=""><span style="font-weight: normal;"><font style="font-size: 10px;">&nbsp; &nbsp; try {</font></span></div><div style=""><span style="font-weight: normal;"><font style="font-size: 10px;">&nbsp; &nbsp; &nbsp; &nbsp; if (hmilyParticipant.getRole() == HmilyRoleEnum.START.getCode()) {</font></span></div><div style=""><span style="font-weight: normal;"><font style="font-size: 10px;" color="#007fff"><span style="white-space: pre;">	</span>&nbsp; &nbsp; //说明是事务发起者应用自己,本地调用(获取服务实例反射调用)<br></font></span></div><div style=""><font style="font-size: 10px;"><span style="font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span>HmilyReflector<span style="font-weight: normal;">.executor(HmilyActionEnum.CONFIRMING, <br><span style=""><span style="">&nbsp;&nbsp;&nbsp;&nbsp;</span></span><span style=""><span style="">&nbsp; &nbsp; &nbsp;&nbsp;<span style="white-space: pre;">	</span></span></span>ExecutorTypeEnum.</span>LOCAL<span style="font-weight: normal;">, hmilyParticipant);</span></font></div><div style=""><span style="font-weight: normal;"><font style="font-size: 10px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; HmilyRepositoryStorage.removeHmilyParticipant(hmilyParticipant);</font></span></div><div style=""><span style="font-weight: normal;"><font style="font-size: 10px;">&nbsp; &nbsp; &nbsp; &nbsp; } else {</font></span></div><div style=""><span style="font-weight: normal;"><font style="font-size: 10px;"><span style="white-space: pre;">	</span>&nbsp; &nbsp; <font style="font-size: 10px;" color="#007fff">//其他参与者,远程调用(获取服务实例封装后的Stub实例反射调用)</font><br></font></span></div><div style=""><font style="font-size: 10px;"><span style="font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span>HmilyReflector<span style="font-weight: normal;">.executor(HmilyActionEnum.CONFIRMING, <br><span style=""><span style="">&nbsp;&nbsp;&nbsp;&nbsp;</span></span><span style=""><span style="">&nbsp;&nbsp;&nbsp;&nbsp;<span style="white-space: pre;">	</span></span></span>ExecutorTypeEnum.</span>RPC<span style="font-weight: normal;">, hmilyParticipant);</span></font></div><div style=""><span style="font-weight: normal;"><font style="font-size: 10px;">&nbsp; &nbsp; &nbsp; &nbsp; }</font></span></div><div style=""><span style="font-weight: normal;"><font style="font-size: 10px;">&nbsp; &nbsp; &nbsp; &nbsp; successList.add(true);</font></span></div><div style=""><span style="font-weight: normal;"><font style="font-size: 10px;">&nbsp; &nbsp; } catch (Throwable e) {</font></span></div><div style=""><span style="font-weight: normal;"><font style="font-size: 10px;">&nbsp; &nbsp; &nbsp; &nbsp; successList.add(false);</font></span></div><div style=""><span style="font-weight: normal;"><font style="font-size: 10px;">&nbsp; &nbsp; &nbsp; &nbsp; LOGGER.error(...);</font></span></div><div style=""><span style="font-weight: normal;"><font style="font-size: 10px;">&nbsp; &nbsp; } finally {</font></span></div><div style=""><span style="font-weight: normal;"><font style="font-size: 10px;">&nbsp; &nbsp; &nbsp; &nbsp; HmilyContextHolder.remove();</font></span></div><div style=""><span style="font-weight: normal;"><font style="font-size: 10px;">&nbsp; &nbsp; }</font></span></div><div style=""><span style="font-weight: normal;"><font style="font-size: 10px;">}</font></span></div><div style=""><font style="font-size: 10px;"><span style="font-weight: normal;">if (successList.stream().allMatch(e -&gt; e)) { </span><font style="font-size: 10px;" color="#007fff"><span style="font-weight: normal;">//</span>如果有参与者确认提交失败<span style="font-weight: normal;">(确认和撤销会有重试,这里是指重试之后还是失败)</span>,不会删除事务记录,但是也不会继续处理</font></font></div><div style=""><font style="font-size: 10px;"><span style="font-weight: normal; background-color: initial;">&nbsp; &nbsp; HmilyRepositoryStorage.removeHmilyTransaction(currentTransaction);</span><br></font></div><div style=""><span style="font-weight: normal;"><font style="font-size: 10px;">}</font></span></div>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;fontStyle=1;align=left;arcSize=2;" parent="1" vertex="1">
<mxGeometry x="2199.74" y="2720" width="400.25" height="360" as="geometry" />
</mxCell>
<mxCell id="ILePiL2lHhwXlFeLtQY4-9" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="ILePiL2lHhwXlFeLtQY4-5" target="ILePiL2lHhwXlFeLtQY4-8">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="ILePiL2lHhwXlFeLtQY4-5" value="<span style="font-weight: normal;">&nbsp;this.executor.</span>globalCancel<span style="font-weight: normal;">(<br>currentTransaction);</span>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;fontStyle=1;fillColor=#fff2cc;strokeColor=#d6b656;" vertex="1" parent="1">