/** * @return the core agent source code, either laoded from the resources or directly fetched form * the cache. */ @SuppressWarnings({ "PMD" }) private String getAgentCoreSource() { if (agentCoreSource == null) { synchronized (JSAgentBuilder.class) { if (agentCoreSource == null) { try { agentCoreSource = readResourceFile(JSBASE_RESOURCE); } catch (Exception e) { LOG.error("unable to read JS Agent core"); return ""; } } } } return agentCoreSource; }
/** * @param module * the module of which the source code shall be returned * @return @return the modules source code, either loaded from the resources or directly fetched * form the cache. */ private String getAgentModuleSource(JSAgentModule module) { if (!moduleSourceCache.containsKey(module)) { try { String src = readResourceFile(module.getModuleSourceFile()); moduleSourceCache.putIfAbsent(module, src); return src; } catch (Exception e) { LOG.error("unable to read JS Agent core"); return ""; } } else { return moduleSourceCache.get(module); } }