Optimize calls to InetAddress.getLocalHost().getHostName() as suggested by dpocock