I follow the instructions Using the Timer Service to create a simple scheduled run. Trying an automatic approach and using WildFly 8.1.0 Final for it.
Bean Session
@Singleton @Startup public class HelloJob { private static final Logger logger = Logger.getLogger(HelloJob.class); public HelloJob() { logger.error(">>> Hello Job Created."); } @Schedule(second="*") public void sayHello() { logger.error(">>> Server Hello!"); } }
When you deploy the class, the message instance >>> Hello Job Created. is correctly created >>> Hello Job Created. , but the sayHello() method is never called.
According to the tutorial, @Schedule(second="*") means that it should run every second.
Setting an attribute to an asterisk (*) represents all valid values ββfor the attribute.
Also, only a session with beans state is not allowed for timers, and I use singleton, which is also used in the example.
The bean corporate container timer service allows you schedules for all types of beans enterprise except for a session with beans state.
source share