use of com.palantir.lock.watch.LockWatchEventCache in project atlasdb by palantir.
the class LockWatchManagerImpl method create.
public static LockWatchManagerInternal create(MetricsManager metricsManager, Set<Schema> schemas, LockWatchStarter lockWatchingService, LockWatchCachingConfig config) {
Set<LockWatchReference> referencesFromSchema = schemas.stream().map(Schema::getLockWatches).flatMap(Set::stream).collect(Collectors.toSet());
Set<TableReference> watchedTablesFromSchema = referencesFromSchema.stream().map(schema -> schema.accept(LockWatchReferencesVisitor.INSTANCE)).collect(Collectors.toSet());
CacheMetrics metrics = CacheMetrics.create(metricsManager);
LockWatchEventCache eventCache = LockWatchEventCacheImpl.create(metrics);
LockWatchValueScopingCache valueCache = LockWatchValueScopingCacheImpl.create(eventCache, metrics, config.cacheSize(), config.validationProbability(), watchedTablesFromSchema);
return new LockWatchManagerImpl(referencesFromSchema, eventCache, valueCache, lockWatchingService);
}
Aggregations