add support for multi-phase processing and processor orchestration
- Dominant language
- Java
- Stars
- 2k
- Forks
- 392
- Avg merge
- 11h 24m
- Merged PRs (30d)
- 36
Description
Hi everyone,
i'v started writing a transcoder using spoon and I'v based my code on the Launcher example which uses a Factory/ProcessingManager (see below) which then sends CtClass and CtInterface instances to two AbstractProcessors. My question is around the best way to approach multi-phase processing. I can happily extract all the class information from CtClass/CtInterface but I find I'm going to need to scan source tree twice. Scan one to do analysis and the second scan when I generate the output.
I guess my question is what the recommended approach for this is. If I simply keep my own references to all the CtClass/CtInterface instances could this cause memory issues, having all nodes is loaded in memory. Does the processor throw away each class as it moves to the next?
Or, do I just run two of these?
```
final String[] args = { "--input", path, "--output-type", "nooutput" };
launcher.setArgs(args);
launcher.run();
runProcessingManager();
runProcessingManager();
}
private void runProcessingManager() {
Factory factory = launcher.getFactory();
ProcessingManager processingManager = new QueueProcessingManager(factory);
processingManager.addProcessor(new ClassProcessor());
processingManager.addProcessor(new InterfaceProcessor());
processingManager.process(factory.Class().getAll());
}
```
Contributor guide
Assessment
This issue has not been assessed yet.