All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.snapscript.studio.agent.local.LocalNameGenerator Maven / Gradle / Ivy

There is a newer version: 1.4.6
Show newest version
package org.snapscript.studio.agent.local;

import java.util.UUID;

public class LocalNameGenerator {

   private static final String PROCESS_PREFIX = "process";
   
   public static String getProcess() {
      return String.format("%s-%s", PROCESS_PREFIX, getProcessId());
   }
   
   private static String getProcessId() {
      try {
         return java.lang.management.ManagementFactory.getRuntimeMXBean().getName().split("@")[0];
      }catch(Exception e) {
         return UUID.randomUUID().toString();
      }
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy