My problem is: I have two blocks of code.. One block I execute only if the Timer reached 10seconds.. so I invoke the TimerTask with the piece of code.. The other block of code I execute only if I don't get into the TimerTask function.. (the run() function).. 
Is there a way to know if a TimerTask has completed its execution, like returning a Boolean variable, for example? I'm programming in Java.

I tried:

```
TimerTask emd = new EsperaMensagemDigitada(outgoing, incoming);
timer.schedule(emd, 10000);
if(emd.cancel() == true){
   messageOut = userInput.readLine();               
   outgoing.println(messageOut + "            [Sua vez]");
   System.out.println("Aguardando resposta...");
   outgoing.flush();    
}

```

but it seems that it will ALWAYS execute the code inside the if clausure.. so I dind't resolve my problem yet.. 

The other part of this problem is that I have this code: 

```
messageOut = userInput.readLine();

```

I want, if the user doesn't enter any message for 10 seconds I print a default message, if he entered a message until 10 seconds, I print his message. The problem is I get stuck on userInput.readLine(), waiting for an entry..