package com.timostaudinger.dailydose.trigger;


import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;

@WebListener
public class Trigger implements ServletContextListener {

    private ScheduledExecutorService scheduler;

    @Override
    public void contextInitialized(ServletContextEvent event) {
        scheduler = Executors.newSingleThreadScheduledExecutor();
//        scheduler.scheduleAtFixedRate(new DailyRunner(), 0, 1, TimeUnit.MINUTES);
        // TODO
    }

    @Override
    public void contextDestroyed(ServletContextEvent event) {
        scheduler.shutdownNow();
    }

}

@@ -165,32 +165,148 @@
 on.WebListener;%0A
+import java.time.Duration;%0Aimport java.time.LocalDateTime;%0Aimport java.time.ZoneId;%0Aimport java.time.ZonedDateTime;%0A
 import java.util
@@ -381,16 +381,54 @@
 Service;
+%0Aimport java.util.concurrent.TimeUnit;
 %0A%0A@WebLi
@@ -611,32 +611,590 @@
 tEvent event) %7B%0A
+        LocalDateTime localNow = LocalDateTime.now();%0A        ZoneId currentZone = ZoneId.of(%22America/New_York%22);%0A        ZonedDateTime zonedNow = ZonedDateTime.of(localNow, currentZone);%0A        ZonedDateTime zonedExecutionTime;%0A        zonedExecutionTime = zonedNow.withHour(8).withMinute(0).withSecond(0);%0A        if (zonedNow.compareTo(zonedExecutionTime) %3E 0)%0A            zonedExecutionTime = zonedExecutionTime.plusDays(1);%0A%0A        Duration duration = Duration.between(zonedNow, zonedExecutionTime);%0A        long initalDelay = duration.getSeconds();%0A%0A
         schedule
@@ -1243,18 +1243,16 @@
 utor();%0A
-//
         
@@ -1304,48 +1304,69 @@
 (), 
-0, 1, TimeUnit.MINUTES);%0A        // TODO
+initalDelay,%0A                24 * 60 * 60, TimeUnit.SECONDS);
 %0A   

Configure Timer. Calculate inital delay in order to start the execution daily at 9am EST.