public static boolean closeServerSocket ( ServerSocket serverSocket ) { boolean closed = true ; try { if ( serverSocket != null && ! serverSocket . isClosed ( ) ) { serverSocket . close ( ) ; serverSocket = null ; } } catch ( final IOException e ) { LOGGER . error ( "IOException occured by trying to close the server socket." , e ) ; closed = false ; } finally { try { if ( serverSocket != null && ! serverSocket . isClosed ( ) ) { serverSocket . close ( ) ; } } catch ( final IOException e ) { LOGGER . error ( "IOException occured by trying to close the server socket." , e ) ; closed = false ; } } return closed ; }
Closes the given ServerSocket .