How to Find an Instance Name or Machine Name in a CFMX Cluster
Occasionally, when dealing with a CFMX cluster you are unsure of which instance or even what machine is really executing the code you are running. In these cases, the following codebit can be a lifesaver to discover where your code's really running.
<cfscript>
machineName = createObject("java", "java.net.InetAddress").localhost.getHostName();
// get this instance name
instanceName = createObject("java", "jrunx.kernel.JRun").getServerName();
</cfscript>
<cfoutput>
Machine: #machineName#<br>
Instance: #instanceName#
</cfoutput>
Hat tip to Pete Keleher for the instance code.
machineName = createObject("java", "java.net.InetAddress").localhost.getHostName();
// get this instance name
instanceName = createObject("java", "jrunx.kernel.JRun").getServerName();
</cfscript>
<cfoutput>
Machine: #machineName#<br>
Instance: #instanceName#
</cfoutput>
