public class PollCachingESRegistry extends CachingESRegistry
ESRegistry to provide multi-node caching. This caching solution
will work in a cluster, although it is a rather naive implementation. The approach
taken is that whenever the ES index is modified, a "last modified" record is set in
elasticsearch. The registry utilizes a thread to periodically poll the ES store to
check if the data has been changed. If the data *has* been changed, then the cache
is invalidated.| Constructor and Description |
|---|
PollCachingESRegistry(Map<String,String> config)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkCacheVersion()
Checks the ES store to see if the 'dataVersion' entry has been updated with a newer
version #.
|
protected void |
finalize() |
void |
publishService(io.apiman.gateway.engine.beans.Service service,
io.apiman.gateway.engine.async.IAsyncResultHandler<Void> handler) |
void |
registerApplication(io.apiman.gateway.engine.beans.Application application,
io.apiman.gateway.engine.async.IAsyncResultHandler<Void> handler) |
void |
retireService(io.apiman.gateway.engine.beans.Service service,
io.apiman.gateway.engine.async.IAsyncResultHandler<Void> handler) |
protected void |
startCacheInvalidator()
Starts up a thread that polls the ES store for updates.
|
void |
unregisterApplication(io.apiman.gateway.engine.beans.Application application,
io.apiman.gateway.engine.async.IAsyncResultHandler<Void> handler) |
protected void |
updateDataVersion()
Stores a "dataversion" record in the ES store.
|
cacheApplication, cacheService, decacheApplication, decacheService, getContract, getService, invalidateCache, loadAndCacheAppcheckService, getIndexName, getService, unregisterServiceContractsgetClientpublic void publishService(io.apiman.gateway.engine.beans.Service service,
io.apiman.gateway.engine.async.IAsyncResultHandler<Void> handler)
publishService in interface io.apiman.gateway.engine.IRegistrypublishService in class CachingESRegistryCachingESRegistry.publishService(io.apiman.gateway.engine.beans.Service, io.apiman.gateway.engine.async.IAsyncResultHandler)public void retireService(io.apiman.gateway.engine.beans.Service service,
io.apiman.gateway.engine.async.IAsyncResultHandler<Void> handler)
retireService in interface io.apiman.gateway.engine.IRegistryretireService in class CachingESRegistryCachingESRegistry.retireService(io.apiman.gateway.engine.beans.Service, io.apiman.gateway.engine.async.IAsyncResultHandler)public void registerApplication(io.apiman.gateway.engine.beans.Application application,
io.apiman.gateway.engine.async.IAsyncResultHandler<Void> handler)
registerApplication in interface io.apiman.gateway.engine.IRegistryregisterApplication in class CachingESRegistryCachingESRegistry.registerApplication(io.apiman.gateway.engine.beans.Application, io.apiman.gateway.engine.async.IAsyncResultHandler)public void unregisterApplication(io.apiman.gateway.engine.beans.Application application,
io.apiman.gateway.engine.async.IAsyncResultHandler<Void> handler)
unregisterApplication in interface io.apiman.gateway.engine.IRegistryunregisterApplication in class CachingESRegistryCachingESRegistry.unregisterApplication(io.apiman.gateway.engine.beans.Application, io.apiman.gateway.engine.async.IAsyncResultHandler)protected void updateDataVersion()
protected void startCacheInvalidator()
protected void finalize()
throws Throwable
finalize in class ObjectThrowableObject.finalize()protected void checkCacheVersion()
Copyright © 2015 JBoss, a division of Red Hat. All rights reserved.