jvm-profiler icon indicating copy to clipboard operation
jvm-profiler copied to clipboard

Avoid creation of multiple reporters

Open mgaido91 opened this issue 4 years ago • 3 comments

Due to an ambiguous semantic of the getReporter method of the Arguments class, extensions created around this project are forced to be using different reporters instances for their collectors and for the collectors in this repository. This prevents the reporter created for others' collectors to follow the proper lifecycle and hence to be correctly closed when needed, or anyway, makes them responsible to do so.

mgaido91 avatar Oct 16 '19 16:10 mgaido91

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Oct 16 '19 16:10 CLAassistant

@boy-uber thanks for your comment. I think the point of this PR is to be able to retrieve the reporter, in order to be able to reuse it to write customized metrics. Hence just renaming the method would not do the job. We can rename it, but having it as a singleton I think would be enabling for more use cases. Thanks.

mgaido91 avatar Oct 29 '19 08:10 mgaido91

I see. It just looks weird that Arguments.java contains a Reporter field. If you want to reuse Reporter, I would suggest change it somewhere else. e.g. cache the reporter returned by Arguments somewhere.

hiboyang avatar Nov 19 '19 04:11 hiboyang