private List<File> getExtensionFiles() { extensionJarsLock.readLock().lock(); List<File> jars = extensionJarsRef.get(); if (jars == null) { try { extensionJarsLock.readLock().unlock(); extensionJarsLock.writeLock().lock(); jars = extensionJarsRef.get(); if (jars == null) { jars = new ArrayList<File>(); String extPath = getExtensionsPath(); if (extPath != null) { StringTokenizer st = new StringTokenizer(extPath, File.pathSeparator); while (st.hasMoreTokens()) { collectJars(new File(st.nextToken()), jars); } } extensionJarsRef.set(jars); return jars; } } finally { extensionJarsLock.writeLock().unlock(); } } else { extensionJarsLock.readLock().unlock(); } return jars; }
private List<File> getExtensionFiles() { extensionJarsLock.readLock().lock(); List<File> jars = extensionJarsRef.get(); if (jars == null) { try { extensionJarsLock.readLock().unlock(); extensionJarsLock.writeLock().lock(); jars = extensionJarsRef.get(); if (jars == null) { jars = new ArrayList<File>(); String extPath = getExtensionsPath(); if (extPath != null) { StringTokenizer st = new StringTokenizer(extPath, File.pathSeparator); while (st.hasMoreTokens()) { collectJars(new File(st.nextToken()), jars); } } extensionJarsRef.set(jars); return jars; } } finally { extensionJarsLock.writeLock().unlock(); } } else { extensionJarsLock.readLock().unlock(); } return jars; }
public Compiler(String includePath, boolean unsafe, ExtensionsRepository repository, JavaCompiler wrappedCompiler) { if (includePath != null) { includeDirs = new ArrayList<String>(); String[] paths = includePath.split(File.pathSeparator); includeDirs.addAll(Arrays.asList(paths)); } this.unsafe = unsafe; this.compiler = wrappedCompiler; this.stdManager = compiler.getStandardFileManager(null, null, null); this.repository = repository; this.dumpDir = System.getProperty("net.java.btrace.dumpDir", null); if (this.dumpDir == null) { try { File tmp = File.createTempFile("tmp", ".tst"); this.dumpDir = tmp.getParent(); } catch (IOException e) { BTraceLogger.debugPrint("*** unable to determina 'tmp' directory. dumps disabled."); } } if (BTraceLogger.isDebug()) { BTraceLogger.debugPrint("*** compiling with repository: " + repository.getExtensionsPath()); } }
/** * Creates a new instance of {@linkplain ExtensionsRepository} which is a result of composition of other repositories * @param location Desired execution {@linkplain ExtensionsRepository.Location} * @param reps The repositories to wrap in composite * @return Returns a new instance of {@linkplain ExtensionsRepository} */ public static ExtensionsRepository composite(ExtensionsRepository.Location location, ExtensionsRepository ... reps) { Set<String> paths = new HashSet<String>(); StringBuilder sb = new StringBuilder(); for(ExtensionsRepository rep : reps) { if (location == ExtensionsRepository.Location.BOTH || location == rep.getLocation()) { String ePath = rep.getExtensionsPath(); if (ePath != null) { paths.add(ePath); } } } for(String path : paths) { if (sb.length() > 0) { sb.append(File.pathSeparatorChar); } sb.append(path); } return fixed(location, sb.toString()); } }
/** * Creates a new instance of {@linkplain ExtensionsRepository} which is a result of composition of other repositories * @param location Desired execution {@linkplain ExtensionsRepository.Location} * @param reps The repositories to wrap in composite * @return Returns a new instance of {@linkplain ExtensionsRepository} */ public static ExtensionsRepository composite(ExtensionsRepository.Location location, ExtensionsRepository ... reps) { Set<String> paths = new HashSet<String>(); StringBuilder sb = new StringBuilder(); for(ExtensionsRepository rep : reps) { if (location == ExtensionsRepository.Location.BOTH || location == rep.getLocation()) { String ePath = rep.getExtensionsPath(); if (ePath != null) { paths.add(ePath); } } } for(String path : paths) { if (sb.length() > 0) { sb.append(File.pathSeparatorChar); } sb.append(path); } return fixed(location, sb.toString()); } }
public Compiler(String includePath, boolean unsafe, ExtensionsRepository repository, JavaCompiler wrappedCompiler) { if (includePath != null) { includeDirs = new ArrayList<String>(); String[] paths = includePath.split(File.pathSeparator); includeDirs.addAll(Arrays.asList(paths)); } this.unsafe = unsafe; this.compiler = wrappedCompiler; this.stdManager = compiler.getStandardFileManager(null, null, null); this.repository = repository; this.dumpDir = System.getProperty("net.java.btrace.dumpDir", null); if (this.dumpDir == null) { try { File tmp = File.createTempFile("tmp", ".tst"); this.dumpDir = tmp.getParent(); } catch (IOException e) { BTraceLogger.debugPrint("*** unable to determina 'tmp' directory. dumps disabled."); } } if (BTraceLogger.isDebug()) { BTraceLogger.debugPrint("*** compiling with repository: " + repository.getExtensionsPath()); } }
agentArgs += ",probeDescPath=" + probeDescPath; if (extRepository != DEFAULT_REPOSITORY) { agentArgs += ",extPath=" + extRepository.getExtensionsPath();
agentArgs += ",probeDescPath=" + probeDescPath; if (extRepository != DEFAULT_REPOSITORY) { agentArgs += ",extPath=" + extRepository.getExtensionsPath();