Sounds like a work flow or task distribution use case.
Assuming you are running with GlassFish v2.1, one way to achieve this
could be by using Shoal's clustering APIs. Shoal is part of GF v2.1
(more stable in this release and has many bug fixes), and exposes APIs
to query who the core cluster members are and also provides a
notification model on cluster member lifecycle events, so should be
useful for your purposes.
https://shoal.dev.java.net
hth
Shreedhar
glassfish_at_javadesktop.org wrote:
> How do I access infomation about what cluster instance is running the ejb code?
>
> I have code inside an ejb and I want the execution to be tailored depening on what cluster instance is running the code. I also need to know the total number of cluster instances.
>
> My use case is something like the following:
> I have a pile of work to be done by an ejb which is deployed to several cluster instances. I want to divide the work between the instances, e.g. the first 20% of work to the first instance and the following 20% to the second instance and so on. This means that I need to know the total number of instances in the cluster and also the index of the instance running the code, i.e. dynamically retrieving the information from within the code.
>
> Is this possible? How do I do it?
> [Message sent by forum member 'nilsedvardsson' (nilsedvardsson)]
>
> http://forums.java.net/jive/thread.jspa?messageID=333237
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>