Main.java

40 lines | 1.126 kB Blame History Raw Download
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package br.ufrgs.inf.prosoft.requestssimulator;

import java.util.logging.Logger;

/**
 *
 * @author romulo
 */
public class Main {

    private static final Logger logger = Logger.getLogger(Main.class.getName());

    public static void main(String[] args) {
        System.setProperty("java.util.logging.SimpleFormatter.format", "[%1$tF %1$tT+%1$tL] [%4$-7s] [RequestsSimulator] %5$s %n");

        String path = null;
        int users = 1;
        if (args.length < 1) {
            System.err.println("<RequestsPath> [<users>]");
            System.exit(1);
        } else {
            path = args[0];
            if (args.length == 2) {
                try {
                    users = Integer.valueOf(args[1]);
                } catch (NumberFormatException ex) {
                    System.err.println("<users> must be a number");
                    System.exit(1);
                }
            }
        }
        Simulator.simulate(path, users);
    }
}