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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:21:27+00:00 2026-05-13T07:21:27+00:00

This is related to an earlier question I asked, where the answer was: If

  • 0

This is related to an earlier question I asked, where the answer was:

If a field is accessed by multiple
threads, it should be volatile or
final, or accessed only with
synchronized blocks. Otherwise,
assigned values may not be visible to
other threads.

In addition anything that manipulates pixels on screen should be run from the event dispatch thread although this is handled transparently when you use repaint / paint.

Therefore, by my understanding, we need worry about the memory model for something as simple as an animation of a sprite moving across the screen.

My question is, is this understanding correct, and Sun tutorial examples eg TumbleItem (source) incorrect?

  • 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-13T07:21:27+00:00Added an answer on May 13, 2026 at 7:21 am

    You know, I think you may have a point here. The TumbleItem code uses worker.isDone() to find out whether the work has been completed. However, I don’t think this causes a full “synchronize”.

    My reading of the JDK 1.6 code is that SwingWorker.isDone() uses FutureTask which in turn uses a Sync object with a volatile state attribute. The execution path for isDone() doesn’t seem to involve a synchronized method or block.

    I’m not a real expert on the new concurrent classes, but I think the TumbleItem should be calling worker.get() at some point to guarantee proper synchronization.

    EDIT: I’m referring to the EDT’s use of the img array that is populated by the worker. However, it also appears there is an issue with the EDT’s use of the initialization parameters, as noted by @The Feast.

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

Sidebar

Related Questions

This question relates to this question which I asked earlier this week. The answer
This is related to this question I asked earlier about syntax highlighting user-defined blocks
So this is related to a question I asked earlier. I am trying to
This is related to an earlier question I asked. I'm adding a toString() method
This question is related to my earlier question, asked here: How do I get
I asked this question earlier: mod_rewrite: match only if no previous rules have matched?
This question is related to one I asked earlier: Adding buttons to a TabControl
This is actually related to a question I asked earlier, but I was left
I asked a related but very general question earlier (see especially this response ).
A related question to one I asked earlier ... Just checking on something: Should

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.