/** * Start the {@link SpiceManager}. It will bind asynchronously to the * {@link SpiceService}. * @param context * a context that will be used to bind to the service. Typically, * the Activity or Fragment that needs to interact with the * {@link SpiceService}. */ public synchronized void start(final Context context) { this.contextWeakReference = new WeakReference<Context>(context); if (isStarted()) { throw new IllegalStateException("Already started."); } else { executorService = Executors.newFixedThreadPool(getThreadCount(), new MinPriorityThreadFactory()); // start the binding to the service runner = new Thread(this, SPICE_MANAGER_THREAD_NAME_PREFIX + spiceManagerThreadIndex++); runner.setPriority(Thread.MIN_PRIORITY); isStopped = false; runner.start(); Ln.d("SpiceManager started."); } }