use of org.apache.jackrabbit.oak.plugins.document.persistentCache.CacheType in project jackrabbit-oak by apache.
the class DocumentNodeStoreService method registerJMXBeans.
private void registerJMXBeans(final DocumentNodeStore store, DocumentMK.Builder mkBuilder) throws IOException {
addRegistration(registerMBean(whiteboard, CacheStatsMBean.class, store.getNodeCacheStats(), CacheStatsMBean.TYPE, store.getNodeCacheStats().getName()));
addRegistration(registerMBean(whiteboard, CacheStatsMBean.class, store.getNodeChildrenCacheStats(), CacheStatsMBean.TYPE, store.getNodeChildrenCacheStats().getName()));
for (CacheStats cs : store.getDiffCacheStats()) {
addRegistration(registerMBean(whiteboard, CacheStatsMBean.class, cs, CacheStatsMBean.TYPE, cs.getName()));
}
DocumentStore ds = store.getDocumentStore();
if (ds.getCacheStats() != null) {
for (CacheStats cacheStats : ds.getCacheStats()) {
addRegistration(registerMBean(whiteboard, CacheStatsMBean.class, cacheStats, CacheStatsMBean.TYPE, cacheStats.getName()));
}
}
addRegistration(registerMBean(whiteboard, CheckpointMBean.class, new DocumentCheckpointMBean(store), CheckpointMBean.TYPE, "Document node store checkpoint management"));
addRegistration(registerMBean(whiteboard, DocumentNodeStoreMBean.class, store.getMBean(), DocumentNodeStoreMBean.TYPE, "Document node store management"));
if (mkBuilder.getBlobStoreCacheStats() != null) {
addRegistration(registerMBean(whiteboard, CacheStatsMBean.class, mkBuilder.getBlobStoreCacheStats(), CacheStatsMBean.TYPE, mkBuilder.getBlobStoreCacheStats().getName()));
}
if (mkBuilder.getDocumentStoreStatsCollector() instanceof DocumentStoreStatsMBean) {
addRegistration(registerMBean(whiteboard, DocumentStoreStatsMBean.class, (DocumentStoreStatsMBean) mkBuilder.getDocumentStoreStatsCollector(), DocumentStoreStatsMBean.TYPE, "DocumentStore Statistics"));
}
// register persistent cache stats
Map<CacheType, PersistentCacheStats> persistenceCacheStats = mkBuilder.getPersistenceCacheStats();
for (PersistentCacheStats pcs : persistenceCacheStats.values()) {
addRegistration(registerMBean(whiteboard, PersistentCacheStatsMBean.class, pcs, PersistentCacheStatsMBean.TYPE, pcs.getName()));
}
final long versionGcMaxAgeInSecs = toLong(prop(PROP_VER_GC_MAX_AGE), DEFAULT_VER_GC_MAX_AGE);
final long blobGcMaxAgeInSecs = toLong(prop(PROP_BLOB_GC_MAX_AGE), DEFAULT_BLOB_GC_MAX_AGE);
if (store.getBlobStore() instanceof GarbageCollectableBlobStore) {
BlobGarbageCollector gc = store.createBlobGarbageCollector(blobGcMaxAgeInSecs, ClusterRepositoryInfo.getOrCreateId(nodeStore));
addRegistration(registerMBean(whiteboard, BlobGCMBean.class, new BlobGC(gc, executor), BlobGCMBean.TYPE, "Document node store blob garbage collection"));
}
Runnable startGC = new Runnable() {
@Override
public void run() {
try {
store.getVersionGarbageCollector().gc(versionGcMaxAgeInSecs, TimeUnit.SECONDS);
} catch (IOException e) {
log.warn("Error occurred while executing the Version Garbage Collector", e);
}
}
};
Runnable cancelGC = new Runnable() {
@Override
public void run() {
store.getVersionGarbageCollector().cancel();
}
};
Supplier<String> status = new Supplier<String>() {
@Override
public String get() {
return store.getVersionGarbageCollector().getStatus();
}
};
RevisionGC revisionGC = new RevisionGC(startGC, cancelGC, status, executor);
addRegistration(registerMBean(whiteboard, RevisionGCMBean.class, revisionGC, RevisionGCMBean.TYPE, "Document node store revision garbage collection"));
BlobStoreStats blobStoreStats = mkBuilder.getBlobStoreStats();
if (!customBlobStore && blobStoreStats != null) {
addRegistration(registerMBean(whiteboard, BlobStoreStatsMBean.class, blobStoreStats, BlobStoreStatsMBean.TYPE, ds.getClass().getSimpleName()));
}
if (!mkBuilder.isBundlingDisabled()) {
addRegistration(registerMBean(whiteboard, BackgroundObserverMBean.class, store.getBundlingConfigHandler().getMBean(), BackgroundObserverMBean.TYPE, "BundlingConfigObserver"));
}
}
use of org.apache.jackrabbit.oak.plugins.document.persistentCache.CacheType in project jackrabbit-oak by apache.
the class DocumentNodeStoreService method registerJMXBeans.
private void registerJMXBeans(final DocumentNodeStore store, DocumentNodeStoreBuilder<?> mkBuilder) throws IOException {
registerCacheStatsMBean(store.getNodeCacheStats());
registerCacheStatsMBean(store.getNodeChildrenCacheStats());
for (CacheStats cs : store.getDiffCacheStats()) {
registerCacheStatsMBean(cs);
}
DocumentStore ds = store.getDocumentStore();
if (ds.getCacheStats() != null) {
for (CacheStats cacheStats : ds.getCacheStats()) {
registerCacheStatsMBean(cacheStats);
}
}
addRegistration(registerMBean(whiteboard, CheckpointMBean.class, new DocumentCheckpointMBean(store), CheckpointMBean.TYPE, "Document node store checkpoint management"));
addRegistration(registerMBean(whiteboard, DocumentNodeStoreMBean.class, store.getMBean(), DocumentNodeStoreMBean.TYPE, "Document node store management"));
if (mkBuilder.getBlobStoreCacheStats() != null) {
registerCacheStatsMBean(mkBuilder.getBlobStoreCacheStats());
}
if (mkBuilder.getDocumentStoreStatsCollector() instanceof DocumentStoreStatsMBean) {
addRegistration(registerMBean(whiteboard, DocumentStoreStatsMBean.class, (DocumentStoreStatsMBean) mkBuilder.getDocumentStoreStatsCollector(), DocumentStoreStatsMBean.TYPE, "DocumentStore Statistics"));
}
// register persistent cache stats
Map<CacheType, PersistentCacheStats> persistenceCacheStats = mkBuilder.getPersistenceCacheStats();
for (PersistentCacheStats pcs : persistenceCacheStats.values()) {
addRegistration(registerMBean(whiteboard, PersistentCacheStatsMBean.class, pcs, PersistentCacheStatsMBean.TYPE, pcs.getName()));
}
final long versionGcMaxAgeInSecs = config.versionGcMaxAgeInSecs();
final long blobGcMaxAgeInSecs = config.blobGcMaxAgeInSecs();
if (store.getBlobStore() instanceof GarbageCollectableBlobStore) {
BlobGarbageCollector gc = store.createBlobGarbageCollector(blobGcMaxAgeInSecs, ClusterRepositoryInfo.getOrCreateId(nodeStore), whiteboard);
addRegistration(registerMBean(whiteboard, BlobGCMBean.class, new BlobGC(gc, executor), BlobGCMBean.TYPE, "Document node store blob garbage collection"));
}
Runnable startGC = new RevisionGCJob(store, versionGcMaxAgeInSecs, 0);
Runnable cancelGC = () -> store.getVersionGarbageCollector().cancel();
Supplier<String> status = () -> store.getVersionGarbageCollector().getStatus();
RevisionGC revisionGC = new RevisionGC(startGC, cancelGC, status, executor);
addRegistration(registerMBean(whiteboard, RevisionGCMBean.class, revisionGC, RevisionGCMBean.TYPE, "Document node store revision garbage collection"));
addRegistration(registerMBean(whiteboard, RevisionGCStatsMBean.class, store.getVersionGarbageCollector().getRevisionGCStats(), RevisionGCStatsMBean.TYPE, "Document node store revision garbage collection statistics"));
BlobStoreStats blobStoreStats = mkBuilder.getBlobStoreStats();
if (!customBlobStore && blobStoreStats != null) {
addRegistration(registerMBean(whiteboard, BlobStoreStatsMBean.class, blobStoreStats, BlobStoreStatsMBean.TYPE, ds.getClass().getSimpleName()));
}
if (!mkBuilder.isBundlingDisabled()) {
addRegistration(registerMBean(whiteboard, BackgroundObserverMBean.class, store.getBundlingConfigHandler().getMBean(), BackgroundObserverMBean.TYPE, "BundlingConfigObserver"));
}
}
Aggregations