6 Replies Latest reply on Dec 22, 2010 5:21 AM by rossog

    BarrierController NOT working for me in Jboss 5.1.0

    yashendrac

      I have following configuration in jboss-service.xml for BarrierController

      <mbean code="login.AuthenticationService"
       name="smc.jboss:service=AuthenticationService">
       <depends>jboss:name=SmcBarrier,type=Barrier</depends>
       </mbean>
      



      <mbean code="org.jboss.system.BarrierController"
       name="jboss:service=BarrierController">
      
       <!--Whether to have the Barrier initially started or not-->
       <attribute name="BarrierEnabledOnStartup">false</attribute>
      
       <!--Whether to subscribe for notifications after startup-->
       <attribute name="DynamicSubscriptions">true</attribute>
      
       <!--Dependent services will depend on this mbean-->
       <attribute name="BarrierObjectName">jboss:name=SmcBarrier,type=Barrier</attribute>
      
       <!--The notification subscription handback that starts the barrier-->
       <attribute name="StartBarrierHandback">start</attribute>
      
       <!--The notification subscription handback that stops the barrier-->
       <attribute name="StopBarrierHandback">stop</attribute>
      
       <!--The notifications to subscribe for, along with their handbacks-->
       <attribute name="SubscriptionList">
       <subscription-list>
       <mbean name="jboss.system:type=Server" handback="start">
       <filter factory="NotificationFilterSupportFactory">
       <enable type="org.jboss.system.server.started"/>
       </filter>
       </mbean>
       <mbean name="jboss.system:type=Server" handback="stop">
       <filter factory="NotificationFilterSupportFactory">
       <enable type="org.jboss.system.server.stopped"/>
       </filter>
       </mbean>
       </subscription-list>
       </attribute>
       </mbean>
      


      But it is not working, I do not get any error at start up apart from following deployment messages:

      DEPLOYMENTS MISSING DEPENDENCIES:
       Deployment "smc.jboss:service=AuthenticationService" is missing the following dependencies:
       Dependency "jboss:name=SmcBarrier,type=Barrier" (should be in state "Start", but is actually in state "Create")
      
      DEPLOYMENTS IN ERROR:
       Deployment "jboss:name=SmcBarrier,type=Barrier" is in error due to the following reason(s): Create
      


      Any suggestion would be highly appreciated.

        • 1. Re: BarrierController NOT working for me in Jboss 5.1.0
          jaikiran

          I haven't used the BarrierController, so i don't know how its expected to work. But this comment probably gives a hint:

          <!--Whether to have the Barrier initially started or not-->
           <attribute name="BarrierEnabledOnStartup">false</attribute>
          


          Try changing the value to true:
          
           <!--Whether to have the Barrier initially started or not-->
           <attribute name="BarrierEnabledOnStartup">true</attribute>



          • 2. Re: BarrierController NOT working for me in Jboss 5.1.0
            brian.stansberry

            I just tested and confirmed that at the end of startup the "org.jboss.system.server.started" is emitted from source "jboss.system:type=Server" so the problem isn't that the notification isn't emitted.

            • 3. Re: BarrierController NOT working for me in Jboss 5.1.0
              yashendrac

              Hi

              That deployment error is gone by making changes suggested by jaikiran.

              Try changing the value to true:
              Code:
              
              
               <!--Whether to have the Barrier initially started or not-->
               <attribute name="BarrierEnabledOnStartup">true</attribute>



              So I guess because of BarrierEnabledOnStartup=false when service AuthenticationService started Barrier was on create state NOT on start state which caused the deployment error. And after setting BarrierEnabledOnStartup=true Barrier was already on start state before start of AuthenticationService.

              <mbean code="login.AuthenticationService"
               name="smc.jboss:service=AuthenticationService">
               <depends>jboss:name=SmcBarrier,type=Barrier</depends>
               </mbean>
              


              • 4. Re: BarrierController NOT working for me in Jboss 5.1.0
                yashendrac

                Thank you very much for your help.

                But I wonder whats the significance of attribute BarrierEnabledOnStartup if I always need to set it to true. It was set to false for same application earlier in jboss 4.2.1.

                • 5. Re: BarrierController NOT working for me in Jboss 5.1.0
                  dimitris

                  Well, the barrier controller controls the lifecycle (start/stop status) of a 2nd barrier mbean, that you use as a dependency for other services.

                  It will start/stop that 2nd mbean depending on the received notifications that it receives.

                  Now BarrierEnabledOnStartup defines what will be the initial state of the Barrier (started or stopped) when the BarrierController starts up itself, before it starts receiving notifications to control the barrier from that point on.

                  If your Barrier is not starting with BarrierEnabledOnStartup=false, that means the start-up notification is not received. This can happen if the notification is not emitted, or if the mbean that emits the notification is not there by the time the BarrierController is created. The later can be avoided if you enable dynamic subscriptions.

                  Hope that helps.

                  • 6. Re: BarrierController NOT working for me in Jboss 5.1.0
                    rossog

                    I still miss something. I've used a lot barrier on JBoss 4, and now  that we're migrating to 5.1.0GA, something doesn't work as expected.

                    This barrier works with logging monitor:

                     

                    {code:xml}
                    <mbean code="org.jboss.system.BarrierController"
                               name="jboss.web:service=BarrierController">
                            <attribute name="BarrierEnabledOnStartup">true</attribute>
                            <attribute name="DynamicSubscriptions">true</attribute>
                            <attribute name="BarrierObjectName">jboss.web:name=AJPConnector,type=Barrier</attribute>
                            <attribute name="StartBarrierHandback">start</attribute>
                            <attribute name="StopBarrierHandback">stop</attribute>
                            <attribute name="SubscriptionList">
                                <subscription-list>
                                    <mbean name="jboss.web:service=WebServer" handback="start">
                                        <filter factory="NotificationFilterSupportFactory">
                                            <enable type="jboss.tomcat.connectors.started"></enable>
                                        </filter>
                                    </mbean>
                                    <mbean name="jboss.system:type=Server" handback="stop">
                                        <filter factory="NotificationFilterSupportFactory">
                                            <enable type="org.jboss.system.server.stopped"></enable>
                                        </filter>
                                    </mbean>
                                </subscription-list>
                            </attribute>
                        </mbean>
                       
                        <mbean code="org.jboss.services.loggingmonitor.LoggingMonitor"
                               name="jboss.monitor:type=LoggingMonitor,name=WebMetricsMonitor">
                            <attribute name="Filename">${jboss.server.log.dir}/web-metrics.log</attribute>
                            <attribute name="AppendToFile">true</attribute>
                             <attribute name="PatternLayout">%d %-5p [%c]  (maxThreads,acceptorThreadCount,currentThreadsBusy,currentThreadCount)  %m%n</attribute>
                            <attribute name="RolloverPeriod">DAY</attribute>
                            <attribute name="MonitorPeriod">5000</attribute>
                            <attribute name="MonitoredObjects">
                                <configuration>
                                    <monitoredmbean name="jboss.web:name=ajp-127.0.0.1-8009,type=ThreadPool"
                                                    logger="web.metrics">
                                        <attribute>maxThreads</attribute>
                                        <attribute>acceptorThreadCount</attribute>
                                        <attribute>currentThreadsBusy</attribute>
                                        <attribute>currentThreadCount</attribute>
                                    </monitoredmbean>
                                </configuration>
                           </attribute>
                          <depends>jboss.web:name=AJPConnector,type=Barrier</depends>
                        </mbean>
                    {code}

                     

                    The problem is that the second bean,  LoggingMonitor, doesn't wait for notification, and starts trying to log  as soon as it gets deployed:

                    11:10:20,491 WARN  [LoggingMonitor] Unable to log attributes for mbean: jboss.web:name=ajp-192.168.38.101-8009,type=ThreadPool
                    javax.management.InstanceNotFoundException: jboss.web:name=ajp-127.0.0.1-8009,type=ThreadPool is not registered.
                            at org.jboss.mx.server.registry.BasicMBeanRegistry.get(BasicMBeanRegistry.java:526)
                            at org.jboss.mx.server.MBeanServerImpl.getAttribute(MBeanServerImpl.java:559)
                            at org.jboss.services.loggingmonitor.MonitoredMBean.logAttributes(MonitoredMBean.java:116)
                            at org.jboss.services.loggingmonitor.LoggingMonitorTimerTask.run(LoggingMonitorTimerTask.java:69)
                            at java.util.TimerThread.mainLoop(Timer.java:512)
                            at java.util.TimerThread.run(Timer.java:462)

                     

                    The same configuration (with BarrierEnabledOnStartup=false) works perfectly on 4.2.3GA.

                    Am I missing something?

                    Thanks