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

org.nustaq.utils.TrafficMonitorUtil Maven / Gradle / Ivy

There is a newer version: 5.2.0
Show newest version
package org.nustaq.utils;

import org.nustaq.kontraktor.remoting.base.TrafficMonitor;

public class TrafficMonitorUtil {

    public final static String IN = "in";
    public final static String OUT = "out";

    public static void monitorTraffic(TrafficMonitor trafficMonitor, String sid, String direction, String path, int length) {
        if( trafficMonitor == null )  {
            return;
        }

        switch (direction) {
            case IN:
                trafficMonitor.requestReceived(length, sid, path);
                break;
            case OUT:
                trafficMonitor.responseSend(length, sid, path);
                break;
            default:
                throw new IllegalArgumentException("direction must be 'in' or 'out'");
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy