private static String getHostname() {
        if (Hostname == null) {
            try {
                Hostname = InetAddress.getLocalHost().getHostName();
            } catch (Exception e) {
                Hostname = "default";
                LOGGER.warn("Can not get current hostname", e);
            }
        }
        return Hostname;
    }
private static String getHostname ( ) { if ( Hostname == null ) { try { Hostname = InetAddress . getLocalHost ( ) . getHostName ( ) ; } catch ( Exception e ) { Hostname = "default" ; LOGGER . warn ( "Can not get current hostname" , e ) ; } } return Hostname ; }
Save current hostname and reuse it.

@return hostname as String