/*
 * jPOS Project [http://jpos.org]
 * Copyright (C) 2000-2013 Alejandro P. Revilla
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.jpos.util;

import java.util.TimerTask;


/**
 * WatchDog will issue a warning message 
 * if not canceled on time
 */
public class WatchDog extends TimerTask {
    String message;
    String logName;
    String realm;
    public WatchDog (long maxWait, String message) {
        this.message = message;
        this.logName = "Q2";
        this.realm = "watchdog";
        DefaultTimer.getTimer().schedule (this, maxWait);
    }
    public void setLogName (String logName) {
        this.logName = logName;
    }
    public void setRealm (String realm) {
        this.realm = realm;
    }
    public void run () {
        Log.getLog (logName, realm).warn (message);
    }
}


@@ -799,20 +799,91 @@
 il.Timer
-Task
+;%0Aimport java.util.TimerTask;%0Aimport java.util.concurrent.atomic.AtomicLong
 ;%0A%0A%0A/**%0A
@@ -955,16 +955,44 @@
 ime%0A */%0A
+@SuppressWarnings(%22unused%22)%0A
 public c
@@ -1092,86 +1092,476 @@
    p
-ublic WatchDog (long maxWait, String message) %7B%0A        this.message = message
+rivate static Timer timer = new Timer(true);%0A    private static AtomicLong counter = new AtomicLong(0L);%0A    public static long PURGE_INTERVAL = 1000L;%0A%0A    public WatchDog (long duration) %7B%0A        timer.schedule(this, duration);%0A        if (counter.incrementAndGet() %25 PURGE_INTERVAL == 0)%0A            timer.purge();  // pro-active purge due to excessive number of timertask cancels.%0A    %7D%0A    public WatchDog (long duration, String message) %7B%0A        this(duration)
 ;%0A  
@@ -1632,56 +1632,30 @@
     
-DefaultTimer.getTimer().schedule (this, maxWait)
+this.message = message
 ;%0A  
@@ -1839,24 +1839,57 @@
 id run () %7B%0A
+        if (message != null)%0A    
         Log.
@@ -1932,13 +1932,12 @@
 e);%0A
-
     %7D%0A
+
 %7D%0A
-%0A

Add no message constructor