Skip to Content
0
Former Member
Jun 03, 2008 at 12:34 AM

Getting host name in clustered environment

173 Views

Hi,

in my J2EE Web application, I'd like to get the hostname of the Portal server where my J2EE app is deployed. But this is a clustered pipeline system where many servers exist in our QA system.

So if I were to try:

java.net.InetAddress addr = java.net.InetAddress.getLocalHost();

String hostname = addr.getCanonicalHostName();

I am not sure what the call to getCanonicalHostName would return to me?

Does it always give me the domain name of the central instance? e.g. s1.abc.mycompany.com

Or can it give me the domain name of any of the instances?

Has anyone tried this before?

Alternatively within my program is there anyway to determine which pipeline system I am on - dev, QA or production?

Appreciate your response.

Sharath