Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Question  RSS feed

 
Mike Demon
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it Legal or ok to call a future task's run method directly?

As in
futureTask.run();
return futureTask.get();

Not using a thread at all....yes the code will be sequential and not multithreaded but I just wanted to know if its nonconforming on not thread safe in anyway?

Thanks in advance.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would say it is bad practice and will probably cause you grief at some point.

I can't imagine a situation that would require it.

Bill
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!