Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Which way is better?

 
Zhou Can
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • 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...
 
John Lee
Ranch Hand
Posts: 2545
  • Mark post as helpful
  • send pies
  • 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.
 
Ralf Riedel
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic