@Override public void execute(Runnable r) { new Thread(r).start(); } });
@Override public void execute(Runnable r) { new Thread(r).start(); } }, true);
@Override public void execute(Runnable r) { new Thread(r).start(); } }, true);
@Override public void execute(Runnable r) { new Thread(r).start(); } });
@Override public void execute(Runnable r) { new Thread(r).start(); } }, true);
@Override public void execute(Runnable r) { new Thread(r).start(); } });
@Override public void execute(Runnable command) { MoreExecutors.newThread(serviceName(), command).start(); } };
/** Returns a new started daemon Thread running the given runnable. */ Thread newStartedThread(Runnable runnable) { Thread t = new Thread(runnable); t.setDaemon(true); t.start(); return t; }
@Override public void subscribe(final Subscriber<? super String> subscriber) { subscriber.onSubscribe(new BooleanSubscription()); new Thread(new Runnable() { @Override public void run() { counter.incrementAndGet(); subscriber.onNext("one"); subscriber.onComplete(); } }).start(); } }).publish();
@Override public void subscribe(final Subscriber<? super String> subscriber) { subscriber.onSubscribe(new BooleanSubscription()); new Thread(new Runnable() { @Override public void run() { counter.incrementAndGet(); subscriber.onNext("one"); subscriber.onComplete(); } }).start(); } }).cacheWithInitialCapacity(1);
private static void scheduleEnableWrites(BlockingQueue<String> queue, long countdownInMillis) { Runnable toRun = new EnableWrites(queue, countdownInMillis); // TODO(cpovirk): automatically fail the test if this thread throws Thread enablerThread = new Thread(toRun); enablerThread.start(); } }
private static void scheduleEnableReads(BlockingQueue<String> queue, long countdownInMillis) { Runnable toRun = new EnableReads(queue, countdownInMillis); // TODO(cpovirk): automatically fail the test if this thread throws Thread enablerThread = new Thread(toRun); enablerThread.start(); } }
@Override public void subscribe(final Subscriber<? super String> subscriber) { subscriber.onSubscribe(new BooleanSubscription()); t = new Thread(new Runnable() { @Override public void run() { subscriber.onNext("hello"); subscriber.onComplete(); } }); t.start(); } }
@Override public void subscribe(final Observer<? super String> observer) { observer.onSubscribe(Disposables.empty()); new Thread(new Runnable() { @Override public void run() { counter.incrementAndGet(); observer.onNext("one"); observer.onComplete(); } }).start(); } }).replay();
@Override public void subscribe(final Observer<? super String> observer) { observer.onSubscribe(Disposables.empty()); new Thread(new Runnable() { @Override public void run() { counter.incrementAndGet(); observer.onNext("one"); observer.onComplete(); } }).start(); } }).publish();
@Override public void subscribe(final Observer<? super String> observer) { observer.onSubscribe(Disposables.empty()); new Thread(new Runnable() { @Override public void run() { counter.incrementAndGet(); observer.onNext("one"); observer.onComplete(); } }).start(); } }).cache();
@Override public void subscribe(final Observer<? super String> observer) { observer.onSubscribe(Disposables.empty()); new Thread(new Runnable() { @Override public void run() { counter.incrementAndGet(); observer.onNext("one"); observer.onComplete(); } }).start(); } }).cacheWithInitialCapacity(1);
@Override public void subscribe(final Observer<? super String> observer) { observer.onSubscribe(Disposables.empty()); t = new Thread(new Runnable() { @Override public void run() { observer.onNext("hello"); observer.onComplete(); } }); t.start(); } }
private TimedThread(long expectedCompletionWaitMillis) { completed = new Completion(expectedCompletionWaitMillis); thread = new Thread(new JoinTarget(expectedCompletionWaitMillis)); thread.start(); }
public void testJoinWithNoWait() throws InterruptedException { Stopwatch stopwatch = Stopwatch.createStarted(); Thread thread = new Thread(new JoinTarget(15)); thread.start(); thread.join(); assertFalse(thread.isAlive()); joinUninterruptibly(thread); joinUninterruptibly(thread, 0, MILLISECONDS); joinUninterruptibly(thread, -42, MILLISECONDS); joinUninterruptibly(thread, LONG_DELAY_MS, MILLISECONDS); assertTimeNotPassed(stopwatch, LONG_DELAY_MS); }