Skip to content

Empty stacktrace of TimeoutException #202

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 9, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@

public final class TimeoutPublisher<T> implements Px<T> {

@SuppressWarnings("ThrowableInstanceNeverThrown")
private static final TimeoutException timeoutException = new TimeoutException() {
private static final long serialVersionUID = 6195545973881750858L;

@Override
public synchronized Throwable fillInStackTrace() {
return this;
}
};

private final Publisher<T> child;
private final Scheduler scheduler;
private final long timeout;
Expand All @@ -42,7 +52,7 @@ public TimeoutPublisher(Publisher<T> child, long timeout, TimeUnit unit, Schedul

@Override
public void subscribe(Subscriber<? super T> subscriber) {
Runnable onTimeout = () -> subscriber.onError(new TimeoutException());
Runnable onTimeout = () -> subscriber.onError(timeoutException);
CancellableSubscriber<Void> timeoutSub = Subscribers.create(null, null, throwable -> onTimeout.run(),
onTimeout, null);
Runnable cancelTimeout = () -> timeoutSub.cancel();
Expand Down