class AsyncProfiler {

    public static AsyncProfiler getInstance(String profilerLibDirectory) {
        AsyncProfiler result = AsyncProfiler.instance;
        if (result != null) {
            return result;
        }
        synchronized (AsyncProfiler.class) {
            if (instance == null) {
                try {
                    loadNativeLibrary(profilerLibDirectory);
                } catch (UnsatisfiedLinkError e) {
                    throw new IllegalStateException(String.format("It is likely that %s is not an executable location. Consider setting " +
                        "the profiling_inferred_spans_lib_directory property to a directory on a partition that allows execution",
                        profilerLibDirectory), e);
                }

                instance = new AsyncProfiler();
            }
            return instance;
        }
    }

    private  AsyncProfiler();

}