JBAS-4180 - HA <-> JMX coupling
galder.zamarreno Oct 2, 2007 4:36 PMRe: http://jira.jboss.com/jira/browse/JBAS-4180
------
The first thing I've done is evaluate our current usage of JMX, more specifically subclasses of ServiceMBeanSupport, in clustering related code. Here's the list:
- BarrierController
- Barrier (inner class of above)
- HAServiceMBeanSupport
- HASingletonSupport (extends above)
- HASingletonController (extends above)
- HASingletonElectionPolicyBase
- HASingletonElectionPolicySimple (extends above)
- FarmMemberService
- ClusterPartition
- UnifiedInvoker
- UnifiedInvokerHA (extends above)
- DetachedHANamingService
- HANamingService (extends above)
- HASessionStateService
- ListenerServiceMBeanSupport
- BarrierController (extends above)
- PingJndi
------
And below is my analisys of these classes:
+ Barrier, BarrierController, HASingletonController, HASingletonSupport and HAServiceMBeanSupport
HASingletonController extends HASingletonSupport which sends notifications related to node becoming coordinator, or node stopping being coordinator. BarrierControler is the listener of these notifications, who's job is to start/stop of dependant services. Barrier is wrapper around the dependant service, which is started/stopped upon BarrierController's command via lifecycle methods.
1. BarrierController listens for JMX notifications, so should probably remain the same. Does not seem to make much sense to have JMX pulled out because it's its core business.
2. Whether Barrier should be JMX aware is debatable. Extends ServiceMBeanSupport directly and does little more. It's a mere delegator.
3. HASingletonController does nothing JMX related, except publicise (via getters) the configuration options for target start/stop methods. Needs JMX factoring out IMO.
4. HASingletonSupport knows when a node is coordinator or not, and via its parent, sends JMX notifications (only local notifications). HAServiceMBeanSupport can send JMX notifications locally or broadcast them accross the cluster. Both rely heavily on JMX functionality, so could stay the same.
5.- JBAS-3982 could be resolved with the JMX factored version of HAServiceMBeanSupport.
+ HASingletonElectionPolicyBase and HASingletonElectionPolicySimple
This is new functionality to decide where to run HA singleton services instead of the coordinator. It makes sense to factor JMX out of these classes to separate functionality from any JMX managed methods. An election policy should be independent, like the load balance policies.
+ FarmMemberService
This class extends URLDeploymentScanner, but has no meaningful JMX methods, FarmMemberServiceMBean. Does not seem to require a JMX aspect to it. I guess in the future it could send notifications when a deployment was successfully deployed in all nodes, once farm deployments are atomic, but this has not been implemented yet.
+ ClusterPartition
Does not make sense to have a non JMX version.
+ UnifiedInvoker and UnifiedInvokerHA
I'm not going to discuss legacy invokers here because they should remain as they are for backwards compatibility. To discuss JMX factoring out, let's focus on the unified invokers.
To factor out JMX from invokers makes sense to help unit testing and potentially make path for them to be migrated to Remoting (there's a JIRA on this) and be used standalone. It would also make my life a lot easier unit testing JBAS-4455 :)
+ DetachedHANamingService and HANamingService
DetachedHANamingService uses JMX (via Query) to find an HAPartition with a given name via findHAPartitionWithName method. Couldn't find any references to this method and it's not a managed method either. Javadoc for DetachedHANamingService states: "Management Bean for the protocol independent HA-JNDI service. This allows the naming service transport layer to be provided by a detached invoker service like JRMPInvokerHA + ProxyFactoryHA.".
HANamingService's javadoc says: "Management Bean for HA-JNDI service for the legacy version that is coupled to the RMI/JRMP protocol. The DetachedHANamingService should be used with the appropriate detached invoker service."
I'm not sure about the meaning of the javadocs for these two services. The invokers they refer to are legacy, so maybe legacy these are legacy classes and we shouldn't touch them? Does HA JNDI without JMX makes sense? If you're using JNDI to start with, chances are you're in a managed environment.
In fact, any legacy/deprecated classes should be marked as such for newcomers to be aware of :)
+ HASessionStateService
This looks like legacy code, so no need to touch it?
+ PingJndi
Once again, legacy code?
-----
Thoughts? Comments? Bored? :)