shalinmangar commented on a change in pull request #1100: SOLR-13579: Create 
resource management API
URL: https://github.com/apache/lucene-solr/pull/1100#discussion_r360271349
 
 

 ##########
 File path: solr/core/src/java/org/apache/solr/managed/ResourceManagerPool.java
 ##########
 @@ -0,0 +1,216 @@
+package org.apache.solr.managed;
+
+import java.io.Closeable;
+import java.io.IOException;
+import java.lang.invoke.MethodHandles;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ScheduledFuture;
+import java.util.concurrent.locks.ReentrantLock;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ */
+public abstract class ResourceManagerPool<T extends ManagedComponent> 
implements Closeable {
+  private static final Logger log = 
LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+
+  protected final String name;
+  protected final String type;
+  protected Map<String, Object> poolLimits;
+  protected final Map<String, T> components = new ConcurrentHashMap<>();
+  protected final ResourceManager resourceManager;
+  protected final Class<? extends ManagedComponent> componentClass;
+  private final Map<String, Object> poolParams;
+  protected final ResourcePoolContext poolContext = new ResourcePoolContext();
+  protected final List<ChangeListener> listeners = new ArrayList<>();
 
 Review comment:
   The listeners ArrayList is not thread-safe. Perhaps this should be a 
CopyOnWriteArraySet to avoid accidental duplicates in the list. If yes, we 
should modify the ChangeListener javadoc to say that equals and hashCode 
methods are required.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to