public abstract class NamespaceExtractionCacheManager extends Object
Modifier and Type | Field and Description |
---|---|
protected AtomicLong |
dataSize |
protected ConcurrentMap<String,com.google.common.base.Function<String,String>> |
fnCache |
protected ConcurrentMap<String,io.druid.server.namespace.cache.NamespaceExtractionCacheManager.NamespaceImplData> |
implData |
protected com.metamx.emitter.service.ServiceEmitter |
serviceEmitter |
protected AtomicLong |
tasksStarted |
Constructor and Description |
---|
NamespaceExtractionCacheManager(com.metamx.common.lifecycle.Lifecycle lifecycle,
ConcurrentMap<String,com.google.common.base.Function<String,String>> fnCache,
com.metamx.emitter.service.ServiceEmitter serviceEmitter,
Map<Class<? extends ExtractionNamespace>,ExtractionNamespaceFunctionFactory<?>> namespaceFunctionFactoryMap) |
Modifier and Type | Method and Description |
---|---|
boolean |
delete(String ns)
Clears out resources used by the namespace such as threads.
|
abstract ConcurrentMap<String,String> |
getCacheMap(String namespaceOrCacheKey)
Return a ConcurrentMap with the specified ID (either namespace's name or a cache key ID)
|
Collection<String> |
getKnownNamespaces() |
protected <T extends ExtractionNamespace> |
getPostRunnable(T namespace,
ExtractionNamespaceFunctionFactory<T> factory,
String cacheId) |
String |
getVersion(String namespace) |
<T extends ExtractionNamespace> |
schedule(T namespace) |
protected <T extends ExtractionNamespace> |
schedule(T namespace,
ExtractionNamespaceFunctionFactory<T> factory,
Runnable postRunnable,
String cacheId) |
void |
scheduleOrUpdate(Collection<ExtractionNamespace> namespaces) |
protected abstract boolean |
swapAndClearCache(String namespaceKey,
String cacheKey)
This method is expected to swap the cacheKey into the active namespace, and leave future requests for new cacheKey available.
|
protected void |
waitForServiceToEnd(long time,
TimeUnit unit) |
protected final ConcurrentMap<String,com.google.common.base.Function<String,String>> fnCache
protected final ConcurrentMap<String,io.druid.server.namespace.cache.NamespaceExtractionCacheManager.NamespaceImplData> implData
protected final AtomicLong tasksStarted
protected final AtomicLong dataSize
protected final com.metamx.emitter.service.ServiceEmitter serviceEmitter
public NamespaceExtractionCacheManager(com.metamx.common.lifecycle.Lifecycle lifecycle, ConcurrentMap<String,com.google.common.base.Function<String,String>> fnCache, com.metamx.emitter.service.ServiceEmitter serviceEmitter, Map<Class<? extends ExtractionNamespace>,ExtractionNamespaceFunctionFactory<?>> namespaceFunctionFactoryMap)
protected void waitForServiceToEnd(long time, TimeUnit unit) throws InterruptedException
InterruptedException
protected <T extends ExtractionNamespace> Runnable getPostRunnable(T namespace, ExtractionNamespaceFunctionFactory<T> factory, String cacheId)
public void scheduleOrUpdate(Collection<ExtractionNamespace> namespaces)
public <T extends ExtractionNamespace> com.google.common.util.concurrent.ListenableFuture<?> schedule(T namespace)
protected <T extends ExtractionNamespace> com.google.common.util.concurrent.ListenableFuture<?> schedule(T namespace, ExtractionNamespaceFunctionFactory<T> factory, Runnable postRunnable, String cacheId)
protected abstract boolean swapAndClearCache(String namespaceKey, String cacheKey)
namespaceKey
- The namespace to swap the cache intocacheKey
- The cacheKey that contains the data of interestpublic abstract ConcurrentMap<String,String> getCacheMap(String namespaceOrCacheKey)
namespaceOrCacheKey
- Either a namespace or cache key should be acceptable here.public boolean delete(String ns)
ns
- The namespace to be deletedcom.metamx.common.ISE
- if there is an error cancelling the namespace's future taskpublic Collection<String> getKnownNamespaces()
Copyright © 2011–2015. All rights reserved.