class ServletTransactionHelper {

    public static void determineServiceName(@Nullable String servletContextName, @Nullable ClassLoader servletContextClassLoader, @Nullable String contextPath) {
        if (servletContextClassLoader == null || nameInitialized.putIfAbsent(servletContextClassLoader, Boolean.TRUE) != null) {
            return;
        }

        @Nullable
        String serviceName = servletContextName;
        if ("application".equals(serviceName) || "".equals(serviceName) || "/".equals(serviceName)) {
            // payara returns an empty string as opposed to null
            // spring applications which did not set spring.application.name have application as the default
            // jetty returns context path when no display name is set, which could be the root context of "/"
            // this is a worse default than the one we would otherwise choose
            serviceName = null;
        }
        if (serviceName == null && contextPath != null && !contextPath.isEmpty()) {
            // remove leading slash
            serviceName = contextPath.substring(1);
        }
        if (serviceName != null) {
            GlobalTracer.get().overrideServiceNameForClassLoader(servletContextClassLoader, serviceName);
        }
    }

    public  ServletTransactionHelper(ElasticApmTracer tracer);

}