accumulo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Keith Turner (JIRA)" <>
Subject [jira] [Created] (ACCUMULO-4837) Allow short service names in addition to class names.
Date Thu, 01 Mar 2018 22:34:00 GMT
Keith Turner created ACCUMULO-4837:

             Summary: Allow short service names in addition to class names.
                 Key: ACCUMULO-4837
             Project: Accumulo
          Issue Type: Improvement
            Reporter: Keith Turner

In 2.0.0-SNAPSHOT the cache implementation was made configurable.  Currently to configure
it, you set a property like the following.


I would much rather be able to provide a short service name like the following when configuring
the cache.  However I do not want the list to be predefined, I will want the user to be able
to provide implementations.


What is a good way to do this? Is there a good reason not do this and just stick with class
names only?  I was also thinking it may be nice to have a shell command for listing services,
but this could be done independently.

One way I thought of doing this is having an interface like the the following that services
(balancer, compaction strategy, cache, etc) could implement.

public interface AccumuloService {
   * A human readable, short, unique identification that can be specified in configuration
to identify a service implementation.
  public String getName();

  public static <C extends AccumuloService> C load(String configId, Class<C> serviceType,
ClassLoader classLoader) {
    ServiceLoader<C> services = ServiceLoader.load(serviceType, classLoader);

    for (C service : services) {
      if(service.getName().equals(configId) || service.getClass().getName().equals(configId))
        return service;

    return null;

Then the cache implementation could provide a name

//assume BlockCacheManager implements AccumuloService
public class TinyLfuBlockCacheManager extends BlockCacheManager {

  private static final Logger LOG = LoggerFactory.getLogger(TinyLfuBlockCacheManager.class);

  protected TinyLfuBlockCache createCache(Configuration conf, CacheType type) {"Creating {} cache with configuration {}", type, conf);
    return new TinyLfuBlockCache(conf, type);

  public String getName() {
    return "tinylfu";

The code to load a block cache impl would look like the following :

    String impl = conf.get(Property.TSERV_CACHE_MANAGER_IMPL);
    BlockCacheManager bcm = AccumuloService.load(impl, BlockCacheManager.class, AccumuloVFSClassLoader.getClassLoader());

This message was sent by Atlassian JIRA

View raw message