Most of us know by now that there are many compelling reasons to run ColdFusion on J2EE in a clustered environment. One of the reasons for this is the ability of requests and sessions to failover to another server when one server goes offline. In testing failover and such, you need to periodically turn off servers in the cluster while performing tests. Sometimes you need to turn off all servers in a cluster except one in order to troubleshoot problems. The following code snippet is very handy in determining which server in the cluster is handling the current request, which is something you're sure to want to know:
<cfscript>
jrunObj = createObject("java", "jrunx.kernel.JRun");
thisServer = variables.jrunObj.getServerName();
</cfscript>
You're on <cfoutput>#variables.thisServer#</cfoutput>
writeoutput("You are currently on " & createObject("java", "jrunx.kernel.JRun").getServerName());
How can someone do this if they are running WebLogic as their J2EE server?
Thanks
Mario