Good news. I was able to test this scenario on WebSphere today. It looks like the only
thing we need to do in JBossCache is catch the registration error.
From what I can see, WebSphere is doing the callback so
cache.getServiceName() does return the actual registration name after the initial
registration. This means that subsequent attempts to register the same instance will be
detected. It also looks like deregistration of the cache mbean and interceptor mbeans
works properly now (I need to verify again).
So the typical failure mode is as follows -
Someone in a standalone environment starts a cache instance using the default name (e.g.,
TreeCache-Group). On WebSphere, the instance is registered with a name like
jboss.cache:service=TreeCache-Group, server=websphere....
If the same instance tries to register again, we use the actual registration name and
detect that this is an attempt to register again.
If another instance (e.g., another standalone cache application) is then started and uses
the default name, the code to detect a current registration won't detect that the name
is already in use because it will use the default name (i.e., because serviceName is null
at this point). The registration attempt will proceed and fail with the
InstanceAlreadyExists exception because the actual name is already in use. So the fix is
to simply catch the exception and report it as a warning.
Note that this doesn't change the JMX availability of the cache's mbean. The
mbean is registered to the first client to use the name.
Unless I find anything further while looking at deregistration, I'll just fix this by
handling the exception.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4038986#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...