Last active
December 10, 2015 13:59
-
-
Save sdorra/4444488 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Extension | |
public class ReportContextListener implements ServletContextListener { | |
private final AdministrationContext adminContext; | |
private final SchedulerFactory schedulerFactory; | |
@Inject | |
public ReportContextListener(AdministrationContext adminContext, | |
SchedulerFactory schedulerFactory){ | |
this.adminContext = adminContext; | |
this.schedulerFactory = schedulerFactory; | |
} | |
@Override | |
public void contextDestroyed(ServletContextEvent sce) {} | |
@Override | |
public void contextInitialized(ServletContextEvent sce){ | |
Schedulers.schedule(adminContext, schedulerFactory, | |
SimpleScheduleBuilder.repeatMinutelyForever(), ReportJob.class); | |
} | |
private static class ReportJob implements Job { | |
@Override | |
public void execute(JobExecutionContext context) throws JobExecutionException { | |
// do something minutely | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment