-
Notifications
You must be signed in to change notification settings - Fork 13k
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
[FLINK-2425]Provide access to task manager configuration from RuntimeEnvironment #952
Conversation
If we want to unmodifiable configuration to be usable like any other configuration, it needs to be a subclass that overrides all mutating methods. To make sure that is safe, it should also have a test that sees that all "set*" methods from the superclass are overridden. |
a8b0deb
to
1a93781
Compare
Added test to verify all setter methods are overridden by the |
I think that silently failing is not a good idea in this case. Silent failures always keep people wondering why things don't behave like they expect. It needs to fail with an exception here. Also, let's make the UnmodifiableConfiguration very lightweight, so that creating it has little overhead and footprint. Best way to do this is have it actually wrap the configuration, and have all the "getX()" methods delegate to the config, while all the "setX()" methods fail with an exception. |
For the test it is important that it catches the case where someone adds a method (for example "setStringArray()") to the base class and does not override it in the superclass. We could also catch that easier, if we make the "setInternal()" method package private and override it in the UnmodifiableConfiguration to throw an exception. |
That was my earlier solution [which is gone now because I rebased and force pushed :( ]. You're right though. It'd certainly make the initialization easier, but adds an additional calling overhead for every getter method [which are the most frequent. Initialization will be done exactly once]. IMO that's not a good idea.
That's easy enough! :') I just wasn't sure.
The assumption being that any modifiers will be named |
The earlier version had the Unmodifiable Config not as a subclass, which is crucial. Adding into the config is probably good enough, no need to over optimize this, I guess. The assumption that mutating methods start with "set" or "add" is fair, IMHO. |
bb613b5
to
998fe3e
Compare
Looks good, modulo some styles...
I need this quite soon, so let me take this over... |
Ah. Okay. You can fix the remaining things. |
@StephanEwen, since this has been merged, what do you think of exposing access to task manager configuration to the runtime context? This would open up a lot of possibilities by just modifying the |
It should however be called |
@sachingoel0101 Since this has been merged, could you close the PR? |
Also fixes [FLINK-2426]: Define an UnmodifiableConfiguration class which doesn't allow modifications to the underlying configuration object.