• 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

Which way is better?

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In my design , after ur pressing "Search" and "Book" button , A new thread is created and begin to run , some action such as searching database and book flight is done in those threads . But i found that using no thread is a better way to take , and the corresponding cost is that you can't take the "cancel" action to the thread .
Which way is better ?
Thanx...
 
Ranch Hand
Posts: 2545
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In my design, I just used the same thread.
When you used different thread for 'book' and 'cancel', don't you need another set of lock/unlock? Even that, you still have to draw a line somewhere sometime, then again, user won't be able to cancel the booking once passing the line, so the result is pretty much the same.
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Zhou,
think about how your gui behaves with long running (say, 2 seconds) method calls on the server - if you call those methods from the gui thread, the client will look frozen to the user. Just for fun, I've inserted a sleep into the criteriaFind() method, and it felt bad
Maybe with the 24 records in the assignment this all is no problem, but I always tried to keep a real environment in mind.
Greetings,
Ralf
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic