Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom PluginLifecycle - Configuration object returns null properties. #4851

Closed
bHacklv opened this issue Jun 18, 2015 · 1 comment
Closed

Comments

@bHacklv
Copy link

bHacklv commented Jun 18, 2015

Hi,

I've written my own custom PluginLifecycle (which implements that interface) where I want to get some default and custom properties from Neo4j server configuration.
One of them is:

org.neo4j.server.transaction.timeout

The Configuration Interface implementation in method

public Collection<Injectable<?>> start(GraphDatabaseService graphDatabaseService, Configuration config)

is returned as ConfigWrappingConfiguration.

When I try to do:

getProperty("org.neo4j.server.transaction.timeout") 
or 
getProperty(ServerSettings.transaction_timeout.name())

The result is: null. Moreover, config.getKeys() returns empty iterator...
By debugging/looking through the code it is obvious that it is then propagated to Config config (that is injected through the constructor, but I was not able to find out from where, since I was not able to track down where the ConfigWrappingConfiguration came from...).

So the issue starts in that method:

Map<String, Setting<?>> getRegisteredSettings()

It tries to get **Iterable<Class> settingsClasses** from **Config config**, which for me it returns **ArrayList**, which contains **2 EmptyList**s. It should have came from Config config's method: ` public Config registerSettingsClasses( Iterable> settingsClasses )
`
which is invoked as part of Config constructor, but Config constructor's settingsClasses variable is always EmptyList.
So that's the problem...

More on that though:
If I use reflection (or just look into that Config config object in debugger), I can see (and access with reflection...) that there are params and settingsFunction variables, that both contain all of my predefined Properties, i.e.:

0 = {ConcurrentHashMap$WriteThroughEntry@4199} "org.neo4j.server.transaction.timeout" -> "1s"
1 = {ConcurrentHashMap$WriteThroughEntry@4200} "org.neo4j.server.database.location" -> "...\AppData\Local\Temp\F86DE657B3B405601B5802EAF50DBDD4"
2 = {ConcurrentHashMap$WriteThroughEntry@4201} "org.neo4j.server.thirdparty_jaxrs_classes" -> "...=/ext"
3 = {ConcurrentHashMap$WriteThroughEntry@4202} "org.neo4j.server.webserver.port" -> "7474"
4 = {ConcurrentHashMap$WriteThroughEntry@4203} "dbms.pagecache.memory" -> "8m"
5 = {ConcurrentHashMap$WriteThroughEntry@4204} "dbms.security.auth_enabled" -> "false"

Note that the org.neo4j.server.transaction.timeout is not defaulting to 60s, but is changed to my own value, that I've set.
So the properties are there... But the settingsClasses bit is not working properly.

Lastly, I know that there is SPIPluginLifecycle, which exposes NeoServer, and I can easily get Config from it (I already had that implementation done). However, that would be the only thing that drags in whole neo4j-server dependency. Instead, I want to stick with the server-api.
Thanks.

@jakewins
Copy link
Contributor

jakewins commented Aug 7, 2015

Resolved by PR #4936

@jakewins jakewins closed this as completed Aug 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants