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

  • SEARCH
  • Home
  • 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 7769083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:04:38+00:00 2026-06-01T16:04:38+00:00

This is just a general question on actual thread design. I’m using Java on

  • 0

This is just a general question on actual thread design. I’m using Java on android specifically but general design would be the better focus of this question.

Its simple enough, which is better method in thread or thread in method.

Example,

Lets say we have 3 methods/functions/whatever.

public void readMail()
{
    //Logic...
}
public void postQuestion()
{
    //Logic...
}
public void answerQuestion()
{
    //Logic...
}

Is it better to have


A: Thread within Method

public void readMail()
{
    new Thread(new Runnable()
    {
        public void run()
        {
            //Logic
        }
    }).start();
}

And then call your method as you normally would in any OO situation. Say

Email.readMail();

B: Method within Thread

//note this could be inside a method or a class that extends runnable
new Thread(new Runnable()
{
    public void run()
    {
        readMail();
        postQuestion();
        answerQuestion();
    }
}).start();
  • 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-01T16:04:39+00:00Added an answer on June 1, 2026 at 4:04 pm

    Method within Thread

    • [+] If your methods do not need to ensure the property of concurrent execution, or they have deterministic runtime behavior (time and performance), this approach can be a high-level management for concurrency of the application; i.e. concurrency remains at the level of objects rather than methods.
    • [-] Since the concurrency remains at the level of threads/objects, the application may lose the notion of responsiveness. A user may be “posting a question” while another is “fetch an answer”; and both can be dealt with concurrently.

    Thread with Method

    • [+] More fine-grained concurrency control: each method becomes a unit of execution at the OS level. That’s why as @LouisWasserman mentioned, maybe, taking advantage of Executor framework would make more sense.
    • [-] Generally threads are resourceful and expensive; so this means that you will have performance issues when used in high-frequency/load application with numerous calls to one method. Specially, if there are inter-method data/logic dependencies. In this regard, synchronization also becomes a concerns and that’s why using Actor models can help more.

    I’d suggest reading more about Actor models and their available implementations.

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

Sidebar

Related Questions

This is just a general question. Which is better, traditional ajax or the jquery
Just a general curiosity question. Why is this namespace System.Collections.Generic added by default in
This is just a general question relating to some high-performance computing I've been wondering
This is just a general question irrespective of database architecture. I am maintaining an
This is just a general question regarding the debate between self-signed certificates and CA
This is just a general question. In TCP/IP when you set up a connection
This is just a general question - I was sitting and waiting for a
This is just a general knowledge question. Why havent I ever come across any
Although I'm programming in C++, this is more of a general question about design.
Update: If you've just arrived at this question, the general gist is that I'm

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.