org.snapscript.studio.agent.local.LocalNameGenerator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of snap-all Show documentation
Show all versions of snap-all Show documentation
Dynamic scripting for the JVM
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();
}
}
}