@@ -0,0 +1,1639 @@
+package org.openfact.services.managers;%0A%0Aimport org.openfact.models.OrganizationModel;%0A%0Aimport javax.annotation.PostConstruct;%0Aimport javax.annotation.PreDestroy;%0Aimport javax.annotation.Resource;%0Aimport javax.ejb.*;%0Aimport java.util.Collection;%0Aimport java.util.HashMap;%0Aimport java.util.Map;%0A%0A@Startup%0A@Singleton%0Apublic class ScheduleOrganizations %7B%0A%0A    @Resource%0A    private TimerService timerService;%0A%0A    private Map%3CString, Timer%3E organizationTimers;%0A    private Map%3CTimer, String%3E timerOrganizations;%0A%0A    @PostConstruct%0A    private void init() %7B%0A        organizationTimers = new HashMap%3C%3E();%0A        timerOrganizations = new HashMap%3C%3E();%0A    %7D%0A%0A    @PreDestroy%0A    private void close() %7B%0A        Collection%3CTimer%3E timers = timerService.getAllTimers();%0A        for (Timer t : timers) %7B%0A            t.cancel();%0A        %7D%0A    %7D%0A%0A    @Lock(LockType.WRITE)%0A    public void scheduleTask(OrganizationModel organization) %7B%0A        if (organizationTimers.containsKey(organization.getId())) %7B%0A            Timer timer = organizationTimers.get(organization.getId());%0A            timer.cancel();%0A        %7D%0A%0A        ScheduleExpression expression = new ScheduleExpression();%0A        Timer timer = timerService.createCalendarTimer(expression);%0A%0A        organizationTimers.put(organization.getId(), timer);%0A        timerOrganizations.put(timer, organization.getId());%0A    %7D%0A%0A    @Timeout%0A    @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)%0A    public void execute(Timer timer) %7B%0A        String organizationId = timerOrganizations.get(timer);%0A%0A        System.out.println(%22executing task on organization id:%22 + organizationId);%0A    %7D%0A%7D%0A

change h2 module version