kandi background
Explore Kits

reactive-streams-jvm | Reactive Streams Specification for the JVM | Reactive Programming library

 by   reactive-streams Java Version: Current License: Non-SPDX

 by   reactive-streams Java Version: Current License: Non-SPDX

Download this library from

kandi X-RAY | reactive-streams-jvm Summary

reactive-streams-jvm is a Java library typically used in Programming Style, Reactive Programming applications. reactive-streams-jvm has no vulnerabilities, it has build file available and it has medium support. However reactive-streams-jvm has 39 bugs and it has a Non-SPDX License. You can download it from GitHub.
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
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • reactive-streams-jvm has a medium active ecosystem.
  • It has 4094 star(s) with 437 fork(s). There are 276 watchers for this library.
  • It had no major release in the last 12 months.
  • There are 12 open issues and 242 have been closed. On average issues are closed in 346 days. There are 5 open pull requests and 0 closed requests.
  • It has a neutral sentiment in the developer community.
  • The latest version of reactive-streams-jvm is current.
reactive-streams-jvm Support
Best in #Reactive Programming
Average in #Reactive Programming
reactive-streams-jvm Support
Best in #Reactive Programming
Average in #Reactive Programming

quality kandi Quality

  • reactive-streams-jvm has 39 bugs (0 blocker, 2 critical, 21 major, 16 minor) and 852 code smells.
reactive-streams-jvm Quality
Best in #Reactive Programming
Average in #Reactive Programming
reactive-streams-jvm Quality
Best in #Reactive Programming
Average in #Reactive Programming

securitySecurity

  • reactive-streams-jvm has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • reactive-streams-jvm code analysis shows 0 unresolved vulnerabilities.
  • There are 5 security hotspots that need review.
reactive-streams-jvm Security
Best in #Reactive Programming
Average in #Reactive Programming
reactive-streams-jvm Security
Best in #Reactive Programming
Average in #Reactive Programming

license License

  • reactive-streams-jvm has a Non-SPDX License.
  • Non-SPDX licenses can be open source with a non SPDX compliant license, or non open source licenses, and you need to review them closely before use.
reactive-streams-jvm License
Best in #Reactive Programming
Average in #Reactive Programming
reactive-streams-jvm License
Best in #Reactive Programming
Average in #Reactive Programming

buildReuse

  • reactive-streams-jvm releases are not available. You will need to build from source code and install.
  • Build file is available. You can build the component from source.
  • Installation instructions are not available. Examples and code snippets are available.
  • reactive-streams-jvm saves you 4075 person hours of effort in developing the same functionality from scratch.
  • It has 8662 lines of code, 1007 functions and 64 files.
  • It has medium code complexity. Code complexity directly impacts maintainability of the code.
reactive-streams-jvm Reuse
Best in #Reactive Programming
Average in #Reactive Programming
reactive-streams-jvm Reuse
Best in #Reactive Programming
Average in #Reactive Programming
Top functions reviewed by kandi - BETA

kandi has reviewed reactive-streams-jvm and discovered the below as its top functions. This is intended to give you an instant insight into reactive-streams-jvm implemented functionality, and help decide if they suit your requirements.

  • test for a stochastic test
  • Fails if there are more elements to be requested
  • Test to see if the subscription requires on a subscription
  • Test whether the Blackbox is required to call on a subscription
  • Handles the request .
  • Returns true if the given exception is non - fatal .
  • Returns a publisher for the given number of elements .
  • Initializes this publisher with the given subscriber .
  • Creates a Publisher for flow .
  • Returns a string representation of the preference .

reactive-streams-jvm Key Features

Reactive Streams Specification for the JVM

Reactive Streams

copy iconCopydownload iconDownload
<dependency>
  <groupId>org.reactivestreams</groupId>
  <artifactId>reactive-streams</artifactId>
  <version>1.0.3</version>
</dependency>
<dependency>
  <groupId>org.reactivestreams</groupId>
  <artifactId>reactive-streams-tck</artifactId>
  <version>1.0.3</version>
  <scope>test</scope>
</dependency>

API Components

copy iconCopydownload iconDownload
onSubscribe onNext* (onError | onComplete)?

SPECIFICATION

copy iconCopydownload iconDownload
public interface Publisher<T> {
    public void subscribe(Subscriber<? super T> s);
}

Asynchronous vs Synchronous Processing

copy iconCopydownload iconDownload
nioSelectorThreadOrigin map(f) filter(p) consumeTo(toNioSelectorOutput)

Community Discussions

Trending Discussions on reactive-streams-jvm
  • Creating a Happens Before Relationship with AtomicBoolean
  • Is it generally OK to use a Reactive Streams Processor as an event bus?
Trending Discussions on reactive-streams-jvm

QUESTION

Creating a Happens Before Relationship with AtomicBoolean

Asked 2017-Aug-27 at 09:20

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

try {
            final Signal s = inboundSignals.poll(); // We take a signal off the queue


 if (!done) { // If we're done, we shouldn't process any more signals, obeying rule 2.8
          // Below we simply unpack the `Signal`s and invoke the corresponding methods
          if (s instanceof OnNext<?>)
            handleOnNext(((OnNext<T>)s).next);
          else if (s instanceof OnSubscribe)
            handleOnSubscribe(((OnSubscribe)s).subscription);
          else if (s instanceof OnError) // We are always able to handle OnError, obeying rule 2.10
            handleOnError(((OnError)s).error);
          else if (s == OnComplete.Instance) // We are always able to handle OnComplete, obeying rule 2.9
            handleOnComplete();
        }
      }

will be executed by 1 thread at time.

Indeed when on.get() return true, what prevent another thread from entering the critical section ?!

2_ Is it more efficient than a synchronized block ? (given that AtomicBoolean uses Volatile variable )

here the part of code :

    // We are using this `AtomicBoolean` to make sure that this `Subscriber` doesn't run concurrently with itself,
      // obeying rule 2.7 and 2.11
      private final AtomicBoolean on = new AtomicBoolean(false);

       @SuppressWarnings("unchecked")
       @Override public final void run() {
        if(on.get()) { // establishes a happens-before relationship with the end of the previous run
          try {
            final Signal s = inboundSignals.poll(); // We take a signal off the queue
            if (!done) { // If we're done, we shouldn't process any more signals, obeying rule 2.8
              // Below we simply unpack the `Signal`s and invoke the corresponding methods
              if (s instanceof OnNext<?>)
                handleOnNext(((OnNext<T>)s).next);
              else if (s instanceof OnSubscribe)
                handleOnSubscribe(((OnSubscribe)s).subscription);
              else if (s instanceof OnError) // We are always able to handle OnError, obeying rule 2.10
                handleOnError(((OnError)s).error);
              else if (s == OnComplete.Instance) // We are always able to handle OnComplete, obeying rule 2.9
                handleOnComplete();
            }
          } finally {
            on.set(false); // establishes a happens-before relationship with the beginning of the next run
            if(!inboundSignals.isEmpty()) // If we still have signals to process
              tryScheduleToExecute(); // Then we try to schedule ourselves to execute again
          }
        }
      }
// What `signal` does is that it sends signals to the `Subscription` asynchronously
  private void signal(final Signal signal) {
    if (inboundSignals.offer(signal)) // No need to null-check here as ConcurrentLinkedQueue does this for us
      tryScheduleToExecute(); // Then we try to schedule it for execution, if it isn't already
  }

  // This method makes sure that this `Subscriber` is only executing on one Thread at a time
  private final void tryScheduleToExecute() {
    if(on.compareAndSet(false, true)) {
      try {
        executor.execute(this);
      } catch(Throwable t) { // If we can't run on the `Executor`, we need to fail gracefully and not violate rule 2.13
        if (!done) {
          try {
            done(); // First of all, this failure is not recoverable, so we need to cancel our subscription
          } finally {
            inboundSignals.clear(); // We're not going to need these anymore
            // This subscription is cancelled by now, but letting the Subscriber become schedulable again means
            // that we can drain the inboundSignals queue if anything arrives after clearing
            on.set(false);
          }
        }
      }
    }

3_ Is it safe?

4_ Is it commonly used for this purpose (Creating a Happens Before Relationship) ?

ANSWER

Answered 2017-Aug-27 at 09:20

Yes, 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.

Source https://stackoverflow.com/questions/45902711

Community Discussions, Code Snippets contain sources that include Stack Exchange Network

Vulnerabilities

No vulnerabilities reported

Install reactive-streams-jvm

You can download it from GitHub.
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

For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .

DOWNLOAD this Library from

Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

Share this Page

share link
Consider Popular Reactive Programming Libraries
Try Top Libraries by reactive-streams
Compare Reactive Programming Libraries with Highest Support
Compare Reactive Programming Libraries with Highest Quality
Compare Reactive Programming Libraries with Highest Security
Compare Reactive Programming Libraries with Permissive License
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

  • © 2022 Open Weaver Inc.