Browse Source

重载一个设置poemsContext上下文的方法

lixing 2 years ago
parent
commit
cdbd10b551

+ 7 - 0
apm-common/src/main/java/com/persagy/apm/common/context/poems/PoemsContext.java

@@ -26,6 +26,13 @@ public class PoemsContext {
         poemsContextContent.setProjectId(projectId);
     }
 
+    public static void setContext(PoemsContextContent poemsContextContent) {
+        if (poemsContextContent == null) {
+            poemsContextContent = new PoemsContextContent();
+        }
+        context.set(poemsContextContent);
+    }
+
     public static PoemsContextContent getContext() {
         PoemsContextContent poemsContextContent = context.get();
         if (poemsContextContent == null) {