|
15 | 15 | */
|
16 | 16 | package io.seata.apm.skywalking.plugin.common;
|
17 | 17 |
|
18 |
| -import java.util.HashMap; |
19 |
| -import java.util.Map; |
| 18 | +import java.util.HashSet; |
| 19 | +import java.util.Set; |
20 | 20 |
|
21 | 21 | /**
|
22 | 22 | * @author zhaoyuguang
|
23 | 23 | */
|
24 | 24 | public class SWSeataConstants {
|
25 | 25 |
|
26 |
| - public static final Map<String, String> OPERATION_NAME_MAPPING = new HashMap<>(); |
27 |
| - public static final String SEATA_NAME = "SEATA"; |
| 26 | + private static final Set<String> TRANSACTION_MANAGER_OPERATION_NAME_MAPPING = new HashSet<>(); |
28 | 27 |
|
29 | 28 | static {
|
30 |
| - OPERATION_NAME_MAPPING.put("GlobalBeginRequest", SEATA_NAME + "/TM/" + "GlobalBeginRequest"); |
31 |
| - OPERATION_NAME_MAPPING.put("GlobalBeginResponse", SEATA_NAME + "/TM/" + "GlobalBeginResponse"); |
32 |
| - OPERATION_NAME_MAPPING.put("GlobalRollbackRequest", SEATA_NAME + "/TM/" + "GlobalRollbackRequest"); |
33 |
| - OPERATION_NAME_MAPPING.put("GlobalRollbackResponse", SEATA_NAME + "/TM/" + "GlobalRollbackResponse"); |
34 |
| - OPERATION_NAME_MAPPING.put("GlobalCommitRequest", SEATA_NAME + "/TM/" + "GlobalCommitRequest"); |
35 |
| - OPERATION_NAME_MAPPING.put("GlobalCommitResponse", SEATA_NAME + "/TM/" + "GlobalCommitResponse"); |
36 |
| - OPERATION_NAME_MAPPING.put("BranchRegisterRequest", SEATA_NAME + "/RM/" + "BranchRegisterRequest"); |
37 |
| - OPERATION_NAME_MAPPING.put("BranchRegisterResponse", SEATA_NAME + "/RM/" + "BranchRegisterResponse"); |
38 |
| - OPERATION_NAME_MAPPING.put("BranchRollbackRequest", SEATA_NAME + "/RM/" + "BranchRollbackRequest"); |
39 |
| - OPERATION_NAME_MAPPING.put("BranchRollbackResponse", SEATA_NAME + "/RM/" + "BranchRollbackResponse"); |
40 |
| - OPERATION_NAME_MAPPING.put("BranchCommitRequest", SEATA_NAME + "/RM/" + "BranchCommitRequest"); |
41 |
| - OPERATION_NAME_MAPPING.put("BranchCommitResponse", SEATA_NAME + "/RM/" + "BranchCommitResponse"); |
42 |
| - OPERATION_NAME_MAPPING.put("BranchReportRequest", SEATA_NAME + "/RM/" + "BranchReportRequest"); |
43 |
| - OPERATION_NAME_MAPPING.put("BranchReportResponse", SEATA_NAME + "/RM/" + "BranchReportResponse"); |
44 |
| - OPERATION_NAME_MAPPING.put("GlobalLockQueryRequest", SEATA_NAME + "/RM/" + "GlobalLockQueryRequest"); |
45 |
| - OPERATION_NAME_MAPPING.put("GlobalLockQueryResponse", SEATA_NAME + "/RM/" + "GlobalLockQueryResponse"); |
46 |
| - OPERATION_NAME_MAPPING.put("UndoLogDeleteRequest", SEATA_NAME + "/RM/" + "UndoLogDeleteRequest"); |
47 |
| - OPERATION_NAME_MAPPING.put("UndoLogDeleteResponse", SEATA_NAME + "/RM/" + "UndoLogDeleteResponse"); |
48 |
| - OPERATION_NAME_MAPPING.put("RegisterRMRequest", SEATA_NAME + "/RM/" + "RegisterRMRequest"); |
49 |
| - OPERATION_NAME_MAPPING.put("RegisterRMResponse", SEATA_NAME + "/RM/" + "RegisterRMResponse"); |
50 |
| - OPERATION_NAME_MAPPING.put("RegisterTMRequest", SEATA_NAME + "/RM/" + "RegisterTMRequest"); |
51 |
| - OPERATION_NAME_MAPPING.put("RegisterTMResponse", SEATA_NAME + "/RM/" + "RegisterTMResponse"); |
| 29 | + TRANSACTION_MANAGER_OPERATION_NAME_MAPPING.add("GlobalBeginRequest"); |
| 30 | + TRANSACTION_MANAGER_OPERATION_NAME_MAPPING.add("GlobalBeginResponse"); |
| 31 | + TRANSACTION_MANAGER_OPERATION_NAME_MAPPING.add("GlobalRollbackRequest"); |
| 32 | + TRANSACTION_MANAGER_OPERATION_NAME_MAPPING.add("GlobalRollbackResponse"); |
| 33 | + TRANSACTION_MANAGER_OPERATION_NAME_MAPPING.add("GlobalCommitRequest"); |
| 34 | + TRANSACTION_MANAGER_OPERATION_NAME_MAPPING.add("GlobalCommitResponse"); |
| 35 | + } |
| 36 | + |
| 37 | + public static boolean isTransactionManagerOperationName(String operationName) { |
| 38 | + return TRANSACTION_MANAGER_OPERATION_NAME_MAPPING.contains(operationName); |
52 | 39 | }
|
53 | 40 | }
|
0 commit comments