I've been looking at better ways to do HASingleton deployments vs the current (broken)
scanner-based approach (
http://jira.jboss.com/jira/browse/JBAS-5563).
I've long thought that a better way to do this would be by adding a deployer that adds
a dependency on "barrier" bean to deployments that have appropriate metadata.
Similar to the JMX-based jboss.ha:service=HASingletonDeployer,type=BarrierController
concept, but with an MC bean.
An example set of deployers would be:
| <!-- For deployments that have HASingletonMetaData attached,
| establishes a dependency on a barrier bean that is only
| satisfied when this node becomes the singleton master
| -->
| <bean name="HASingletonBarrierDependencyDeployer"
|
class="org.jboss.ha.singleton.deployer.HASingletonBarrierDependencyDeployer">
|
| <property name="dependencyNamesByPartition">
| <map keyClass="java.lang.String"
valueClass="java.lang.String">
| <entry>
| <key>${jboss.partition.name:DefaultPartition}</key>
| <value>HASingletonBarrier</value>
| </entry>
| <!-- Add more entries if you deploy more HAPartitions -->
| </map>
| </property>
|
| </bean>
|
| <!--
| Adds HASingletonMetaData to deployments that come from the specified
| URLs. Provides support for the legacy deploy-hasingleton directory
| concept.
| -->
| <bean name="HASingletonMetadataDeployer"
|
class="org.jboss.ha.singleton.deployer.VFSHASingletonMetadataDeployer">
|
| <property
name="partitionName">${jboss.partition.name:DefaultPartition}</property>
|
| <property name="URIList">
| <list elementClass="java.net.URI">
| <!-- Standard HASingleton deployment directory -->
| <value>${jboss.server.home.url}deploy-hasingleton/</value>
| </list>
| </property>
| </bean>
In deploy we'd have these beans:
| <!-- Bean on which HASingletons will depend. ControllerMode is MANUAL,
| so will not deploy until HASingletonBarrierInstaller installs it.
| -->
| <bean name="HASingletonBarrier" class="java.lang.Object"
mode="MANUAL"/>
|
| <!-- Tracks cluster topology and tells the MainDeployer to bring the
| HASingletonBarrier to INSTALLED when it becomes singleton master, and
| to bring it to NOT_INSTALLED when it is no longer the master.
| -->
| <bean name="HASingletonBarrierInstaller"
|
class="org.jboss.ha.singleton.deployer.HASingletonBarrierInstaller">
|
| <property
name="barrierBeanName">HASingletonBarrier</property>
| <property name="mainDeployer"><inject
bean="MainDeployer"/></property>
| <property name="HAPartition"><inject
bean="HAPartition"/></property>
|
| </bean>
That's the concept at least. One issue I see is on the non-singleton-master nodes the
MainDeployer.checkComplete() impl is going to report an unsatisfied dependency, which will
get logged at ERROR. Not good.
Any comments on this basic approach to controlling deployments? If it seems reasonable,
can we add a mechanism (perhaps a flag in DependencyItem) such that certain unresolved
dependencies are not logged as an error?
(Note it's possible this will just work w/o the logging. I'm working through other
issues and haven't gotten it to work right yet. But looking at the code it seems clear
there will be ERROR logging.)
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4154445#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...