Search in sources :

Example 6 with BlobStoreStats

use of org.apache.jackrabbit.oak.plugins.blob.BlobStoreStats in project jackrabbit-oak by apache.

the class AbstractDataStoreService method activate.

protected void activate(ComponentContext context, Map<String, Object> config) throws RepositoryException {
    // change to mutable map. may be modified in createDS call
    config = Maps.newHashMap(config);
    DataStore ds = createDataStore(context, config);
    boolean encodeLengthInId = PropertiesUtil.toBoolean(config.get(PROP_ENCODE_LENGTH), true);
    int cacheSizeInMB = PropertiesUtil.toInteger(config.get(PROP_CACHE_SIZE), DataStoreBlobStore.DEFAULT_CACHE_SIZE);
    String homeDir = lookup(context, PROP_HOME);
    if (config.containsKey(PATH) && !Strings.isNullOrEmpty((String) config.get(PATH))) {
        log.info("Initializing the DataStore with path [{}]", config.get(PATH));
    } else if (homeDir != null) {
        log.info("Initializing the DataStore with homeDir [{}]", homeDir);
    }
    PropertiesUtil.populate(ds, config, false);
    ds.init(homeDir);
    BlobStoreStats stats = new BlobStoreStats(getStatisticsProvider());
    this.dataStore = new DataStoreBlobStore(ds, encodeLengthInId, cacheSizeInMB);
    this.dataStore.setBlobStatsCollector(stats);
    PropertiesUtil.populate(dataStore, config, false);
    Dictionary<String, Object> props = new Hashtable<String, Object>();
    props.put(Constants.SERVICE_PID, ds.getClass().getName());
    props.put(DESCRIPTION, getDescription());
    if (context.getProperties().get(PROP_SPLIT_BLOBSTORE) != null) {
        props.put(PROP_SPLIT_BLOBSTORE, context.getProperties().get(PROP_SPLIT_BLOBSTORE));
    }
    reg = context.getBundleContext().registerService(new String[] { BlobStore.class.getName(), GarbageCollectableBlobStore.class.getName() }, dataStore, props);
    mbeanReg = registerMBeans(context.getBundleContext(), dataStore, stats);
}
Also used : Hashtable(java.util.Hashtable) DataStore(org.apache.jackrabbit.core.data.DataStore) BlobStoreStats(org.apache.jackrabbit.oak.plugins.blob.BlobStoreStats)

Aggregations

BlobStoreStats (org.apache.jackrabbit.oak.plugins.blob.BlobStoreStats)6 FileDataStore (org.apache.jackrabbit.core.data.FileDataStore)2 CheckpointMBean (org.apache.jackrabbit.oak.api.jmx.CheckpointMBean)2 PersistentCacheStatsMBean (org.apache.jackrabbit.oak.api.jmx.PersistentCacheStatsMBean)2 CacheStats (org.apache.jackrabbit.oak.cache.CacheStats)2 BlobGC (org.apache.jackrabbit.oak.plugins.blob.BlobGC)2 BlobGCMBean (org.apache.jackrabbit.oak.plugins.blob.BlobGCMBean)2 BlobGarbageCollector (org.apache.jackrabbit.oak.plugins.blob.BlobGarbageCollector)2 DataStoreBlobStore (org.apache.jackrabbit.oak.plugins.blob.datastore.DataStoreBlobStore)2 CacheType (org.apache.jackrabbit.oak.plugins.document.persistentCache.CacheType)2 PersistentCacheStats (org.apache.jackrabbit.oak.plugins.document.persistentCache.PersistentCacheStats)2 GarbageCollectableBlobStore (org.apache.jackrabbit.oak.spi.blob.GarbageCollectableBlobStore)2 BlobStoreStatsMBean (org.apache.jackrabbit.oak.spi.blob.stats.BlobStoreStatsMBean)2 BackgroundObserverMBean (org.apache.jackrabbit.oak.spi.commit.BackgroundObserverMBean)2 RevisionGC (org.apache.jackrabbit.oak.spi.state.RevisionGC)2 RevisionGCMBean (org.apache.jackrabbit.oak.spi.state.RevisionGCMBean)2 Supplier (com.google.common.base.Supplier)1 File (java.io.File)1 IOException (java.io.IOException)1 Hashtable (java.util.Hashtable)1