Rafael Costa
Rafael Costa

Reputation: 51

Timers - Error using the annotation @Timeout

I have the following code:

package ejb;
import javax.annotation.Resource;
import javax.ejb.Stateless;
import javax.ejb.Timeout;
import javax.ejb.Timer;
import javax.ejb.TimerConfig;
import javax.ejb.TimerService;

@Stateless
public class timerbackup {

 @Resource
 protected TimerService timerservice

  @Timeout
  public void methodTimeout(Timer timer)
  {       
    System.out.println("timeout");     
  } 
  public void settimer(long in)
  {       
    Timer timer=timerservice.createSingleActionTimer(in,new TimerConfig()); 
  }
} 

Unfortunately appers the following error message "illegat start of type" in the annotation "@Timeout". Can anyone explain the reason for this message error and present a possible solution for the problem.

Thank you for the help.

Best Regards, Rafael Costa

Upvotes: 0

Views: 250

Answers (1)

Geinmachi
Geinmachi

Reputation: 1251

You don't have ; at the end of protected TimerService timerservice.

Upvotes: 1

Related Questions