Guest User

Untitled

a guest
Jul 18th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. package org.reactivestreams;
  2.  
  3. /**
  4. * Will receive call to {@link #onSubscribe(Subscription)} once after passing an instance of {@link Subscriber} to {@link Publisher#subscribe(Subscriber)}.
  5. * <p>
  6. * No further notifications will be received until {@link Subscription#request(long)} is called.
  7. * <p>
  8. * After signaling demand:
  9. * <ul>
  10. * <li>One or more invocations of {@link #onNext(Object)} up to the maximum number defined by {@link Subscription#request(long)}</li>
  11. * <li>Single invocation of {@link #onError(Throwable)} or {@link Subscriber#onComplete()} which signals a terminal state after which no further events will be sent.
  12. * </ul>
  13. * <p>
  14. * Demand can be signaled via {@link Subscription#request(long)} whenever the {@link Subscriber} instance is capable of handling more.
  15. *
  16. * @param <T> the type of element signaled.
  17. */
  18. public interface Subscriber<T> {
  19. /**
  20. * Invoked after calling {@link Publisher#subscribe(Subscriber)}.
  21. * <p>
  22. * No data will start flowing until {@link Subscription#request(long)} is invoked.
  23. * <p>
  24. * It is the responsibility of this {@link Subscriber} instance to call {@link Subscription#request(long)} whenever more data is wanted.
  25. * <p>
  26. * The {@link Publisher} will send notifications only in response to {@link Subscription#request(long)}.
  27. *
  28. * @param s
  29. * {@link Subscription} that allows requesting data via {@link Subscription#request(long)}
  30. */
  31. public void onSubscribe(Subscription s);
  32.  
  33. /**
  34. * Data notification sent by the {@link Publisher} in response to requests to {@link Subscription#request(long)}.
  35. *
  36. * @param t the element signaled
  37. */
  38. public void onNext(T t);
  39.  
  40. /**
  41. * Failed terminal state.
  42. * <p>
  43. * No further events will be sent even if {@link Subscription#request(long)} is invoked again.
  44. *
  45. * @param t the throwable signaled
  46. */
  47. public void onError(Throwable t);
  48.  
  49. /**
  50. * Successful terminal state.
  51. * <p>
  52. * No further events will be sent even if {@link Subscription#request(long)} is invoked again.
  53. */
  54. public void onComplete();
  55. }
Add Comment
Please, Sign In to add comment