All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.asteriskjava.pbx.internal.eventQueue.EventLifeMonitor Maven / Gradle / Ivy

There is a newer version: 3.41.0
Show newest version
package org.asteriskjava.pbx.internal.eventQueue;

import org.asteriskjava.pbx.util.LogTime;
import org.asteriskjava.util.Log;
import org.asteriskjava.util.LogFactory;

public class EventLifeMonitor
{
    private static final Log logger = LogFactory.getLog(EventLifeMonitor.class);

    /*
     * this class is used to hold an event while its in the queue and calculate
     * how long it spent in the que before being processed.
     */

    private final T theEvent;

    private final LogTime age;

    public EventLifeMonitor(final T event)
    {
        this.theEvent = event;
        this.age = new LogTime();
    }

    public void assessAge()
    {
        if (this.age.timeTaken() > 2000)
        {
            EventLifeMonitor.logger.warn("event age : " + this.age.timeTaken()); //$NON-NLS-1$
        }

    }

    public T getEvent()
    {
        return this.theEvent;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy