Skip to content

Commit 61f0580

Browse files
Merge pull request #599 from benjchristensen/rx.schedulers
Refactor rx.concurrency to rx.schedulers
2 parents 80177f0 + 71d25d1 commit 61f0580

File tree

104 files changed

+1606
-895
lines changed

Some content is hidden

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

104 files changed

+1606
-895
lines changed

language-adaptors/rxjava-groovy/src/test/groovy/rx/lang/groovy/TestParallel.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import org.junit.Test
1919

2020
import rx.Observable
2121
import rx.Scheduler
22-
import rx.concurrency.Schedulers
22+
import rx.schedulers.Schedulers
2323
import rx.util.functions.Func1
2424

2525
class TestParallel {

language-adaptors/rxjava-scala/src/examples/scala/rx/lang/scala/examples/TestSchedulerExample.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/**
2+
* Copyright 2013 Netflix, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
116
package rx.lang.scala.examples
217

318
import scala.concurrent.duration.DurationInt

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/**
2+
* Copyright 2013 Netflix, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
116
package rx.lang.scala
217

318
/**

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,11 +204,11 @@ trait Scheduler {
204204

205205
private [scala] object Scheduler {
206206
def apply(scheduler: rx.Scheduler): Scheduler = scheduler match {
207-
case s: rx.concurrency.CurrentThreadScheduler => new CurrentThreadScheduler(s)
208-
case s: rx.concurrency.ExecutorScheduler => new ExecutorScheduler(s)
209-
case s: rx.concurrency.ImmediateScheduler => new ImmediateScheduler(s)
210-
case s: rx.concurrency.NewThreadScheduler => new NewThreadScheduler(s)
211-
case s: rx.concurrency.TestScheduler => new TestScheduler(s)
207+
case s: rx.schedulers.CurrentThreadScheduler => new CurrentThreadScheduler(s)
208+
case s: rx.schedulers.ExecutorScheduler => new ExecutorScheduler(s)
209+
case s: rx.schedulers.ImmediateScheduler => new ImmediateScheduler(s)
210+
case s: rx.schedulers.NewThreadScheduler => new NewThreadScheduler(s)
211+
case s: rx.schedulers.TestScheduler => new TestScheduler(s)
212212
case s: rx.Scheduler => new Scheduler{ val asJavaScheduler = s }
213213
}
214214

language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/schedulers/CurrentThreadScheduler.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ object CurrentThreadScheduler {
2323
* Returns a [[rx.lang.scala.Scheduler]] that queues work on the current thread to be executed after the current work completes.
2424
*/
2525
def apply(): CurrentThreadScheduler = {
26-
new CurrentThreadScheduler(rx.concurrency.Schedulers.currentThread())
26+
new CurrentThreadScheduler(rx.schedulers.Schedulers.currentThread())
2727
}
2828
}
2929

language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/schedulers/ExecutorScheduler.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ object ExecutorScheduler {
2626
* Note that this does not support scheduled actions with a delay.
2727
*/
2828
def apply(executor: Executor): ExecutorScheduler = {
29-
new ExecutorScheduler(rx.concurrency.Schedulers.executor(executor))
29+
new ExecutorScheduler(rx.schedulers.Schedulers.executor(executor))
3030
}
3131
}
3232

language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/schedulers/ImmediateScheduler.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ object ImmediateScheduler {
2323
* Returns a [[rx.lang.scala.Scheduler]] that executes work immediately on the current thread.
2424
*/
2525
def apply(): ImmediateScheduler = {
26-
new ImmediateScheduler(rx.concurrency.Schedulers.immediate())
26+
new ImmediateScheduler(rx.schedulers.Schedulers.immediate())
2727
}
2828
}
2929

language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/schedulers/NewThreadScheduler.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ object NewThreadScheduler {
2323
* Returns a [[rx.lang.scala.Scheduler]] that creates a new {@link Thread} for each unit of work.
2424
*/
2525
def apply(): NewThreadScheduler = {
26-
new NewThreadScheduler(rx.concurrency.Schedulers.newThread())
26+
new NewThreadScheduler(rx.schedulers.Schedulers.newThread())
2727
}
2828
}
2929

language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/schedulers/ScheduledExecutorServiceScheduler.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ object ScheduledExecutorServiceScheduler {
2424
* Returns a [[rx.lang.scala.Scheduler]] that queues work on an `java.util.concurrent.ScheduledExecutorService`.
2525
*/
2626
def apply(executor: ScheduledExecutorService): ScheduledExecutorServiceScheduler = {
27-
new ScheduledExecutorServiceScheduler(rx.concurrency.Schedulers.executor(executor))
27+
new ScheduledExecutorServiceScheduler(rx.schedulers.Schedulers.executor(executor))
2828
}
2929
}
3030

language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/schedulers/TestScheduler.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import rx.lang.scala.Scheduler
2323
*/
2424
object TestScheduler {
2525
def apply(): TestScheduler = {
26-
new TestScheduler(new rx.concurrency.TestScheduler())
26+
new TestScheduler(new rx.schedulers.TestScheduler())
2727
}
2828
}
2929

@@ -64,7 +64,7 @@ object TestScheduler {
6464
* }
6565
* }}}
6666
*/
67-
class TestScheduler private[scala] (val asJavaScheduler: rx.concurrency.TestScheduler) extends Scheduler {
67+
class TestScheduler private[scala] (val asJavaScheduler: rx.schedulers.TestScheduler) extends Scheduler {
6868

6969
def advanceTimeBy(time: Duration) {
7070
asJavaScheduler.advanceTimeBy(time.length, time.unit)

language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/schedulers/ThreadPoolForComputationScheduler.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ object ThreadPoolForComputationScheduler {
2929
* Do not perform IO-bound work on this scheduler. Use [[rx.lang.scala.schedulers.ThreadPoolForIOScheduler]] instead.
3030
*/
3131
def apply(): ThreadPoolForComputationScheduler = {
32-
new ThreadPoolForComputationScheduler(rx.concurrency.Schedulers.threadPoolForComputation())
32+
new ThreadPoolForComputationScheduler(rx.schedulers.Schedulers.threadPoolForComputation())
3333
}
3434
}
3535

language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/schedulers/ThreadPoolForIOScheduler.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ object ThreadPoolForIOScheduler {
2929
* Do not perform computational work on this scheduler. Use [[rx.lang.scala.schedulers.ThreadPoolForComputationScheduler]] instead.
3030
*/
3131
def apply(): ThreadPoolForIOScheduler = {
32-
new ThreadPoolForIOScheduler(rx.concurrency.Schedulers.threadPoolForIO())
32+
new ThreadPoolForIOScheduler(rx.schedulers.Schedulers.threadPoolForIO())
3333
}
3434
}
3535

language-adaptors/rxjava-scala/src/test/scala/rx/lang/scala/CompletenessTest.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/**
2+
* Copyright 2013 Netflix, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
116
package rx.lang.scala
217

318
import java.util.Calendar

language-adaptors/rxjava-scala/src/test/scala/rx/lang/scala/ConstructorTest.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/**
2+
* Copyright 2013 Netflix, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
116
package rx.lang.scala
217
import scala.language.postfixOps
318
import org.junit.Assert._

language-adaptors/rxjava-scala/src/test/scala/rx/lang/scala/NotificationTests.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/**
2+
* Copyright 2013 Netflix, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
116
package rx.lang.scala
217

318

language-adaptors/rxjava-scala/src/test/scala/rx/lang/scala/ObservableTest.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/**
2+
* Copyright 2013 Netflix, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
116
package rx.lang.scala
217

318
import scala.concurrent.{Future, Await}

language-adaptors/rxjava-scala/src/test/scala/rx/lang/scala/SubjectTests.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/**
2+
* Copyright 2013 Netflix, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
116
package rx.lang.scala
217

318
import org.junit.{Assert, Test}

language-adaptors/rxjava-scala/src/test/scala/rx/lang/scala/SubscriptionTests.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/**
2+
* Copyright 2013 Netflix, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
116
package rx.lang.scala
217

318

rxjava-contrib/rxjava-android/src/main/java/rx/android/concurrency/AndroidSchedulers.java

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,37 +15,25 @@
1515
*/
1616
package rx.android.concurrency;
1717

18-
import android.os.Handler;
19-
import android.os.Looper;
2018
import rx.Scheduler;
19+
import android.os.Handler;
2120

2221
/**
23-
* Schedulers that have Android specific functionality
22+
* Deprecated. Package changed from rx.android.concurrency to rx.android.schedulers.
23+
*
24+
* @deprecated Use {@link rx.android.schedulers.AndroidSchedulers} instead. This will be removed before 1.0 release.
2425
*/
26+
@Deprecated
2527
public class AndroidSchedulers {
2628

27-
private static final Scheduler MAIN_THREAD_SCHEDULER =
28-
new HandlerThreadScheduler(new Handler(Looper.getMainLooper()));
29-
30-
private AndroidSchedulers(){
31-
32-
}
33-
34-
/**
35-
* {@link Scheduler} which uses the provided {@link Handler} to execute an action
36-
* @param handler The handler that will be used when executing the action
37-
* @return A handler based scheduler
38-
*/
29+
@Deprecated
3930
public static Scheduler handlerThread(final Handler handler) {
40-
return new HandlerThreadScheduler(handler);
31+
return rx.android.schedulers.AndroidSchedulers.handlerThread(handler);
4132
}
4233

43-
/**
44-
* {@link Scheduler} which will execute an action on the main Android UI thread.
45-
*
46-
* @return A Main {@link Looper} based scheduler
47-
*/
34+
@Deprecated
4835
public static Scheduler mainThread() {
49-
return MAIN_THREAD_SCHEDULER;
36+
return rx.android.schedulers.AndroidSchedulers.mainThread();
5037
}
38+
5139
}

0 commit comments

Comments
 (0)