Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Thread.sleep() findbug  RSS feed

 
Harshana Dias
Ranch Hand
Posts: 352
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

How to get reduce of the find bug error saying. Manual thread scheduling with Thread.sleep() or Thread.yield() has no guaranteed semantics and is often used to mask race conditions.

I just use it for sleep the current thread for a while and its not used with in a condition statement. But its used inside a junit test case which has a assert statement at the end.

Thanks.
 
Stephan van Hulst
Saloon Keeper
Posts: 7707
141
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The warning is there to draw your attention to it. If you don't want it, switch it off in your IDE.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!