/** * Executes the specified runnable on the worker thread of the view. Execution is performed * sequentially in the same sequence as the runnables have been passed to this method. */ @Override public void execute(Runnable worker) { if (executor == null) { executor = Executors.newSingleThreadExecutor(); } executor.execute(worker); }
/** * Gets rid of all the resources of the view. No other methods should be invoked on the view * afterwards. */ @SuppressWarnings("unchecked") @Override public void dispose() { if (executor != null) { executor.shutdown(); executor = null; } if (disposables != null) { for (Disposable d : (LinkedList<Disposable>) disposables.clone()) { d.dispose(); } disposables = null; } removeAll(); }