package com.tsi.comm.server.process;

import lombok.Getter;

@Getter
public abstract class AbstractTsiCvimWorker {

    protected long avgTime = 0;
    protected int idx;
    protected int qSize;

    public abstract boolean add(Object packet);
    public abstract void process(Object packet);
    public abstract void report();

    protected long calcProcessTime(long recvTime) {
        long jobTime = System.nanoTime() - recvTime;
        if (this.avgTime == 0) {
            this.avgTime = jobTime;
        }
        else {
            this.avgTime = (this.avgTime + jobTime) / 2L;
        }
        return this.avgTime;
    }

}
