You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: rxjava-core/src/main/java/rx/internal/operators/BufferUntilSubscriber.java
+23-15Lines changed: 23 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -27,25 +27,33 @@
27
27
importrx.subscriptions.Subscriptions;
28
28
29
29
/**
30
-
* A solution to the "time gap" problem that occurs with `groupBy` and `pivot` => https://github.com/Netflix/RxJava/issues/844
31
-
*
30
+
* A solution to the "time gap" problem that occurs with {@code groupBy} and {@code pivot}.
31
+
* <p>
32
32
* This currently has temporary unbounded buffers. It needs to become bounded and then do one of two things:
33
-
*
34
-
* 1) blow up and make the user do something about it
35
-
* 2) work with the backpressure solution ... still to be implemented (such as co-routines)
36
-
*
37
-
* Generally the buffer should be very short lived (milliseconds) and then stops being involved.
38
-
* It can become a memory leak though if a GroupedObservable backed by this class is emitted but never subscribed to (such as filtered out).
39
-
* In that case, either a time-bomb to throw away the buffer, or just blowing up and making the user do something about it is needed.
40
-
*
41
-
* For example, to filter out GroupedObservables, perhaps they need a silent `subscribe()` on them to just blackhole the data.
42
-
*
43
-
* This is an initial start at solving this problem and solves the immediate problem of `groupBy` and `pivot` and trades off the possibility of memory leak for deterministic functionality.
33
+
* <ol>
34
+
* <li>blow up and make the user do something about it</li>
35
+
* <li>work with the backpressure solution ... still to be implemented (such as co-routines)</li>
36
+
* </ol><p>
37
+
* Generally the buffer should be very short lived (milliseconds) and then stops being involved. It can become a
38
+
* memory leak though if a {@code GroupedObservable} backed by this class is emitted but never subscribed to
39
+
* (such as filtered out). In that case, either a time-bomb to throw away the buffer, or just blowing up and
40
+
* making the user do something about it is needed.
41
+
* <p>
42
+
* For example, to filter out {@code GroupedObservable}s, perhaps they need a silent {@code subscribe()} on them
43
+
* to just blackhole the data.
44
+
* <p>
45
+
* This is an initial start at solving this problem and solves the immediate problem of {@code groupBy} and
46
+
* {@code pivot} and trades off the possibility of memory leak for deterministic functionality.
44
47
*
48
+
* @see <a href="https://github.com/Netflix/RxJava/issues/844">the Github issue describing the time gap problem</a>
@@ -63,10 +66,11 @@ public OnErrorSentinel(Throwable e) {
63
66
}
64
67
65
68
/**
66
-
* Creates a lite onNext notification for the value passed in without doing any allocation. Can
69
+
* Creates a lite {@code onNext} notification for the value passed in without doing any allocation. Can
67
70
* be unwrapped and sent with the {@link #accept} method.
68
71
*
69
72
* @param t
73
+
* @warn parameter "t" undescribed
70
74
* @return the value or a null token
71
75
*/
72
76
publicObjectnext(Tt) {
@@ -77,7 +81,7 @@ public Object next(T t) {
77
81
}
78
82
79
83
/**
80
-
* Creates a lite onComplete notification without doing any allocation. Can be unwrapped and
84
+
* Creates a lite {@code onComplete} notification without doing any allocation. Can be unwrapped and
81
85
* sent with the {@link #accept} method.
82
86
*
83
87
* @return the completion token
@@ -87,10 +91,13 @@ public Object completed() {
87
91
}
88
92
89
93
/**
90
-
* Create a lite onError notification. This call does new up an object to wrap the {@link Throwable} but since there should only be one of these the performance impact should
91
-
* be small. Can be unwrapped and sent with the {@link #accept} method.
94
+
* Create a lite {@code onError} notification. This call does new up an object to wrap the {@link Throwable}
95
+
* but since there should only be one of these the performance impact should be small. Can be unwrapped and
96
+
* sent with the {@link #accept} method.
92
97
*
98
+
* @warn description doesn't parse in English ("This call does new up an object...")
93
99
* @param e
100
+
* @warn parameter "e" undescribed
94
101
* @return an object encapsulating the exception
95
102
*/
96
103
publicObjecterror(Throwablee) {
@@ -101,9 +108,10 @@ public Object error(Throwable e) {
101
108
* Unwraps the lite notification and calls the appropriate method on the {@link Observer}.
102
109
*
103
110
* @param o
104
-
* the {@link Observer} to call onNext, onCompleted or onError.
111
+
* the {@link Observer} to call onNext, onCompleted, or onError.
112
+
* @warn parameter "n" undescribed
105
113
* @param n
106
-
* @return true if the n was a termination event
114
+
* @return true if {@code n} was a termination event
107
115
* @throws IllegalArgumentException
108
116
* if the notification is null.
109
117
* @throws NullPointerException
@@ -129,18 +137,28 @@ public boolean accept(Observer<? super T> o, Object n) {
129
137
}
130
138
}
131
139
140
+
/**
141
+
* @warn isCompleted() undocumented
142
+
*/
132
143
publicbooleanisCompleted(Objectn) {
133
144
returnn == ON_COMPLETED_SENTINEL;
134
145
}
135
146
147
+
/**
148
+
* @warn isError() undocumented
149
+
*/
136
150
publicbooleanisError(Objectn) {
137
151
returnninstanceofOnErrorSentinel;
138
152
}
139
153
140
154
/**
141
-
* If there is custom logic that isn't as simple as call the right method on an {@link Observer} then this method can be used to get the {@link rx.Notification.Kind}
155
+
* If there is custom logic that isn't as simple as call the right method on an {@link Observer} then this
156
+
* method can be used to get the {@link rx.Notification.Kind}.
142
157
*
143
158
* @param n
159
+
* @warn parameter "n" undescribed
160
+
* @throws IllegalArgumentException
161
+
* if the notification is null.
144
162
* @return the kind of the raw object
145
163
*/
146
164
publicKindkind(Objectn) {
@@ -156,11 +174,12 @@ else if (n instanceof OnErrorSentinel)
156
174
}
157
175
158
176
/**
159
-
* returns value passed in {@link #next(Object)} method call. Bad things happen if you call this
160
-
* the onComplete or onError notification type. For performance you are expected to use this
177
+
* Returns the value passed in {@link #next(Object)} method call. Bad things happen if you call this
178
+
* the {@code onComplete} or {@code onError} notification type. For performance you are expected to use this
161
179
* when it is appropriate.
162
180
*
163
181
* @param n
182
+
* @warn parameter "n" undescribed
164
183
* @return the unwrapped value, which can be null
165
184
*/
166
185
@SuppressWarnings("unchecked")
@@ -169,13 +188,13 @@ public T getValue(Object n) {
169
188
}
170
189
171
190
/**
172
-
* returns {@link Throwable} passed in {@link #error(Throwable)} method call. Bad things happen
173
-
* if you
174
-
* call this the onComplete or onNext notification type. For performance you are expected to use
175
-
* this when it is appropriate.
191
+
* Returns the {@link Throwable} passed to the {@link #error(Throwable)} method call. Bad things happen if
192
+
* you call this on the {@code onComplete} or {@code onNext} notification type. For performance you are
0 commit comments