use of org.neo4j.kernel.configuration.Config in project neo4j by neo4j.
the class EditionModule method setupSecurityModule.
protected static void setupSecurityModule(PlatformModule platformModule, Log log, Procedures procedures, String key) {
for (SecurityModule candidate : Service.load(SecurityModule.class)) {
if (candidate.matches(key)) {
try {
candidate.setup(new SecurityModule.Dependencies() {
@Override
public LogService logService() {
return platformModule.logging;
}
@Override
public Config config() {
return platformModule.config;
}
@Override
public Procedures procedures() {
return procedures;
}
@Override
public JobScheduler scheduler() {
return platformModule.jobScheduler;
}
@Override
public FileSystemAbstraction fileSystem() {
return platformModule.fileSystem;
}
@Override
public LifeSupport lifeSupport() {
return platformModule.life;
}
@Override
public DependencySatisfier dependencySatisfier() {
return platformModule.dependencies;
}
});
return;
} catch (Exception e) {
String errorMessage = "Failed to load security module.";
log.error(errorMessage);
throw new RuntimeException(errorMessage, e);
}
}
}
String errorMessage = "Failed to load security module with key '" + key + "'.";
log.error(errorMessage);
throw new IllegalArgumentException(errorMessage);
}
use of org.neo4j.kernel.configuration.Config in project neo4j by neo4j.
the class ConfigurableStandalonePageCacheFactory method createPageCache.
/**
* Create page cache
* @param fileSystem file system that page cache will be based on
* @param pageCacheTracer global page cache tracer
* @param pageCursorTracerSupplier supplier of thread local (transaction local) page cursor tracer that will provide
* thread local page cache statistics
* @param config page cache configuration
* @return created page cache instance
*/
public static PageCache createPageCache(FileSystemAbstraction fileSystem, PageCacheTracer pageCacheTracer, PageCursorTracerSupplier pageCursorTracerSupplier, Config config) {
Config finalConfig = config.withDefaults(MapUtil.stringMap(GraphDatabaseSettings.pagecache_memory.name(), "8M"));
FormattedLogProvider logProvider = FormattedLogProvider.toOutputStream(System.err);
ConfiguringPageCacheFactory pageCacheFactory = new ConfiguringPageCacheFactory(fileSystem, finalConfig, pageCacheTracer, pageCursorTracerSupplier, logProvider.getLog(PageCache.class));
return pageCacheFactory.getOrCreatePageCache();
}
use of org.neo4j.kernel.configuration.Config in project neo4j by neo4j.
the class ConfiguringPageCacheFactoryTest method mustIgnoreExplicitlySpecifiedCachePageSizeIfPageSwapperHintIsStrict.
@Test
public void mustIgnoreExplicitlySpecifiedCachePageSizeIfPageSwapperHintIsStrict() throws Exception {
// Given
int cachePageSizeHint = 16 * 1024;
PageSwapperFactoryForTesting.cachePageSizeHint.set(cachePageSizeHint);
PageSwapperFactoryForTesting.cachePageSizeHintIsStrict.set(true);
Config config = Config.embeddedDefaults(stringMap(GraphDatabaseSettings.pagecache_swapper.name(), TEST_PAGESWAPPER_NAME));
// When
ConfiguringPageCacheFactory factory = new ConfiguringPageCacheFactory(fsRule.get(), config, PageCacheTracer.NULL, PageCursorTracerSupplier.NULL, NullLog.getInstance());
// Then
try (PageCache cache = factory.getOrCreatePageCache()) {
assertThat(cache.pageSize(), is(cachePageSizeHint));
}
}
use of org.neo4j.kernel.configuration.Config in project neo4j by neo4j.
the class ConfiguringPageCacheFactoryTest method mustUseAndLogConfiguredPageSwapper.
@Test
public void mustUseAndLogConfiguredPageSwapper() throws Exception {
// Given
Config config = Config.embeddedDefaults(stringMap(pagecache_memory.name(), "8m", pagecache_swapper.name(), TEST_PAGESWAPPER_NAME));
AssertableLogProvider logProvider = new AssertableLogProvider();
Log log = logProvider.getLog(PageCache.class);
// When
new ConfiguringPageCacheFactory(fsRule.get(), config, PageCacheTracer.NULL, PageCursorTracerSupplier.NULL, log);
// Then
assertThat(PageSwapperFactoryForTesting.countCreatedPageSwapperFactories(), is(1));
assertThat(PageSwapperFactoryForTesting.countConfiguredPageSwapperFactories(), is(1));
logProvider.assertContainsMessageContaining(TEST_PAGESWAPPER_NAME);
}
use of org.neo4j.kernel.configuration.Config in project neo4j by neo4j.
the class ConfiguringPageCacheFactoryTest method mustThrowIfConfiguredPageSwapperCannotBeFound.
@Test(expected = IllegalArgumentException.class)
public void mustThrowIfConfiguredPageSwapperCannotBeFound() throws Exception {
// Given
Config config = Config.embeddedDefaults(stringMap(pagecache_memory.name(), "8m", pagecache_swapper.name(), "non-existing"));
// When
new ConfiguringPageCacheFactory(fsRule.get(), config, PageCacheTracer.NULL, PageCursorTracerSupplier.NULL, NullLog.getInstance());
}
Aggregations