@ Override public void execute ( Runnable runnable ) { if ( runnable == null ) { throw new NullPointerException ( "runnable parameter is null" ) ; } if ( ! mWorkQueue . offer ( runnable ) ) { throw new RejectedExecutionException ( mName + " queue is full, size=" + mWorkQueue . size ( ) ) ; } final int queueSize = mWorkQueue . size ( ) ; final int maxSize = mMaxQueueSize . get ( ) ; if ( ( queueSize > maxSize ) && mMaxQueueSize . compareAndSet ( maxSize , queueSize ) ) { FLog . v ( TAG , "%s: max pending work in queue = %d" , mName , queueSize ) ; } // else, there was a race and another thread updated and logged the max queue size startWorkerIfNeeded ( ) ; }
Submit a task to be executed in the future .