DESCRIPTION

JCBC-644: More efficient timeout checks when blocking.

Motivation
----------
The timeout() operator is very powerful in RxJava, but also has more
overhead and scheduling associated. In the simple case where the code
just needs to block finally and wait for a result, the latch of the
BlockingObservable can be reused - instead of waiting infinitely apply
a custom timeout.

Modifications
-------------
The BlockingObservable code with the latch has been extracted into
a utility class (for internal use only for now). All of the last
resort timeout and blocking calls have been changed to use the
extracted method instead of the Rx timeout() calls.

Note that the blocking operations which expose an Iterator on
Views and Query cannot be converted, because this optimization
only works on single-result operations.

Result
------
Less GC and scheduling overhead, because the simple blocking
latch is reused. It also avoids https://github.com/ReactiveX/RxJava/issues/1919
where possible, although not in all cases.

Change-Id: I4520ffad1a3195ea65fd8e29d01f49e10d1fc698


COMMENTS

author: Natasha Sullivan
date: 2014-12-03 15:13:25.479000000

Uploaded patch set 1.

-------------------------------------
author: Natasha Sullivan
date: 2014-12-03 15:14:12.550000000

Patch Set 1: Verified+1

-------------------------------------
author: Natasha Sullivan
date: 2014-12-03 15:15:26.199000000

Patch Set 1:

On review, please double check the all the blocking methods correctly forward their arguments to the right methods. I checked, but since most of it is copied i want to avoid copying the wrong stuff around!

-------------------------------------
author: Estrella Humphrey
date: 2014-12-03 15:29:50.287000000

Patch Set 1: Code-Review+2

-------------------------------------
