title: Repeat an action every 2 seconds in java
body: <p>I have to repeat a part of my code every 2 seconds how could I do that? don't tell me to use 
  <code>try {
  Thread.sleep(millisecondi);
  }
  catch (Exception e) {}</code></p>
  
  <p>because freeze the application </p>