-
Notifications
You must be signed in to change notification settings - Fork 534
Create RS <-> JDK9 bridge jar #294
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
Comments
Sounds good but IDE support for JDK 9 is limited, at least Eclipse can't properly use a JDK 9 installment. Same may be true with travis: no |
@akarnokd That's a good point, it ought to be possible to install the jdk9 from java.net and compile-package-publish locally. |
Figuring out how to use JDK9 with gradle may be tricky as well, though there is some support coming already https://github.com/gradle/gradle/blob/master/design-docs/jdk9-support.md |
I wonder if |
Currently I don't think it will... And it's a bit more than "using jdk9", we need to be able to compile |
Good idea we already do that with reactor and it actually passes the normal TCK: Publishers.convert(Flow.Publisher) (not sure the other way is that useful). That would be great to get that in some common jar indeed. However I failed a few tests with SubmissionPublisher so worth having a common look! Sent from my iPhone
|
Is there something wrong with |
Here is a single utility class that does the conversions. |
Nice one, David! It would be useful having the converters also introspected the parameters if (rsPublisher instanceof Flow.Publisher) return On Wed, Nov 11, 2015 at 4:58 PM, David Karnok [email protected]
Cheers, |
If one implements both APIs, it should show up in the type and there is no need to call the conversion methods. |
toFlow(toReactive(flowA)) should return flowA Cheers,
|
In this case, toFlow has to check if Publisher is the bridge's own type, look into it and extract the original flow. This is not available with the current lambda form. Since both wrappings are really thin, it doesn't really matter if one goes instanceof + cast or let the JIT inline the calls. |
Does the HotSpot JIT inline N-level nestings? And how would it trace this On Sat, Nov 14, 2015 at 3:54 PM, David Karnok [email protected]
Cheers, |
By default, HS inlines something like 20 levels deep as far as I remember but this can be increased with command line parameters. But why would you want to have such pass-through wrap-unwrap in a codebase? I think the dev should recognize this as being unnecessary and simply not do it. |
Having written a couple of these converters in the past, you'll be amazed On Sat, Nov 14, 2015 at 8:27 PM, David Karnok [email protected]
Cheers, |
@akarnokd It is needed,as you can take a look at the ForkJoinPool 's code. |
Fine, I've updated the bridge to do the checks, casts and unwrapping if necessary. |
@akarnokd Excellent! Thank you |
@akarnokd Would you like to contribute it to reactive-streams-jvm? |
Sure. |
Fantastic! Would you mind opening a PR? |
I know very little about Gradle, subprojects or how to setup a JDK 9 environment. |
Same here, but having a PR means that more people can help out. On Sat, Nov 21, 2015 at 10:15 PM, David Karnok [email protected]
Cheers, |
There is already a bridge PR waiting for Java 9/Travis/Gradle to be operational. Also implementing both interfaces at the same time causes ambiguities, plus requires internal bridging if you don't want to duplicate logic. interface MixPublisher<T> extends
org.reactivestreams.Publisher<T>, java.util.concurrent.Flow.Publisher<T> { }
interface MixSubscriber<T> extends
org.reactivestreams.Subscriber<T>, java.util.concurrent.Flow.Subscriber<T> { }
MixPublisher<T> p = ...
MixSubscriber<T> s = ...
p.subscribe(s);
^
ambiguous overload |
Sorry I deleted my previous comment by mistake. I already took a look however add the bridge IMO will make things more complicate. My idea is make the reactive-streams extends the java9 classes, like
and release a new module with org.reactivestreams:reactive-streams-java9 In this way we are not going to have ambiguities and it will allow all current implementation compatible with java 9 if running in java 9 environment. The downside it will be the dependency management. |
@rotilho That solution will not fly: jigsaw will choke on it and it will create classpath-order issues. |
Awesome to be able to close this issue, @akarnokd! :) |
Reactive Streams are available in JDK9 inside:
java.util.concurrent.Flow
.Providing converters between org.reactivestreams.* and java.util.concurrent.Flow.* would be quite useful.
I propose to add a subproject/jar to the reactive streams project.
The text was updated successfully, but these errors were encountered: