[ 
https://issues.apache.org/jira/browse/SOLR-13579?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16897347#comment-16897347
 ] 

Hoss Man commented on SOLR-13579:
---------------------------------


bq. We could perhaps call a type-safe and name-safe component API from a 
generic management API by following a similar convention as the one used in 
SolrPluginUtils.invokeSetters? Or use marker interfaces that also provide 
validation / conversion. I'll look into this.

Unless there's something i'm missing (and that's incredibly likely) I don't 
even think you'd need a SolrPluginUtils.invokeSetters type hack for any of this 
-- except maybe mapping REST commands in the ResourceManagerHandler to methods 
in the ResourceManagerPlugins?

what i was imagining was a more straightfoward subclass/subinterface 
relationship and using generics to tightly couple the ManagedComponent impls to 
the corresponding ResourceManagerPlugins -- so the plugins could hav a 
completey staticly typed APIs for calling methods on the Components.  ala...

{code}
public interface ManagedComponent {
  ManagedComponentId getManagedComponentId();
  ...
}

public abstract ResourceManagerPlugin<T extends ManagedComponent> {
  /** if needed by ResourceManagerHandler or metrics */
  public abstract void setResourceLimits(ManagedComponentId component, 
Map<String, Object> limits);
  /** if needed by ResourceManagerHandler or metrics */
  public abstract Map<String, Object> getResourceLimits(ManagedComponentId 
component);
  ...
  // other general API methods needed for linking/registering type "T" 
components
  // (or Pool<T>) and for "managing" all of them...
  ...
}

public interface ManagedCacheComponent implements ManagedComponent {
  // actual caches implement this, and only have to worry about type specific 
methods
  // for managing their resource realted settings -- nothing about the REST 
API...
  public void setMaxSize(long size);
  public void setMaxRamMB(int maxRamMB);
  public long getMaxSize();
  public int getMaxRamMB();
}

public class CacheManagerPlugin extends 
ResourceManagerPlugin<ManagedCacheComponent> {
  // comncrete impls like this can use the staticly typed get/set methods of 
the concrete
  // ManagedComponent impls in their getResourceLimits/setResourceLimits & 
manage methods
  ...
}
{code}



> Create resource management API
> ------------------------------
>
>                 Key: SOLR-13579
>                 URL: https://issues.apache.org/jira/browse/SOLR-13579
>             Project: Solr
>          Issue Type: New Feature
>            Reporter: Andrzej Bialecki 
>            Assignee: Andrzej Bialecki 
>            Priority: Major
>         Attachments: SOLR-13579.patch, SOLR-13579.patch, SOLR-13579.patch, 
> SOLR-13579.patch, SOLR-13579.patch, SOLR-13579.patch
>
>
> Resource management framework API supporting the goals outlined in SOLR-13578.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to