aspose file tools
The moose likes Threads and Synchronization and the fly likes Thread confusion Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Reply Bookmark "Thread confusion" Watch "Thread confusion" New topic
Author

Thread confusion

Dave cbank
Greenhorn

Joined: Mar 08, 2012
Posts: 1
Hi,

im fairly new to thread.


Currently making a client/server application.
i create a server thread from the main GUI and then pass the gui object to the server thread.
Server thread is waiting for incoming connections . on a new connection it starts the connection handling in a new thread as application is multithreaded
Gui object from server thread is passed onto each of these new threads which can then update the main gui.

i know this is a bad way of doing it.

Any help to guide me in the right direction and suggestion would be much appreciated.


Thanks.
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 16687
    
  19

Dave cbank wrote:
Currently making a client/server application.
i create a server thread from the main GUI and then pass the gui object to the server thread.
Server thread is waiting for incoming connections . on a new connection it starts the connection handling in a new thread as application is multithreaded
Gui object from server thread is passed onto each of these new threads which can then update the main gui.


If by GUI, you mean Swing, remember that it is *not* thread safe. You have to make sure that all changes are done by the event dispatch thread.

Henry
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Thread confusion
 
Similar Threads
Gui and Threading
Defining an inside class externally?
client and server network
Configuration GUI & suncertify.properties
Multi-threaded RMI server