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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:04:51+00:00 2026-06-10T13:04:51+00:00

In our application when a user clicks on commandlink, a pop up is generated.

  • 0

In our application when a user clicks on commandlink, a pop up is generated. This click will pass an id to process.

My managed bean is viewscoped and I am creating a thread to do some tasks.

In a scenario where a user clicks on the link a pop up is generated and the thread has started executing jobs, say the user closes the pop up and tries to click the link providing a different id this time. My problem is the previous thread which was started is not being destroyed. I can still get the latest id details as a response but the previous thread still executes jobs.

I would like to know if there is a way to terminate the previous instance thread on a new request. I know I can achieve this using sessionscoped but popups are being opened in the same session.

  • 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-10T13:04:53+00:00Added an answer on June 10, 2026 at 1:04 pm

    just as a quick solution possible for your use case:

    • I’d use threadpool rather than creating new thread per request (as thread pooling idea is more efficient + provided in standard API)
    • then you can easily stop any running thread in pool, solution I’ve found on: http://www.coderanch.com/t/234197/threads/java/stopping-runnable-ThreadPoolExecutor
      => question contains sample for threadpool implementation and the 1.st answer gives you the solution

    calling:

    boolean cancel(boolean mayInterruptIfRunning)
    

    In your case the call should use:

    mayInterruptIfRunning=true
    

    The only quesion left is: Where to keep the Future reference? 🙂
    We can discuss that if you want as well 🙂

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

Sidebar

Related Questions

In our application, I have seen code written like this: User.java (User entity) public
Greetings, In our application user may click on item in datagrid and new window
Our application allows administrators to add User Properties in order for them to be
In our application, we allow user's to write their Bio using a WYSIWYG editor,
A user reported to us that some strange behaviour in our application can be
I want to add a feature to our application that let's a user know
In our VB6 application, when the user's default printer is set to Microsoft Office
in our AIR application, I want to user to be able to download a
We need a special user control for our web application. It should ideally look
If we want in our WPF application to let a user make a SQL

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.