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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:42:21+00:00 2026-06-17T16:42:21+00:00

My extended SwingWorker class performs a potentially reoccurring background task which requires GUI originating

  • 0

My extended SwingWorker class performs a potentially reoccurring background task which requires GUI originating input variables.

I see 2 coding options:

  1. To start a new instance of the class each time I use it and pass
    the variables to the constructor. I presume I should make sure there
    are not to many instances. If so how? multiton or some other method?

  2. Update the variables and call execute again? If so how do I make
    sure i’m not interrupting?

Is one of these options the way to go or is there a better way?

  • 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-17T16:42:22+00:00Added an answer on June 17, 2026 at 4:42 pm

    Plase use option 1.

    Immutable objects are normally easier to work with. For example, you prevent the problem that the variables are updated while the worker is still working, and you have to think less about memory visibility.

    Object instantiation is quite cheap in Java, so this won’t be a performance problem and you can create a new instance every time to need one.

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

Sidebar

Related Questions

I extended the functionality of a line object using a class which takes a
I extended Application to store my global variables: public class MyApp extends Application{ private
I've extended the Backbone Collection class to include a save method, which is essentially
I have extended PHP's mysqli class, which works fine. But how can I make
I have an extended GridView class, GridViewEx, which inherits from the basic ASP.NET gridview.
I have an extended from BaseAdapter class which used as a custom Adapter for
Here is my sample code... I am facing problem that my swingWorker extended class
I extended the User model in django to include several other variables, such as
In my extended PreferenceActivity class I call addPreferencesFromResource(R.xml.livewallpaper_settings) so I have a xml file
I have extended SimpleCursorAdapter and am running into a weird issue with bindView, which

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.