PluginUpdatesService (@NotNull Consumer<? super Integer> callback) { PluginUpdatesService service = new PluginUpdatesService(); service.myCountCallback = callback; synchronized (ourLock) { SERVICES.add(service); if (myPrepared) { callback.accept(getCount()); return service; } } calculateUpdates(); return service; }