Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Threads and Synchronization and the fly likes Updating a Thread variable. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Updating a Thread variable." Watch "Updating a Thread variable." New topic

Updating a Thread variable.

GoodVic Hunting

Joined: Sep 23, 2003
Posts: 3
Ladies n Gents,

A bit of help please.

I have a gui which contains a bunch of buttons. Each button corresponds to a process that I am monitoring. When a button is clicked, I need to display any messages pertaining to that process that I have. When an another button in clicked, I abandon the previous process and display updates for the another process.

My initial design was to have one thread which will display message for all the processes. Whenever a different button is clicked, I will update a variable in the thread to indicate it to get the update for a different process. This however, is not working, the thread starts and runs fine for the first click but doesn't seem to get notified when the second button is clicked.

Any Ideas, links would be appreciated.

Harish Kashyap
Ranch Hand

Joined: Jun 14, 2000
Posts: 118
Interrupting the thread may be helpful in this scenario
I agree. Here's the link:
subject: Updating a Thread variable.
It's not a secret anymore!