
com.qiniu.util.SystemUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of qsuits Show documentation
Show all versions of qsuits Show documentation
qiniu-suits is a efficient tools for qiniu api implemented by java8.
package com.qiniu.util;
import java.util.concurrent.atomic.AtomicBoolean;
public class SystemUtils {
/**
* 程序退出方法,用于在多线程情况下某个线程出现异常时退出程序,如果同时多个线程抛出异常则通过 exitBool 来判断是否已经执行过退出程序,故只输出
* 一次异常信息
* @param exitBool 多线程的原子操作 bool 值,初始值应该为 false
* @param e 异常对象
*/
synchronized static public void exit(AtomicBoolean exitBool, Throwable e) {
if (!exitBool.get()) e.printStackTrace();
exitBool.set(true);
System.exit(-1);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy