Allow task to override ForkingTaskRunner tunings and jvm settings#1604
Allow task to override ForkingTaskRunner tunings and jvm settings#1604himanshug merged 1 commit intoapache:masterfrom
Conversation
There was a problem hiding this comment.
not sure if we are gaining anything by using generics in this case?
There was a problem hiding this comment.
I agree there. Can this just be Object?
or alternatively, have some other way of doing better type enforcing?
There was a problem hiding this comment.
I used the same semantics as used by druid queries.
I like this way so that user of this method need not worry about casting the returned value.
I can change it to Object as return type if you feel strongly about it ?
There was a problem hiding this comment.
Adding new comments to modified code
|
looks ok to me overall on first glance |
4d72094 to
b4a269c
Compare
There was a problem hiding this comment.
As per prior comment. Suggest simply making Object and make the caller handle proper type checking.
There was a problem hiding this comment.
changing to Object as return type.
b4a269c to
f50874d
Compare
|
@himanshug @drcrallen handled the review comments. |
There was a problem hiding this comment.
Can you add a unit test for this case:
Have an interface which is expected from the context. But specify an implementation of that interface as the default value.
Does the casting and type detection work correctly? More specifically, in such a case is <ContextType> determined from the return or the parameter?
It may need something like public <ContextType, ContextTypeSub extends ContextType> ContextType getContextValue(String key, ContextTypeSub defaultValue)
There was a problem hiding this comment.
added test.
the type detection is done on return type.
f50874d to
bcdf7a5
Compare
|
Cool, I'm 👍 after travis |
There was a problem hiding this comment.
java is funny with generics.
Can you try context = ImmutableMap.<String, Object>of("k1", 10)
then try getting getContextValue("k1","hello")
for me it failed and I believe to make it really work you have to do what @drcrallen suggested. However, at the same time, I don't know if so much complication is really needed here. Is getContextValue(key,default) really essential or we should just remove it.
For me getContext() and getContextValue(key) would already be enough.
There was a problem hiding this comment.
removed the method, it was not used anywhere anyways.
override javaOpts fix compilation review comments Add Test for typecast review comments - remove unused method.
bcdf7a5 to
726326a
Compare
|
LGTM (after Travis) |
|
bouncing for travis |
Allow task to override ForkingTaskRunner tunings and jvm settings
There was a problem hiding this comment.
@nishantmonu51 I think this will throw NPE if context is not provided.
|
@guobingkun thanks for the catch, created #1703. |
Initial PR for discussion.
TODO: