Who are you?

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>

Comments
Shorthand...for those who like such things.

writeoutput("You are currently on " & createObject("java", "jrunx.kernel.JRun").getServerName());

# Posted By Bjorn | 11/28/04 3:06 PM
Simon,

How can someone do this if they are running WebLogic as their J2EE server?

Thanks
Mario
# Posted By Mario | 1/25/05 1:35 PM
No - that won't work on weebsphere - it uses the JRun API. I will post some code that I "think" will work on web sphere in 5 minutes. Unfortunately, I don't have a websphere server running in my new office.
# Posted By Simon Horwith | 1/25/05 2:04 PM
I've posted what I believe is a solution for websphere at http://www.horwith.com/index.cfm?mode=entry&en...
# Posted By Simon Horwith | 1/25/05 2:10 PM
This site is hosted by HostMySite and runs off of BlogCFC - thanks, Ray.