Skip to content

Commit a67d8a1

Browse files
committed
Merge branch 'master' of https://github.com/Netflix/RxJava into docs
2 parents ceb0574 + ceeab36 commit a67d8a1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+5378
-4649
lines changed

.gitattributes

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Set default behaviour, in case users don't have core.autocrlf set.
2+
* text=auto
3+
4+
# Explicitly declare text files we want to always be normalized and converted
5+
# to native line endings on checkout.
6+
*.java text
7+
*.groovy text
8+
*.scala text
9+
*.clj text
10+
*.txt text
11+
*.md text
12+
13+
# Denote all files that are truly binary and should not be modified.
14+
*.png binary
15+
*.jpg binary

gradlew.bat

Lines changed: 90 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,90 @@
1-
@if "%DEBUG%" == "" @echo off
2-
@rem ##########################################################################
3-
@rem
4-
@rem Gradle startup script for Windows
5-
@rem
6-
@rem ##########################################################################
7-
8-
@rem Set local scope for the variables with windows NT shell
9-
if "%OS%"=="Windows_NT" setlocal
10-
11-
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12-
set DEFAULT_JVM_OPTS=
13-
14-
set DIRNAME=%~dp0
15-
if "%DIRNAME%" == "" set DIRNAME=.
16-
set APP_BASE_NAME=%~n0
17-
set APP_HOME=%DIRNAME%
18-
19-
@rem Find java.exe
20-
if defined JAVA_HOME goto findJavaFromJavaHome
21-
22-
set JAVA_EXE=java.exe
23-
%JAVA_EXE% -version >NUL 2>&1
24-
if "%ERRORLEVEL%" == "0" goto init
25-
26-
echo.
27-
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28-
echo.
29-
echo Please set the JAVA_HOME variable in your environment to match the
30-
echo location of your Java installation.
31-
32-
goto fail
33-
34-
:findJavaFromJavaHome
35-
set JAVA_HOME=%JAVA_HOME:"=%
36-
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37-
38-
if exist "%JAVA_EXE%" goto init
39-
40-
echo.
41-
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42-
echo.
43-
echo Please set the JAVA_HOME variable in your environment to match the
44-
echo location of your Java installation.
45-
46-
goto fail
47-
48-
:init
49-
@rem Get command-line arguments, handling Windowz variants
50-
51-
if not "%OS%" == "Windows_NT" goto win9xME_args
52-
if "%@eval[2+2]" == "4" goto 4NT_args
53-
54-
:win9xME_args
55-
@rem Slurp the command line arguments.
56-
set CMD_LINE_ARGS=
57-
set _SKIP=2
58-
59-
:win9xME_args_slurp
60-
if "x%~1" == "x" goto execute
61-
62-
set CMD_LINE_ARGS=%*
63-
goto execute
64-
65-
:4NT_args
66-
@rem Get arguments from the 4NT Shell from JP Software
67-
set CMD_LINE_ARGS=%$
68-
69-
:execute
70-
@rem Setup the command line
71-
72-
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73-
74-
@rem Execute Gradle
75-
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76-
77-
:end
78-
@rem End local scope for the variables with windows NT shell
79-
if "%ERRORLEVEL%"=="0" goto mainEnd
80-
81-
:fail
82-
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83-
rem the _cmd.exe /c_ return code!
84-
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85-
exit /b 1
86-
87-
:mainEnd
88-
if "%OS%"=="Windows_NT" endlocal
89-
90-
:omega
1+
@if "%DEBUG%" == "" @echo off
2+
@rem ##########################################################################
3+
@rem
4+
@rem Gradle startup script for Windows
5+
@rem
6+
@rem ##########################################################################
7+
8+
@rem Set local scope for the variables with windows NT shell
9+
if "%OS%"=="Windows_NT" setlocal
10+
11+
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12+
set DEFAULT_JVM_OPTS=
13+
14+
set DIRNAME=%~dp0
15+
if "%DIRNAME%" == "" set DIRNAME=.
16+
set APP_BASE_NAME=%~n0
17+
set APP_HOME=%DIRNAME%
18+
19+
@rem Find java.exe
20+
if defined JAVA_HOME goto findJavaFromJavaHome
21+
22+
set JAVA_EXE=java.exe
23+
%JAVA_EXE% -version >NUL 2>&1
24+
if "%ERRORLEVEL%" == "0" goto init
25+
26+
echo.
27+
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28+
echo.
29+
echo Please set the JAVA_HOME variable in your environment to match the
30+
echo location of your Java installation.
31+
32+
goto fail
33+
34+
:findJavaFromJavaHome
35+
set JAVA_HOME=%JAVA_HOME:"=%
36+
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37+
38+
if exist "%JAVA_EXE%" goto init
39+
40+
echo.
41+
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42+
echo.
43+
echo Please set the JAVA_HOME variable in your environment to match the
44+
echo location of your Java installation.
45+
46+
goto fail
47+
48+
:init
49+
@rem Get command-line arguments, handling Windowz variants
50+
51+
if not "%OS%" == "Windows_NT" goto win9xME_args
52+
if "%@eval[2+2]" == "4" goto 4NT_args
53+
54+
:win9xME_args
55+
@rem Slurp the command line arguments.
56+
set CMD_LINE_ARGS=
57+
set _SKIP=2
58+
59+
:win9xME_args_slurp
60+
if "x%~1" == "x" goto execute
61+
62+
set CMD_LINE_ARGS=%*
63+
goto execute
64+
65+
:4NT_args
66+
@rem Get arguments from the 4NT Shell from JP Software
67+
set CMD_LINE_ARGS=%$
68+
69+
:execute
70+
@rem Setup the command line
71+
72+
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73+
74+
@rem Execute Gradle
75+
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76+
77+
:end
78+
@rem End local scope for the variables with windows NT shell
79+
if "%ERRORLEVEL%"=="0" goto mainEnd
80+
81+
:fail
82+
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83+
rem the _cmd.exe /c_ return code!
84+
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85+
exit /b 1
86+
87+
:mainEnd
88+
if "%OS%"=="Windows_NT" endlocal
89+
90+
:omega

language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/Observable.scala

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ trait Observable[+T]
7575
import scala.collection.Seq
7676
import scala.concurrent.duration.{Duration, TimeUnit}
7777
import rx.util.functions._
78-
import rx.lang.scala.util._
7978
import rx.lang.scala.observables.BlockingObservable
8079
import ImplicitFunctionConversions._
8180
import JavaConversions._
@@ -302,45 +301,44 @@ trait Observable[+T]
302301
* Creates an Observable which produces buffers of collected values.
303302
*
304303
* This Observable produces connected non-overlapping buffers. The current buffer is
305-
* emitted and replaced with a new buffer when the Observable produced by the specified function produces a [[rx.lang.scala.util.Closing]] object. The function will then
304+
* emitted and replaced with a new buffer when the Observable produced by the specified function produces an object. The function will then
306305
* be used to create a new Observable to listen for the end of the next buffer.
307306
*
308307
* @param closings
309308
* The function which is used to produce an [[rx.lang.scala.Observable]] for every buffer created.
310-
* When this [[rx.lang.scala.Observable]] produces a [[rx.lang.scala.util.Closing]] object, the associated buffer
309+
* When this [[rx.lang.scala.Observable]] produces an object, the associated buffer
311310
* is emitted and replaced with a new one.
312311
* @return
313312
* An [[rx.lang.scala.Observable]] which produces connected non-overlapping buffers, which are emitted
314-
* when the current [[rx.lang.scala.Observable]] created with the function argument produces a [[rx.lang.scala.util.Closing]] object.
313+
* when the current [[rx.lang.scala.Observable]] created with the function argument produces an object.
315314
*/
316-
def buffer(closings: () => Observable[Closing]) : Observable[Seq[T]] = {
315+
def buffer[Closing](closings: () => Observable[_ <: Closing]) : Observable[Seq[T]] = {
317316
val f: Func0[_ <: rx.Observable[_ <: Closing]] = closings().asJavaObservable
318-
val jObs: rx.Observable[_ <: java.util.List[_]] = asJavaObservable.buffer(f)
317+
val jObs: rx.Observable[_ <: java.util.List[_]] = asJavaObservable.buffer[Closing](f)
319318
Observable.jObsOfListToScObsOfSeq(jObs.asInstanceOf[rx.Observable[_ <: java.util.List[T]]])
320319
}
321-
322320
/**
323321
* Creates an Observable which produces buffers of collected values.
324322
*
325323
* This Observable produces buffers. Buffers are created when the specified `openings`
326-
* Observable produces a [[rx.lang.scala.util.Opening]] object. Additionally the function argument
324+
* Observable produces an object. Additionally the function argument
327325
* is used to create an Observable which produces [[rx.lang.scala.util.Closing]] objects. When this
328326
* Observable produces such an object, the associated buffer is emitted.
329327
*
330328
* @param openings
331-
* The [[rx.lang.scala.Observable]] which, when it produces a [[rx.lang.scala.util.Opening]] object, will cause
329+
* The [[rx.lang.scala.Observable]] which, when it produces an object, will cause
332330
* another buffer to be created.
333331
* @param closings
334332
* The function which is used to produce an [[rx.lang.scala.Observable]] for every buffer created.
335-
* When this [[rx.lang.scala.Observable]] produces a [[rx.lang.scala.util.Closing]] object, the associated buffer
333+
* When this [[rx.lang.scala.Observable]] produces an object, the associated buffer
336334
* is emitted.
337335
* @return
338336
* An [[rx.lang.scala.Observable]] which produces buffers which are created and emitted when the specified [[rx.lang.scala.Observable]]s publish certain objects.
339337
*/
340-
def buffer(openings: Observable[Opening], closings: Opening => Observable[Closing]): Observable[Seq[T]] = {
338+
def buffer[Opening, Closing](openings: Observable[Opening], closings: Opening => Observable[Closing]): Observable[Seq[T]] = {
341339
val opening: rx.Observable[_ <: Opening] = openings.asJavaObservable
342-
val closing: Func1[Opening, _ <: rx.Observable[_ <: Closing]] = (o: Opening) => closings(o).asJavaObservable
343-
val jObs: rx.Observable[_ <: java.util.List[_]] = asJavaObservable.buffer(opening, closing)
340+
val closing: Func1[_ >: Opening, _ <: rx.Observable[_ <: Closing]] = (o: Opening) => closings(o).asJavaObservable
341+
val jObs: rx.Observable[_ <: java.util.List[_]] = asJavaObservable.buffer[Opening, Closing](opening, closing)
344342
Observable.jObsOfListToScObsOfSeq(jObs.asInstanceOf[rx.Observable[_ <: java.util.List[T]]])
345343
}
346344

@@ -512,22 +510,22 @@ trait Observable[+T]
512510
/**
513511
* Creates an Observable which produces windows of collected values. This Observable produces connected
514512
* non-overlapping windows. The current window is emitted and replaced with a new window when the
515-
* Observable produced by the specified function produces a [[rx.lang.scala.util.Closing]] object.
513+
* Observable produced by the specified function produces an object.
516514
* The function will then be used to create a new Observable to listen for the end of the next
517515
* window.
518516
*
519517
* @param closings
520518
* The function which is used to produce an [[rx.lang.scala.Observable]] for every window created.
521-
* When this [[rx.lang.scala.Observable]] produces a [[rx.lang.scala.util.Closing]] object, the associated window
519+
* When this [[rx.lang.scala.Observable]] produces an object, the associated window
522520
* is emitted and replaced with a new one.
523521
* @return
524522
* An [[rx.lang.scala.Observable]] which produces connected non-overlapping windows, which are emitted
525-
* when the current [[rx.lang.scala.Observable]] created with the function argument produces a [[rx.lang.scala.util.Closing]] object.
523+
* when the current [[rx.lang.scala.Observable]] created with the function argument produces an object.
526524
*/
527-
def window(closings: () => Observable[Closing]): Observable[Observable[T]] = {
525+
def window[Closing](closings: () => Observable[Closing]): Observable[Observable[T]] = {
528526
val func : Func0[_ <: rx.Observable[_ <: Closing]] = closings().asJavaObservable
529-
val o1: rx.Observable[_ <: rx.Observable[_]] = asJavaObservable.window(func)
530-
val o2 = toScalaObservable[rx.Observable[_]](o1).map((x: rx.Observable[_]) => {
527+
val o1: rx.Observable[_ <: rx.Observable[_]] = asJavaObservable.window[Closing](func)
528+
val o2 = Observable[rx.Observable[_]](o1).map((x: rx.Observable[_]) => {
531529
val x2 = x.asInstanceOf[rx.Observable[_ <: T]]
532530
toScalaObservable[T](x2)
533531
})
@@ -536,23 +534,23 @@ trait Observable[+T]
536534

537535
/**
538536
* Creates an Observable which produces windows of collected values. This Observable produces windows.
539-
* Chunks are created when the specified `openings` Observable produces a [[rx.lang.scala.util.Opening]] object.
537+
* Chunks are created when the specified `openings` Observable produces an object.
540538
* Additionally the `closings` argument is used to create an Observable which produces [[rx.lang.scala.util.Closing]] objects.
541539
* When this Observable produces such an object, the associated window is emitted.
542540
*
543541
* @param openings
544-
* The [[rx.lang.scala.Observable]] which when it produces a [[rx.lang.scala.util.Opening]] object, will cause
542+
* The [[rx.lang.scala.Observable]] which when it produces an object, will cause
545543
* another window to be created.
546544
* @param closings
547545
* The function which is used to produce an [[rx.lang.scala.Observable]] for every window created.
548-
* When this [[rx.lang.scala.Observable]] produces a [[rx.lang.scala.util.Closing]] object, the associated window
546+
* When this [[rx.lang.scala.Observable]] produces an object, the associated window
549547
* is emitted.
550548
* @return
551549
* An [[rx.lang.scala.Observable]] which produces windows which are created and emitted when the specified [[rx.lang.scala.Observable]]s publish certain objects.
552550
*/
553-
def window(openings: Observable[Opening], closings: Opening => Observable[Closing]) = {
551+
def window[Opening, Closing](openings: Observable[Opening], closings: Opening => Observable[Closing]) = {
554552
Observable.jObsOfJObsToScObsOfScObs(
555-
asJavaObservable.window(openings.asJavaObservable, (op: Opening) => closings(op).asJavaObservable))
553+
asJavaObservable.window[Opening, Closing](openings.asJavaObservable, (op: Opening) => closings(op).asJavaObservable))
556554
: Observable[Observable[T]] // SI-7818
557555
}
558556

@@ -1015,7 +1013,11 @@ trait Observable[+T]
10151013
* This is useful when you want an Observable to cache responses and you can't control the
10161014
* subscribe/unsubscribe behavior of all the [[rx.lang.scala.Observer]]s.
10171015
*
1018-
* NOTE: You sacrifice the ability to unsubscribe from the origin when you use the
1016+
* When you call `cache`, it does not yet subscribe to the
1017+
* source Observable. This only happens when `subscribe` is called
1018+
* the first time on the Observable returned by `cache()`.
1019+
*
1020+
* Note: You sacrifice the ability to unsubscribe from the origin when you use the
10191021
* `cache()` operator so be careful not to use this operator on Observables that
10201022
* emit an infinite or very large number of items that will use up memory.
10211023
*

language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/util/package.scala

Lines changed: 0 additions & 49 deletions
This file was deleted.

rxjava-contrib/rxjava-apache-http/src/main/java/rx/apache/http/ObservableHttp.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public static ObservableHttp<ObservableHttpResponse> createGet(String uri, final
112112
* <p>
113113
* A client can be retrieved like this:
114114
* <p>
115-
* <pre> {@code CloseableHttpAsyncClient httpclient = HttpAsyncClients.createDefault(); } </pre> </p>
115+
* <pre> {@code CloseableHttpAsyncClient httpclient = HttpAsyncClients.createDefault(); } </pre>
116116
* <p>
117117
* A client with custom configurations can be created like this:
118118
* </p>

0 commit comments

Comments
 (0)