@@ -79,9 +79,13 @@ public static void loadMetadata() {
7979 String name = rs .getString (2 );
8080 String tagName = rs .getString (3 );
8181 Integer pos = rs .getInt (4 );
82- tagOrder .computeIfAbsent (name , k -> new HashMap <>());
83- Map <String , Integer > temp = tagOrder .get (name );
84- temp .put (tagName , pos );
82+ if (tagOrder .containsKey (name )){
83+ tagOrder .get (name ).put (tagName , pos );
84+ } else {
85+ Map <String , Integer > map = new HashMap <>();
86+ map .put (tagName , pos );
87+ tagOrder .put (name , map );
88+ }
8589 }
8690
8791 // Read the size of storage group
@@ -312,7 +316,13 @@ public static HashMap<Integer, String> getMapping(String name, Map<String, Strin
312316 */
313317 private static void persistMappingCache (String metricName , Map <String , Integer > cache ) {
314318 for (Map .Entry <String , Integer > entry : cache .entrySet ()) {
315- long timestamp = new Date ().getTime ();
319+ long timestamp = System .currentTimeMillis ();
320+ try {
321+ Thread .sleep (1 );
322+ } catch (InterruptedException e ) {
323+ LOGGER .error ("" , e );
324+ Thread .currentThread ().interrupt ();
325+ }
316326 String sql = String .format (
317327 "insert into root.SYSTEM.TAG_NAME_INFO(timestamp, metric_name, tag_name, tag_order) values(%s, \" %s\" , \" %s\" , %s);" ,
318328 timestamp , metricName , entry .getKey (), entry .getValue ());
0 commit comments