Skip to content

Instantly share code, notes, and snippets.

import java.util.Arrays;
import java.util.Collections;
import java.util.Random;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package rx.observers;
import rx.Observer;
/**
* Enforce single-threaded, serialized, ordered execution of onNext, onCompleted, onError.
* <p>
* When multiple threads are notifying they will be serialized by:
* <p>
* <li>Allowing only one thread at a time to emit</li>
package rxjava;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
import rx.Subscription;
import rx.functions.Action0;
import rx.functions.Action1;
/*
* Copyright 2008-2014, David Karnok
* The file is part of the Open Imperium Galactica project.
*
* The code should be distributed under the LGPL license.
* See http://www.gnu.org/licenses/lgpl.html for details.
*/
package hu.openig.utils;
package rx.operators;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Deque;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import rx.Observable;
public final class OperatorDelay2<T> implements OnSubscribe<T> {
final Observable<T> source;
final long delay;
final TimeUnit unit;
final Scheduler scheduler;
public Delay2(Observable<T> source, long delay, TimeUnit unit, Scheduler scheduler) {
this.source = source;
this.delay = delay;
this.unit = unit;
/**
* Copyright 2014 Netflix, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
# Run progress: 0,00% complete, ETA 00:00:30
# VM invoker: C:\Program Files\Java\jdk1.7.0_55\jre\bin\java.exe
# VM options: -Xmx512m -Dfile.encoding=windows-1250
# Fork: 1 of 1
# Warmup: 5 iterations, 1 s each
# Measurement: 5 iterations, 1 s each
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Average time, time/op
# Benchmark: rx.archive.schedulers.ComputationSchedulerPerf.run
# Parameters: (size = 1)
# Run progress: 0,00% complete, ETA 00:00:30
# VM invoker: C:\Program Files\Java\jdk1.7.0_55\jre\bin\java.exe
# VM options: -Xmx512m -Dfile.encoding=windows-1250
# Fork: 1 of 1
# Warmup: 5 iterations, 1 s each
# Measurement: 5 iterations, 1 s each
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Average time, time/op
# Benchmark: rx.archive.schedulers.ComputationSchedulerPerf.run
# Parameters: (size = 1)
# Run progress: 0,00% complete, ETA 00:01:00
# VM invoker: C:\Program Files\Java\jdk1.7.0_55\jre\bin\java.exe
# VM options: -Xmx1300m -Dfile.encoding=windows-1250
# Fork: 1 of 1
# Warmup: 5 iterations, 1 s each
# Measurement: 5 iterations, 1 s each
# Threads: 1 thread, will synchronize iterations
# Benchmark mode: Average time, time/op
# Benchmark: rx.schedulers.ComputationSchedulerPerf.observeOn
# Parameters: (size = 1)