Hi,
we have a Servlet with a timer which calls an EGL Program.
The timer runs daily at 07:00 am.
It works very fine.
But if we restart the websphere application server e.g. at 01:00 pm the timer fires immediately again.
package servlet;import java.text.ParseException;import java.util.Calendar;import java.util.Timer;import java.util.TimerTask;import javax.servlet.http.HttpServlet;import com.ibm.javart.JavartException;import com.ibm.javart.calls.PowerServer;import com.ibm.javart.calls.PowerServerImpl;public class InventurExportServlet extends HttpServlet { private static final long serialVersionUID = -7218615493958066258L; public InventurExportServlet() throws ParseException { Timer timer = new Timer(); Task_INVENTUREXPORT task = new Task_INVENTUREXPORT(); Calendar today = Calendar.getInstance(); today.set(Calendar.HOUR_OF_DAY, 7); today.set(Calendar.MINUTE, 20); today.set(Calendar.SECOND, 0); timer.schedule(task, today.getTime(), 43200000 * 2); // 24 Stunden }}class Task_INVENTUREXPORT extends TimerTask { public void run() { PowerServer server = new PowerServerImpl(); try { InventurExportWrapper wrapper = new InventurExportWrapper(server); wrapper.call(); server.commit(); server.close(); } catch (JavartException je) { // handle error. je.printStackTrace(); } finally { try { if (server != null) { server.close(); } } catch (JavartException je) { } } }}
Kind Regards.
Marcel-D