Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8338233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:31:44+00:00 2026-06-09T04:31:44+00:00

I got these kind of exception similar to AsyncTask, RejectedExecutionException and Task Limit ,

  • 0

I got these kind of exception similar to AsyncTask, RejectedExecutionException and Task Limit, and “grab code and add to my package”.My question is: is this the right anwser, anyone have other official solutions?

java.util.concurrent.RejectedExecutionException: Task android.os.AsyncTask$3@416cd2e0 rejected from java.util.concurrent.ThreadPoolExecutor@4101be78[Running, pool size = 128, active threads = 128, queued tasks = 10, completed tasks = 53]

    updateTimer.schedule(updateTask, 500, 3000);

…

    updateTask = new TimerTask() {

        public void run()
        {
            updateHandler.sendMessage(msg);
        }

    };

…

    updateHandler = new Handler() {

        public void handleMessage(Message msg)
        {
            updateAsync();
        }

    };

…

    new AsyncTask<Void, Void, Void>() {

        protected Void doInBackground(Void... params)
        {
            retrieveStatus();
            return null;
        }


        protected void onPostExecute(Void result)
        {
            super.onPostExecute(result);
            updateStatusUi();// !!!?

        }

    }.execute();

    updateTask = new TimerTask() {

        public void run()
        {
                retrieveStatus();
                getActivity().runOnUiThread(new Runnable() {

                    public void run()
                    {
                        updateStatusUi();
                    }

                });
        }

    };

IN ICS: After about 10 times, it never update any more. Can you please give me a Demo, so I can pass some rigor test like: MainActivity: open(), close(), …

P.S. myAsyncTask.executeOnExecutor(MyAsyncTask.SERIAL_EXECUTOR, [params] ); will work?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T04:31:45+00:00Added an answer on June 9, 2026 at 4:31 am

    First, you are forking a new thread every 500ms. This is really bad, on any OS, in any programming language.

    Second, you are forking yet another thread (your TimerTask), that is posting a message back to the main application thread, that is turning around and forking the AsyncTask. This is pointless.

    If you are going to use a TimerTask, simply call retrieveStatus() from your run() method, then use runOnUiThread() to execute updateStatusUi() on the main application thread. Now you are only using one background thread (the TimerTask) and introducing much less overhead to accomplish the same ends.

    Or, consider implementing your own ScheduledExecutorService instead of using TimerTask.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While answering this question, I got these confusing results: double d = 0.49999999999999990d; //output
I got two apps, with these package names: com.blah.a com.blah.b They got the sharedUserId
I've got the task to program a kind of commandline in Java. It's meant
I know this kind of question exist but I'm confused in this case. I'm
I got this exception but resolved it. java.lang.NoSuchMethodError: antlr.NoViableAltForCharException.<init> (CLjava/lang/String;II)V But i'd like to
This is kind of a weird question but... If I run this query in
AsyncTask: I removed all possible ui operation in background thread, still got those kind
I've got some kind of community website, there are about 40.000 users in database
Got these 2 queries: select d1.field_id_41 program_code, d1.field_id_48 program_group_code, t1.title program_lookup, t2.title group_title, t1.url_title
I've got these facebook permissions set in my app: NSArray *permissions = [[NSArray alloc]

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.