-
Notifications
You must be signed in to change notification settings - Fork 16
Feature/new cli library #154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
6717057
038981f
b21f651
ce849fc
5520562
f9c4cf7
d8cbce2
3b5e168
60997d7
d13ae5b
5e86b01
00f3f5f
2ce4e91
b88d5c5
c80dc8c
8eec2cb
ded39d3
6922e52
5aa4c1d
60fcfaf
a3608b5
09bf357
1b65b51
77fd752
e443e3c
0bdca7d
ae0e9c4
f47c0de
bb18ea1
1a984ff
81e0953
a8acbb9
10bef7b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,8 +20,8 @@ | |
|
|
||
| class ReporterManager { | ||
|
|
||
| private List<ReporterOptions> reporterOptionsList; | ||
| private List<Throwable> reporterGatherErrors; | ||
| private final List<ReporterOptions> reporterOptionsList; | ||
| private List<Exception> reporterGatherErrors; | ||
| private ExecutorService executorService; | ||
|
|
||
| ReporterManager(ReporterConfig[] reporterConfigs ) { | ||
|
|
@@ -55,12 +55,12 @@ private ReporterOptions getDefaultReporterOption() { | |
| return new ReporterOptions(CoreReporters.UT_DOCUMENTATION_REPORTER.name()); | ||
| } | ||
|
|
||
| private void abortGathering(Throwable e) { | ||
| private void abortGathering(Exception e) { | ||
| addGatherError(e); | ||
| executorService.shutdownNow(); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I realized this might be an issue. We get the executorService from the outside but we shut it down here. I'm concerned if the caller is ok with its executorService been shut down.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's actually the purpose: If one Reporter Consumption fails, it should abort all the other Reporter threads.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lets abort tasks then, not the excutor
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, will make that more clear in a restructured version |
||
| } | ||
|
|
||
| private void addGatherError( Throwable e ) { | ||
| private void addGatherError( Exception e ) { | ||
| if ( reporterGatherErrors == null ) { | ||
| reporterGatherErrors = new ArrayList<>(); | ||
| } | ||
|
|
@@ -71,7 +71,7 @@ boolean haveGatherErrorsOccured() { | |
| return reporterGatherErrors != null && !reporterGatherErrors.isEmpty(); | ||
| } | ||
|
|
||
| List<Throwable> getGatherErrors() { | ||
| List<Exception> getGatherErrors() { | ||
| return reporterGatherErrors; | ||
| } | ||
|
|
||
|
|
@@ -127,11 +127,11 @@ List<ReporterOptions> getReporterOptionsList() { | |
| */ | ||
| private static class GatherReporterOutputTask implements Runnable { | ||
|
|
||
| private DataSource dataSource; | ||
| private ReporterOptions option; | ||
| private Consumer<Throwable> abortFunction; | ||
| private final DataSource dataSource; | ||
| private final ReporterOptions option; | ||
| private final Consumer<Exception> abortFunction; | ||
|
|
||
| GatherReporterOutputTask( DataSource dataSource, ReporterOptions reporterOption, Consumer<Throwable> abortFunction ) { | ||
| GatherReporterOutputTask( DataSource dataSource, ReporterOptions reporterOption, Consumer<Exception> abortFunction ) { | ||
|
|
||
| if ( reporterOption.getReporterObj() == null ) | ||
| throw new IllegalArgumentException("Reporter " + reporterOption.getReporterName() + " is not initialized"); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me share with you my point. I prefere to use simple constructors and use factory methods for all necessary operation neede to call the constructor. I don't like calling functions from a constructor as it doesn't allow making fields final and I personnaly like final fields. Do you mind making a small refactoring of this place?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean like
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes with all necessary stuff populating arrays done there and then call a simple private constructor.