Skip to content

Commit

Permalink
also update README to match new Publisher.subscribe
Browse files Browse the repository at this point in the history
(and fix one case of request(int) in the examples)
  • Loading branch information
rkuhn committed Sep 2, 2014
1 parent d76e5e4 commit dbc5dad
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ onError | (onSubscribe onNext* (onError | onComplete)?)

```java
public interface Publisher<T> {
public void subscribe(Subscriber<T> s);
public void subscribe(Subscriber<? super T> s);
}
````

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
public class StockPricePublisher implements Publisher<Stock> {

@Override
public void subscribe(final Subscriber<Stock> s) {
public void subscribe(final Subscriber<? super Stock> s) {
s.onSubscribe(new Subscription() {

AtomicLong capacity = new AtomicLong();
Expand Down Expand Up @@ -46,10 +46,10 @@ public void startConsuming() {
}

private static final class EventHandler implements Handler {
private final Subscriber<Stock> s;
private final Subscriber<? super Stock> s;
private final AtomicLong capacity;

private EventHandler(Subscriber<Stock> s, AtomicLong capacity) {
private EventHandler(Subscriber<? super Stock> s, AtomicLong capacity) {
this.s = s;
this.capacity = capacity;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.reactivestreams.example.unicast;

import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;

import org.reactivestreams.Subscription;
import org.reactivestreams.Subscriber;
Expand All @@ -9,13 +10,13 @@
class InfiniteIncrementNumberPublisher implements Publisher<Integer> {

@Override
public void subscribe(final Subscriber<Integer> s) {
public void subscribe(final Subscriber<? super Integer> s) {

final AtomicInteger i = new AtomicInteger();

Subscription subscription = new Subscription() {

AtomicInteger capacity = new AtomicInteger();
AtomicLong capacity = new AtomicLong();

@Override
public void request(long n) {
Expand Down

0 comments on commit dbc5dad

Please sign in to comment.