@Override public void perform(final GraphRewrite event, final EvaluationContext context) { ExecutionStatistics.get().begin("ProcyonDecompilationOperation.perform"); int threads = WindupExecutors.getDefaultThreadCount(); LOG.info("Decompiling with " + threads + " threads"); WindupJavaConfigurationService configurationService = new WindupJavaConfigurationService(event.getGraphContext()); Iterable<JavaClassFileModel> allClasses = getFilesToDecompile(event.getGraphContext()); List<ClassDecompileRequest> classesToDecompile = new ArrayList<>(10000); // Just a guess as to the average size for (JavaClassFileModel classFileModel : allClasses) { if (configurationService.shouldScanPackage(classFileModel.getPackageName())) { File outputDir = DecompilerUtil.getOutputDirectoryForClass(event.getGraphContext(), classFileModel); classesToDecompile.add(new ClassDecompileRequest(outputDir.toPath(), classFileModel.asFile().toPath(), outputDir.toPath())); } } Collections.sort(classesToDecompile, (ClassDecompileRequest o1, ClassDecompileRequest o2) -> o1.getOutputDirectory().toAbsolutePath().toString().compareTo(o2.getOutputDirectory().toString())); ProgressEstimate progressEstimate = new ProgressEstimate(classesToDecompile.size()); AddDecompiledItemsToGraph addDecompiledItemsToGraph = new AddDecompiledItemsToGraph(progressEstimate, event); ProcyonDecompiler decompiler = new ProcyonDecompiler(new ProcyonConfiguration().setIncludeNested(false)); decompiler.setExecutorService(WindupExecutors.newFixedThreadPool(threads), threads); decompiler.decompileClassFiles(classesToDecompile, addDecompiledItemsToGraph); decompiler.close(); ExecutionStatistics.get().end("ProcyonDecompilationOperation.perform"); }
-> o1.getOutputDirectory().toAbsolutePath().toString().compareTo(o2.getOutputDirectory().toString())); ProgressEstimate progressEstimate = new ProgressEstimate(totalWork);
@Override public void perform(final GraphRewrite event, final EvaluationContext context) { ExecutionStatistics.get().begin("ProcyonDecompilationOperation.perform"); int threads = WindupExecutors.getDefaultThreadCount(); LOG.info("Decompiling with " + threads + " threads"); WindupJavaConfigurationService configurationService = new WindupJavaConfigurationService(event.getGraphContext()); Iterable<JavaClassFileModel> allClasses = getFilesToDecompile(event.getGraphContext()); List<ClassDecompileRequest> classesToDecompile = new ArrayList<>(10000); // Just a guess as to the average size for (JavaClassFileModel classFileModel : allClasses) { if (configurationService.shouldScanPackage(classFileModel.getPackageName())) { File outputDir = DecompilerUtil.getOutputDirectoryForClass(event.getGraphContext(), classFileModel); classesToDecompile.add(new ClassDecompileRequest(outputDir.toPath(), classFileModel.asFile().toPath(), outputDir.toPath())); } } Collections.sort(classesToDecompile, (ClassDecompileRequest o1, ClassDecompileRequest o2) -> o1.getOutputDirectory().toAbsolutePath().toString().compareTo(o2.getOutputDirectory().toString())); ProgressEstimate progressEstimate = new ProgressEstimate(classesToDecompile.size()); AddDecompiledItemsToGraph addDecompiledItemsToGraph = new AddDecompiledItemsToGraph(progressEstimate, event); ProcyonDecompiler decompiler = new ProcyonDecompiler(new ProcyonConfiguration().setIncludeNested(false)); decompiler.setExecutorService(WindupExecutors.newFixedThreadPool(threads), threads); decompiler.decompileClassFiles(classesToDecompile, addDecompiledItemsToGraph); decompiler.close(); ExecutionStatistics.get().end("ProcyonDecompilationOperation.perform"); }
-> o1.getOutputDirectory().toAbsolutePath().toString().compareTo(o2.getOutputDirectory().toString())); ProgressEstimate progressEstimate = new ProgressEstimate(totalWork);
ProgressEstimate estimate = new ProgressEstimate(sourceFileCount); for (JavaAnalysisBatch batch : batchMap.values())
ProgressEstimate estimate = new ProgressEstimate(sourceFileCount); for (JavaAnalysisBatch batch : batchMap.values())
@Override public void perform(GraphRewrite event, EvaluationContext context) { if (event.shouldWindupStop()) { throw new WindupStopException("Request to stop detected during iteration related to: " + messagePrefix); } if (totalIterations == -1) { @SuppressWarnings("unchecked") Iterable<WindupVertexFrame> frames = (Iterable<WindupVertexFrame>) event.getRewriteContext().get(Iteration.DEFAULT_VARIABLE_LIST_STRING); totalIterations = Iterators.asList(frames).size(); progressEstimate = new ProgressEstimate(totalIterations); } progressEstimate.addWork(1); if (progressEstimate.getWorked() % interval == 0) { if (estimateTimeRemaining) { long remainingTimeMillis = progressEstimate.getTimeRemainingInMillis(); if (remainingTimeMillis > 1000) event.ruleEvaluationProgress(messagePrefix, progressEstimate.getWorked(), totalIterations, (int) remainingTimeMillis / 1000); } LOG.info(messagePrefix + ": " + progressEstimate.getWorked() + " / " + totalIterations); } }
@Override public void perform(GraphRewrite event, EvaluationContext context) { if (event.shouldWindupStop()) { throw new WindupStopException("Request to stop detected during iteration related to: " + messagePrefix); } if (totalIterations == -1) { @SuppressWarnings("unchecked") Iterable<WindupVertexFrame> frames = (Iterable<WindupVertexFrame>) event.getRewriteContext().get(Iteration.DEFAULT_VARIABLE_LIST_STRING); totalIterations = Iterators.asList(frames).size(); progressEstimate = new ProgressEstimate(totalIterations); } progressEstimate.addWork(1); if (progressEstimate.getWorked() % interval == 0) { if (estimateTimeRemaining) { long remainingTimeMillis = progressEstimate.getTimeRemainingInMillis(); if (remainingTimeMillis > 1000) event.ruleEvaluationProgress(messagePrefix, progressEstimate.getWorked(), totalIterations, (int) remainingTimeMillis / 1000); } LOG.info(messagePrefix + ": " + progressEstimate.getWorked() + " / " + totalIterations); } }