reactive-streams-jvm | Reactive Streams Specification for the JVM | Reactive Programming library
kandi X-RAY | reactive-streams-jvm Summary
kandi X-RAY | reactive-streams-jvm Summary
The purpose of Reactive Streams is to provide a standard for asynchronous stream processing with non-blocking backpressure. The latest release is available on Maven Central as.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Performs the actual runnable
- Handles a request
- Handles the onSubscribe
- Attempts to schedule the subscriber to execute
- Creates a Publisher
- Creates a new instance of the given Subscriber
- Retrieves the value of the reference reference in milliseconds
- This method is called when a blackbox test is triggered
- This benchmark is called when a blackbox test is triggered
- Schedules a Subscription
- Converts a ReactiveStreamsPublisher to a Flow Publisher
- Converts a ReactiveStreams Processor to a Flow Processor
- This method will be called when the test is received from the application
- This method should be used for testing
- Picks for a processor
- Test whether subscriber is null
- Handles the next element request
- This benchmark uses a null pointer exception to set a null pointer exception
- Attempts to be called with a nullPointerException
- A test that is invoked when the subscriber has a subscription that has already been cancelled
- This benchmark is only used for testing
- Attempts to be called by the Blackbox API
- Test to see if the Blackbox Specification is required
- Create a subscriber
reactive-streams-jvm Key Features
reactive-streams-jvm Examples and Code Snippets
Community Discussions
Trending Discussions on reactive-streams-jvm
QUESTION
Reading this code AsyncSubscriber.java : The coder uses AtomicBoolean to create a Happens Before relationships, i want to know :
1_ Is it equivalent to use a synchronized block ?
it looks that the lines
if (on.get())
dosn't ensure that the block
ANSWER
Answered 2017-Aug-27 at 09:20Yes, write/read to AtomicBolean etablishes a happens before relationship:
compareAndSet and all other read-and-update operations such as getAndIncrement have the memory effects of both reading and writing volatile variables.
Since you didn't post the entire code and we don't know how exactly this is used it is hard to say if it is thread safe or not, but:
ad 1. it is not equivalent to synchronized block - threads do not wait
ad 2. yes, it could be more efficient, but the compareAndSwap is not obligated to be backed by volatile
variable - this is datail of implementation.
ad 3. Hard to say, but the fact that run
is a public method exposes some possibility of errors, eg if two threads will invoke the run
directly when go
will have the value of true
. From my perspective it would be better to do compareAndSwap directly in the run
method, but I don't know all the requirements, so it is just a suggestion.
ad 4. Yes, AtomicBoolean is commonly used.
QUESTION
I started learning about reactive streams because I was curious about this new trend of using RxJava as a replacement for more traditional event buses. This blog post is a typical description of how this is done. If I understand correctly, RxJava 1.x was not strictly an implementation of Reactive Streams, but it was very similar. Version 2.0 includes some classes that are compliant, or at least pass the TCK, so an updated version of this code may look a little different.
...ANSWER
Answered 2017-May-04 at 08:41Subject
s and Processor
s of standard RxJava 2 are relaxed so you don't have to call onSubscribe
on them before calling the other methods. This is partly due to traditionality as 1.x Subjects didn't have an onSubscribe
and partly due to the fact that RxJava 2 Processors don't coordinate requests between the Subscriber
side and the Publisher
side by choice and thus have no use for a Subscription
.
If you subscribe an RxJava Processor
any RS compliant Publisher
, they will appear to request Long.MAX_VALUE
and relay signals as much as possible. If you subscribe an RS compliant Subscriber
to RxJava Processor
s, they will honor the backpressure of those Subscriber
s and never overflow them, however, the lack of requests may result in individual MissingBackpressureException
being emitted and the Subscriber
"thrown" away. There is a custom Publisher
in the extensions library that does coordinate requests.
Am I correct in thinking that you cannot generally rely on this working with a compliant Reactive Streams implementation.
There is nothing in the specification and thus not tested in the TCK what should happen with a Processor
that didn't receive an onSubscribe
call yet it needed it, therefore, I think this has become an implementation detail.
There are two bigger issues here:
- Subjects were invented to bridge the imperative world with the reactive world and work nicely in GUI cases and non-backpressured cases as the multicasters of events. In reactive-reactive multicasts, they are better and more direct alternatives, such as
publish(Function)
. - Thinking in event bus is a step backwards because you create a single choke point by shoveling in and draining out events on a single "rail". In contrast, design for reactive favors individual and often independent streams where each stream can jump between threads as necessary and perhaps avoid the main thread till the very last moment.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install reactive-streams-jvm
You can use reactive-streams-jvm like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the reactive-streams-jvm component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page