File tree 1 file changed +4
-9
lines changed
src/main/java/org/scijava/plugin
1 file changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -65,9 +65,7 @@ public abstract class AbstractSingletonService<PT extends SingletonPlugin>
65
65
66
66
@ Override
67
67
public List <PT > getInstances () {
68
- if (instances == null ) {
69
- createInstances ();
70
- }
68
+ if (instances == null ) initInstances ();
71
69
return instances ;
72
70
}
73
71
@@ -93,18 +91,15 @@ public ArrayList<Object> get() {
93
91
94
92
// -- Helper methods --
95
93
96
- private void createInstances () {
94
+ private synchronized void initInstances () {
95
+ if (instances != null ) return ;
96
+
97
97
instances =
98
98
Collections .unmodifiableList (filterInstances (getPluginService ()
99
99
.createInstancesOfType (getPluginType ())));
100
100
101
101
log .info ("Found " + instances .size () + " " +
102
102
getPluginType ().getSimpleName () + " plugins." );
103
-
104
- // register singleton instances with the object service
105
- for (final PT instance : instances ) {
106
- objectService .addObject (instance );
107
- }
108
103
}
109
104
110
105
/**
You can’t perform that action at this time.
0 commit comments