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

io.github.nichetoolkit.rest.helper.CloseableHelper Maven / Gradle / Ivy

There is a newer version: 1.1.0
Show newest version
package io.github.nichetoolkit.rest.helper;

import io.github.nichetoolkit.rest.util.GeneralUtils;
import lombok.extern.slf4j.Slf4j;

import java.io.Closeable;
import java.io.IOException;

/**
 * 

CloseableHelper

* @author Cyan ([email protected]) * @version v1.0.0 */ @Slf4j public class CloseableHelper { public static void close(Closeable... closeables) { if (GeneralUtils.isNotEmpty(closeables)) { for (Closeable closeable : closeables) { close(closeable); } } } public static void close(Closeable closeable) { if (GeneralUtils.isNotEmpty(closeable)) { try { closeable.close(); } catch (IOException ignored) { } } } public static void interrupt(Thread... threads) { if (GeneralUtils.isNotEmpty(threads)) { for (Thread thread : threads) { if (thread != null) { if (thread.isAlive()) { thread.interrupt(); } } } } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy