• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
reply
    Bookmark Topic Watch Topic
  • New Topic