• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

nx: [urlybird 1.3.1] any problems starting server from event dispatcher thread?

 
james render
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All my initialisation code, validating user inputs, saving the property file, starting server, loading up the data file, is done from the swing event dispatcher thread once the user hits 'OK'. This way if there are any problems I can send them to the GUI and have them displayed as a nice lovely dialog.
Are there any disadvantages from this approach apart from an unresponsive GUI?
thanks as usual
James
 
Guido Tapia
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You shouldnt do client-server communication in the AWT Thread. Its a badly looked upon practice and in an assignment such as this I think its better to be as accademic as possible. What you should do in your GUI is something like this.


Thats what I reckon anyway, its not a hard way to do it and its pretty clean. Oh, you should also consider dissabling the GUI prior to starting the new Thread and re-enable it when the action is complete (or in case of an exception). Also remember swing is not thread safe (look at) SwingUtilities.invokeLater
GT
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic