Is there a reason why Config class does not implement the Singleton pattern? Or use other equivalent pattern (Monostate, Factory, or Dependency Injection)?
Additionally, each of the classes in the `trackers/' subdirectory behaves differently with respect to implementing the Singleton pattern.
The ScreenRecorder class implements the Singleton pattern, with getInstance() static method, which is not thread safe implementation
public static ScreenRecorder getInstance() {
if (instance == null) {
instance = new ScreenRecorder();
}
return instance;
}
The IDETracker class implements the getInstance() static method, but not the Singleton pattern:
public static IDETracker getInstance() throws ParserConfigurationException {
return new IDETracker();
}
The EyeTracker class does not implement the getInstance() static method.
For AnAction classes, the getInstance() method it is often implemented by JetBrains as, for example:
private static final String ID = "<Plugin>.<Action Name>";
// ...
public static @Nullable AnAction getInstance() {
return ActionManager.getInstance().getAction(ID);
}
Is there a reason why
Configclass does not implement the Singleton pattern? Or use other equivalent pattern (Monostate, Factory, or Dependency Injection)?Additionally, each of the classes in the `trackers/' subdirectory behaves differently with respect to implementing the Singleton pattern.
The
ScreenRecorderclass implements the Singleton pattern, withgetInstance()static method, which is not thread safe implementationThe
IDETrackerclass implements thegetInstance()static method, but not the Singleton pattern:The
EyeTrackerclass does not implement thegetInstance()static method.For
AnActionclasses, thegetInstance()method it is often implemented by JetBrains as, for example: