Search in sources :

Example 1 with EventProvider

use of calendar.EventProvider in project common by zenlunatics.

the class FiveMinuteThread method run.

// --------------------------------------------------------------------------
@Override
public void run() {
    // m_site.log("Starting FiveMinuteThread");
    while (true) {
        try {
            MailLists mail_lists = (MailLists) m_site.getModule("MailLists");
            if (mail_lists != null)
                mail_lists.checkForMail();
            LocalDateTime date_time = m_site.newLocalDateTime();
            DBConnection db = new DBConnection(m_site);
            for (Module module : m_site.getModules(EventProvider.class)) if (((EventProvider) module).supportsReminders())
                ((EventProvider) module).sendReminders(date_time, false, m_site, db);
            db.close();
        } catch (RuntimeException e) {
            m_site.log(e);
        }
        try {
            // 5 minutes
            Thread.sleep(5 * 60 * 1000);
        } catch (InterruptedException e) {
            System.out.println("FiveMinuteThread sleep exception");
            System.out.println(e.toString());
            m_site = null;
            return;
        }
    }
}
Also used : LocalDateTime(java.time.LocalDateTime) DBConnection(db.DBConnection) EventProvider(calendar.EventProvider) Module(app.Module)

Aggregations

Module (app.Module)1 EventProvider (calendar.EventProvider)1 DBConnection (db.DBConnection)1 LocalDateTime (java.time.LocalDateTime)1