Code example for PriorityBlockingQueue

Methods: add

0
     * @param param action parameter. 
     */ 
    protected final void executeAction(int priority, int code, Object param) {
        final ControllerAction action = ControllerAction.obtain(code, param);
        action.priority = priority;
        mActionQueue.add(action);
 
        // Here we just signal the handler since the messages are stored 
        // in the priority queue 
        mControllerHandler.obtainMessage().sendToTarget();
    } 
 
    /** 
     * Dispatches an asynchronous {@link ControllerAction} instance with the specified code and 
     * param to the background by calling {@link #handleControllerAction(ControllerAction)}. 
     * 
     * Note: The priority of the message is the lowest. See {@link #executeAction(int, int, Object)} 
     * 
     * @param code action code. 
     * @param param action parameter. 
     */