com.bigdata.service.IndexCache Maven / Gradle / Ivy
package com.bigdata.service;
import com.bigdata.mdi.IMetadataIndex;
import com.bigdata.service.ndx.ClientIndexView;
import com.bigdata.service.ndx.IClientIndex;
import com.bigdata.service.ndx.IScaleOutClientIndex;
/**
* Concrete implementation for {@link IClientIndex} views.
*
* @author Bryan Thompson
* @version $Id$
* @param
*/
public class IndexCache extends AbstractIndexCache{
private final AbstractScaleOutFederation> fed;
public IndexCache(final AbstractScaleOutFederation> fed, final int capacity,
final long timeout) {
super(capacity, timeout);
if (fed == null)
throw new IllegalArgumentException();
this.fed = fed;
}
@Override
protected ClientIndexView newView(final String name, final long timestamp) {
final IMetadataIndex mdi = fed.getMetadataIndex(name, timestamp);
// No such index.
if (mdi == null) {
if (log.isInfoEnabled())
log.info("name=" + name + " @ " + timestamp
+ " : is not registered");
return null;
}
// Index exists.
return new ClientIndexView(fed, name, timestamp, mdi);
}
protected void dropIndexFromCache(final String name) {
// drop the index from the cache.
super.dropIndexFromCache(name);
// and drop the metadata index from its cache as well.
fed.getMetadataIndexCache().dropIndexFromCache(name);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy