com.github.arnabk.App Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of server-status Show documentation
Show all versions of server-status Show documentation
https://github.com/arnabk/server-status
The newest version!
/*
* Copyright 2014 arnab.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.arnabk;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
/**
* @author arnab
*/
public class App {
public static void main(String[] args) {
if (checkParams(args)) {
final int frequency = Integer.parseInt(StringUtils.trimToEmpty(args[0])); //in minutes
final BlockingChecker blockingChecker = new BlockingChecker();
blockingChecker.execute(frequency, args);
}
}
private static boolean checkParams(String args[]) {
boolean ret = false;
if (args.length < 2) {
printUsage();
} else {
if (NumberUtils.isNumber(args[0])) {
ret = true;
} else {
printUsage();
}
}
return ret;
}
private static void printUsage() {
System.out.println("mvn exec:java -Dexec.args=\" ....\"");
System.out.println("For example, mvn exec:java -Dexec.args=\"1 www.google.com www.bing.com\"");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy