Содержание дисплея SYS.AQ$ AQ Oracle _JMS_TEXT_MESSAGE

Это очень распространенная ситуация, когда мне нужно остановить службу, прежде чем завершить процесс. В некоторых случаях недостаточно с stopService (намерением). Вы должны иметь в виду реализацию onDestroy () в моем сервисе. Пример:

public class MyIntentService extends IntentService {

    // Defines and instantiates an object for handling status updates.
    private BroadcastNotifier mBroadcaster = null;
    private int progress = 0; //THIS IS MY COUNTER FOR EXAMPLE!!!

    public MyIntentService() {
        super("MyIntentService");
    }

    @Override
    protected void onHandleIntent(Intent intent) {

        progress = 0;
        int tiempo_disponible = intent.getIntExtra("minutos_disponible", 0);

        if (mBroadcaster == null){

            mBroadcaster = new BroadcastNotifier(this);
        }
        // Broadcasts an Intent indicating that processing has started.
        mBroadcaster.broadcastIntentWithState(Constants.STATE_ACTION_STARTED);

        mBroadcaster.broadcastIntentWithState(Constants.STATE_ACTION_RUNNING);

        while (progress < tiempo_disponible) {

            progress++;
            try {
                Log.i(Constants.TAG, "Procesing " + progress);
                mBroadcaster.notifyProgress(progress);
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
        // Reports that the feed retrieval is complete.
        mBroadcaster.broadcastIntentWithState(Constants.STATE_ACTION_COMPLETE);
    }

    @Override
    public void onDestroy() {
        progress = 1000000; // WHITH THAT YOU FINISH THE CICLE IF tiempo_disponible NEVER IS MAYOR THAT 1000000, YOU CAN USE OTHER CONDITIONAL!!!!!!
        super.onDestroy();
    }
} 

Таким образом, когда вы остановили службу с помощью метода stopService, вы также остановите счетчик процесса.

public void stopService(){
        context.stopService(intent);
        LocalBroadcastManager.getInstance(context).unregisterReceiver(responseReceiver);
        responseReceiver = null;
        intent = null;
}

Берегите себя! @yaircarreno

13
задан Bruno Ranschaert 19 June 2009 в 21:44
поделиться

2 ответа

Я тоже боролся с этим. Я написал здесь ответ: http://rwijk.blogspot.com/2009/02/whats-in-my-jms-queue.html .

С уважением, Роб.

13
ответ дан 1 December 2019 в 22:08
поделиться

Итак, я полагаю, это должно быть:

select queue.user_data.text_vc from [queue_table] queue
6
ответ дан 1 December 2019 в 22:08
поделиться
Другие вопросы по тегам:

Похожие вопросы: