GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Subject

Subject

Jump to bottom
David Gross edited this page Jan 19, 2015 · 22 revisions

A Subject is a sort of bridge or proxy that acts both as an Subscriber and as an Observable. Because it is a Subscriber, it can subscribe to one or more Observables, and because it is an Observable, it can pass through the items it observes by reemitting them, and it can also emit new items.

For more information about the varieties of Subject and how to use them, see the ReactiveX Subject documentation.

Serializing

When you use a Subject as a Subscriber, take care not to call its onNext( ) method (or its other on methods) from multiple threads, as this could lead to non-serialized calls, which violates the Observable contract and creates an ambiguity in the resulting Subject.

To protect a Subject from this danger, you can convert it into a SerializedSubject with code like the following:

mySafeSubject = new SerializedSubject( myUnsafeSubject );

Copyright (c) 2016-present, RxJava Contributors.
Twitter @RxJava | Gitter @RxJava

  • Introduction
  • Getting Started
  • How to Use RxJava
  • Reactive Streams
  • The reactive types of RxJava
  • Schedulers
  • Subjects
  • Error Handling
  • Operators (Alphabetical List)
    • Async
    • Blocking
    • Combining
    • Conditional & Boolean
    • Connectable
    • Creation
    • Error management
    • Filtering
    • Mathematical and Aggregate
    • Parallel flows
    • String
    • Transformation
    • Utility
    • Notable 3rd party Operators (Alphabetical List)
    • Operator matrix
  • Plugins
  • How to Contribute
  • Writing operators
  • Backpressure
    • another explanation
  • JavaDoc: 1.x, 2.x, 3.x
  • Coming from RxJava 1
  • Coming from RxJava 2
  • Additional Reading

Clone this wiki locally

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.