title: How to retry function request after a certain time
body: <p>How do I make it retry the send attempt if user data is null. Max 2 retries, 1 retry after 10 seconds?</p>
  
  <pre><code>public class UserHandler {
    private List users = new ArrayList();
  
    public void addUser(username) {} //adds user
    public Userdata findUser(username) {} //finds user
  
    public void sendTo(String username, String message) {
      Userdata user = findUser(username);
      if(user != null) {
          Out out = new Out(user.getClientSocket());
          out.println(message);
      } 
    }
  }
  </code></pre>
  
  <p>Do I really have to manually insert a thread and sleep it inside sendTo()?</p>
  
  <p>EDIT: the server uses java 1.4.2</p>