Skip to content

stasiukevych/ejb-timer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EJB Timer Service

It's a very powerful mechanism to create different kind of schedule.

Description

As we know, Timer Service can close task for scheduling like monthly report generation, sever checking, birthday notification for customer etc. Approach of the service is very similar to Unix cron utility. We can use the same parameters for describing time period of schedule.

Project

Generally, we can describe our schedule using declarative and programmatic approach. In our case, it's declarative description using @Schedule annotation.

package ejb.timer;

import jakarta.ejb.Schedule;
import jakarta.ejb.Stateless;
import java.util.Date;

@Stateless
public class StatisticsEJB {

  @Schedule(hour = "*", minute = "*/1")
  public void sendMinutesServerStatistics() {
    System.out.println("Your server is alive at: " + new Date());
  }
}

As example, we want to create schedule, which will be checked the server statistic we just add one annotation and period description similar to cron utility.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages