@Test public void taskCrash() throws Exception { ExecutorService exec = Executors.newSingleThreadExecutor(); List<Throwable> errors = TestHelper.trackPluginErrors(); try { InstantPeriodicTask task = new InstantPeriodicTask(new Runnable() { @Override public void run() { throw new TestException(); } }, exec); assertNull(task.call()); TestHelper.assertUndeliverable(errors, 0, TestException.class); } finally { exec.shutdownNow(); RxJavaPlugins.reset(); } }
@Override public Void call() throws Exception { runner = Thread.currentThread(); try { task.run(); setRest(executor.submit(this)); runner = null; } catch (Throwable ex) { runner = null; RxJavaPlugins.onError(ex); } return null; }
InstantPeriodicTask implements Callable<Void>, Disposable { @Override public Void call() throws Exception { runner = Thread.currentThread(); try { task.run(); setRest(executor.submit(this)); runner = null; } catch (Throwable ex) { runner = null; RxJavaPlugins.onError(ex); } return null; } }
InstantPeriodicTask implements Callable<Void>, Disposable { @Override public Void call() throws Exception { runner = Thread.currentThread(); try { task.run(); setRest(executor.submit(this)); runner = null; } catch (Throwable ex) { runner = null; RxJavaPlugins.onError(ex); } return null; } InstantPeriodicTask(Runnable task, ExecutorService executor); }
InstantPeriodicTask implements Callable<Void>, Disposable { @Override public Void call() throws Exception { runner = Thread.currentThread(); try { task.run(); setRest(executor.submit(this)); runner = null; } catch (Throwable ex) { runner = null; RxJavaPlugins.onError(ex); } return null; } InstantPeriodicTask(Runnable task, ExecutorService executor); @Override Void call(); @Override void dispose(); @Override boolean isDisposed(); }
InstantPeriodicTask implements Callable<Void>, Disposable { @Override public Void call() throws Exception { runner = Thread.currentThread(); try { task.run(); setRest(executor.submit(this)); runner = null; } catch (Throwable ex) { runner = null; RxJavaPlugins.onError(ex); } return null; } InstantPeriodicTask(Runnable task, ExecutorService executor); @Override Void call(); @Override void dispose(); @Override boolean isDisposed();  }