We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The sample at https://github.com/redhat-developer/intellij-redhat-telemetry?tab=readme-ov-file#create-a-telemetry-singleton suggest to create a class like this:
public class TelemetryService { private static final TelemetryService INSTANCE = new TelemetryService(); private final Lazy<TelemetryMessageBuilder> builder = new Lazy<>(() -> new TelemetryMessageBuilder(TelemetryService.class.getClassLoader())); public static TelemetryMessageBuilder instance() { return INSTANCE.builder.get(); } }
If you see Jetbrains code, when they declare singleton, they use applicationService, see https://github.com/search?q=repo%3AJetBrains%2Fintellij-community%20getInstance&type=code
It would be nice to add the following sample code too:
package com.youapp.telemetry; public class TelemetryService implements Disposable { private static final TelemetryService INSTANCE = new TelemetryService(); private final Lazy<TelemetryMessageBuilder> builder = new Lazy<>(() -> new TelemetryMessageBuilder(TelemetryService.class.getClassLoader())); public static TelemetryMessageBuilder instance() { return getInstance().builder.get(); } private static TelemetryService getInstance() { return ApplicationManager.getApplication().getService(TelemetryService.class); } @Override public void dispose() { // Do something when IJ IDEA is closing } }
And declare in the plugin.xml the application service:
plugin.xml
<applicationService serviceImplementation="com.youapp.telemetry.TelemetryService"/>
The text was updated successfully, but these errors were encountered:
@angelozerr thanks for the suggestion. Very good idea, I'll do.
Sorry, something went wrong.
No branches or pull requests
The sample at https://github.com/redhat-developer/intellij-redhat-telemetry?tab=readme-ov-file#create-a-telemetry-singleton suggest to create a class like this:
If you see Jetbrains code, when they declare singleton, they use applicationService, see
https://github.com/search?q=repo%3AJetBrains%2Fintellij-community%20getInstance&type=code
It would be nice to add the following sample code too:
And declare in the
plugin.xml
the application service:The text was updated successfully, but these errors were encountered: