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 6682435
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:42:21+00:00 2026-05-26T04:42:21+00:00

How do i assign Status with CallMe() using isFinish() to have returned value true?

  • 0

How do i assign Status with CallMe() using isFinish() to have returned value true?

public static boolean isFinish ()
{    
  boolean Status = false;
  new Thread(new Runnable()
  {
    public void run()
    {
      /* This shell return true or false 
       * How do you keep it in Status
       */
      CallMe(); 
    }
  }).start();

  /* How can i get the true or false exactly from CallMe? here */
  return Status;
}

public static boolean CallMe()
{
  /* some heavy loads ... */
  return true;
}
  • 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-05-26T04:42:21+00:00Added an answer on May 26, 2026 at 4:42 am

    There are two ways of doing this.
    The first is to use a future computation result and the other is to have a shared variable.
    I think that the first method is much cleaner than the second, but sometimes you need to push values to the thread too.

    • Using a RunnableFuture.

    FutureTask implements a RunnableFuture. So you create that task which, once executed, will have a value.

    RunnableFuture f = new FutureTask(new Callable<Boolean>() {
      // implement call
    });
    // start the thread to execute it (you may also use an Executor)
    new Thread(f).start();
    // get the result
    f.get();
    
    • Using a holder class

    You create a class holding a value and share a reference to that class. You may create your own class or simply use the AtomicReference.
    By holder class, I mean a class that has a public modifiable attribute.

    // create the shared variable
    final AtomicBoolean b = new AtomicBoolean();
    // create your thread
    Thread t = new Thread(new Runnable() {
      public void run() {
        // you can use b in here
      }
    });
    t.start();
    // wait for the thread
    t.join();
    b.get();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a rspec mocked object, a value is assign to is property. I
I want to assign a resource I already have a second name, similar to
Is there a way in MySQL table to assign a default when a value
I have a monitoring application which via gui displays that status of a number
I am wondering if you can assign a status to .page or dcr files
I have created an NSStatusBar cocoa application which sits in the system status bar.
I have a js function I want to assign a variable to a variable
Most projects have some sort of data that are essentially static between releases and
I have an array of objects, I find the item by index, assign a
I'm using Qt with Python, and I've got a mainwindow with a status bar

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.