I like the approaches that have been proposed here. I hadn't
considered looking into the distributed garbage collector but it
definitely identifies unique JVMs.
In most of my work, I've only needed to identify which host and
whether a problem was always exhibited on the same JVM. For this
purpose, you can modify Ed's solution with something that is perhaps
a bit easier by using random UUIDs. Just print the hostname and ask
a singleton for its UUID that you generate every time the JVM
starts. For more info, see
http://java.sun.com/javase/6/docs/api/java/util/UUID.html#randomUUID()
On Aug 19, 2007, at 8:25 AM, Edward Sumerfield wrote:
You could use the hostname of the current machine and the directory
that the jars are loaded from.
This means you don't need to pass anything in to the jvm, Matt's
system property solution would work fine but adds an admin overhead of
editing every app server installation with extra jvm configuration
parameters.
The problem is the second jvm on the same machine, the hostname is an
easyone. I don't believe that there is anyway to get the port that
your process is listening on without getting into jni.
Depending on your app server it will be deloying your jars into some
relatively well known directory structure. So jboss goes to
server/[confname]/work ... or something like that. You should be able
to do
Url myJar = this.getClass().getClassLoader().getResource();
Then you can parse the "confname" from the url and you have a name for
the deployment and with the hostname you should have enough for you
log messages to indicate where things are happening.
On 8/17/07, ENapier@xxxxxxxxxxxxxxxx <ENapier@xxxxxxxxxxxxxxxx> wrote:
Hi all,
We've got a clustered environment of two physical machines, each
with two
JVMs. Mirroring and magic dust yields a total of four identical
JVMs and
application trees. Same URL, different ports, but that's hidden
under the
covers.
Occasionally we (the developers) find ourselves wanting to know
which JVM is
providing a particular instance of an app. Does anybody know of
any way we
can retrieve an ID, port designation, etc to let us know this
information?
Thanx,
Ed Napier
Senior IT Specialist
Shared Services - Web
UNIFI Information Technology
513-595-2451
--
Ed
---------
You may unsubscribe from this mailing list
by sending a blank email addressed to:
users-unsubscribe@xxxxxxxxxx
--
Find additional help by sending a blank email
addressed to:
users-help@xxxxxxxxxx
|