11package io .arex .foundation .config ;
22
33import com .google .common .annotations .VisibleForTesting ;
4+ import io .arex .agent .bootstrap .util .MapUtils ;
45import io .arex .agent .bootstrap .util .StringUtil ;
56import io .arex .foundation .model .ConfigQueryResponse .DynamicClassConfiguration ;
67import io .arex .foundation .model .ConfigQueryResponse .ResponseBody ;
2930import java .util .*;
3031import java .util .stream .Stream ;
3132
32- import static io .arex .foundation . config .ConfigConstants .*;
33+ import static io .arex .agent . bootstrap . constants .ConfigConstants .*;
3334
3435public class ConfigManager {
3536
@@ -60,7 +61,6 @@ public class ConfigManager {
6061 private Set <String > excludeServiceOperations ;
6162 private String targetAddress ;
6263 private int dubboStreamReplayThreshold ;
63- private boolean disableReplay ;
6464 private List <ConfigListener > listeners = new ArrayList <>();
6565 private Map <String , String > extendField ;
6666
@@ -231,7 +231,6 @@ void init() {
231231 setRetransformModules (System .getProperty (RETRANSFORM_MODULE ));
232232 setExcludeServiceOperations (System .getProperty (EXCLUDE_SERVICE_OPERATION ));
233233 setDubboStreamReplayThreshold (System .getProperty (DUBBO_STREAM_REPLAY_THRESHOLD , "100" ));
234- setDisableReplay (System .getProperty (DISABLE_REPLAY ));
235234 }
236235
237236 @ VisibleForTesting
@@ -255,7 +254,8 @@ void readConfigFromFile(String configPath) {
255254 setDisabledModules (configMap .get (DISABLE_MODULE ));
256255 setRetransformModules (configMap .get (RETRANSFORM_MODULE ));
257256 setExcludeServiceOperations (configMap .get (EXCLUDE_SERVICE_OPERATION ));
258- setDisableReplay (configMap .get (DISABLE_REPLAY ));
257+ System .setProperty (DISABLE_REPLAY , StringUtil .defaultString (configMap .get (DISABLE_REPLAY )));
258+ System .setProperty (DISABLE_RECORD , StringUtil .defaultString (configMap .get (DISABLE_RECORD )));
259259 }
260260
261261 private static Map <String , String > parseConfigFile (String configPath ) {
@@ -305,12 +305,13 @@ private void updateRuntimeConfig() {
305305 Map <String , String > configMap = new HashMap <>();
306306 configMap .put (DYNAMIC_RESULT_SIZE_LIMIT , String .valueOf (getDynamicResultSizeLimit ()));
307307 configMap .put (TIME_MACHINE , String .valueOf (startTimeMachine ()));
308- configMap .put (DISABLE_REPLAY , String .valueOf (disableReplay ()));
308+ configMap .put (DISABLE_REPLAY , System .getProperty (DISABLE_REPLAY ));
309+ configMap .put (DISABLE_RECORD , System .getProperty (DISABLE_RECORD ));
309310 configMap .put (DURING_WORK , Boolean .toString (nextWorkTime () <= 0 ));
310311 configMap .put (AGENT_VERSION , agentVersion );
311312 configMap .put (IP_VALIDATE , Boolean .toString (checkTargetAddress ()));
312313 Map <String , String > extendFieldMap = getExtendField ();
313- if (extendFieldMap != null && ! extendFieldMap . isEmpty ( )) {
314+ if (MapUtils . isNotEmpty ( extendFieldMap )) {
314315 configMap .putAll (extendFieldMap );
315316 }
316317
@@ -523,19 +524,6 @@ public int getDubboStreamReplayThreshold() {
523524 return dubboStreamReplayThreshold ;
524525 }
525526
526- public void setDisableReplay (String disableReplay ) {
527- if (StringUtil .isEmpty (disableReplay )) {
528- return ;
529- }
530-
531- this .disableReplay = Boolean .parseBoolean (disableReplay );
532- System .setProperty (DISABLE_REPLAY , disableReplay );
533- }
534-
535- public boolean disableReplay () {
536- return disableReplay ;
537- }
538-
539527 public Map <String , String > getExtendField () {
540528 return extendField ;
541529 }
0 commit comments