users@glassfish.java.net

Re: Clustering questions

From: Tom Mueller <tom.mueller_at_oracle.com>
Date: Wed, 23 Nov 2011 09:13:42 -0600

> a) Is there a way/jmx call/api to determine if we are runniong in a
> standalone mode or in a cluster?
There are mbeans that model the configuration of the server. Connect to
the server using jconsole to see what they are. In recent builds, you'll
have to invoke the "BootAMX" operation to activate the mbeans. Then
look under "server" and you'll see the attributes. The name of the DAS
is "server". There is also a "cluster" mbean that has information about
the clusters. There is an operation on the cluster that lists the
servers that are in the cluster.

If you connect to the mbean server on an instance, the data you see will
be for that instance, i.e., if you go to the "J2EEServer/J2EEDomain"
mbean, the object there represents just that instance, so you can get
the name of the instance you are running in.

If you are running as an OSGi module that is extending GlassFish rather
than as a web application, you can access the config beans that underly
these mbeans directly.

Note that these are non-standard interfaces that are subject to change
in future releases.
>
> b) Is there a notification system where one can send notifications
> from one
> server to other members of the cluster?
There are two mechanisms related to this.

1. From an instance it is possible to use Shoal/GMS to communicate
within a cluster.
2. On the DAS, there is a command replication mechanism that will
replicate commands to a cluster. There is an API for defining your own
commands that can extend GlassFish - see:
http://docs.oracle.com/cd/E18930_01/html/821-2415/ghmrd.html#scrolltoc

Tom