Java tutorial
//package com.java2s; //License from project: Open Source License import java.io.Closeable; import java.io.IOException; import java.net.Socket; public class Main { public static void closeQuietly(Closeable closeable) { if (closeable == null) return; try { closeable.close(); } catch (IOException e) { //just ignore } } public static void closeQuietly(Socket socket) { if (socket == null) return; try { socket.close(); } catch (IOException e) { //just ignore } } }