Announcement Announcement Module
No announcement yet.
Configuring MBeans to Expose LDAP Connection Pooling Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Configuring MBeans to Expose LDAP Connection Pooling

    I have a requirement to configure MBeans to expose LDAP Connection Pooling. I have created a custom MBean and added LDAP Pooling. My configuration looks as follows

    <bean id="contextSourceTarget" class=" ontextSource">
    <property name="url" value="myURL" />
    <property name="userDn" value="myUserDN"/>
    <property name="password" value="myPassword" />
    <property name="pooled" value="false"/>

    Then I added a pooling context source bean

    <bean id="contextSourcePooled" class="org.springframework.ldap.pool.factory.Pooli ngContextSource">
    <property name="contextSource" ref="contextSourceTarget" />
    <property name="dirContextValidator" ref="dirContextValidator" />
    <property name="testOnBorrow" value="true" />
    <property name="testOnReturn" value="false" />
    <property name="testWhileIdle" value="true" />
    <property name="timeBetweenEvictionRunsMillis" value="-1" />
    <property name="minEvictableIdleTimeMillis" value="1800000" />
    <property name="maxWait" value="-1" />
    <property name="maxTotal" value="-1" />
    <property name="whenExhaustedAction" value="1" />
    <property name="maxActive" value="8" />
    <property name="maxIdle" value="8" />
    <property name="minIdle" value="0" />
    <property name="numTestsPerEvictionRun" value="3" />

    <bean id="dirContextValidator" class="org.springframework.ldap.pool.validation.De faultDirContextValidator" />

    <bean id="ldapTemplate" class="org.springframework.ldap.core.LdapTemplate" >
    <constructor-arg ref="contextSourceTarget" />

    My MBean configuration looks

    <bean id="mbeanExporter" class="org.springframework.jmx.export.MBeanExporte r" lazy-init="false">
    <property name="registrationBehaviorName" value="REGISTRATION_REPLACE_EXISTING" />
    <property name="assembler" ref="assembler"/>
    <property name="namingStrategy" ref="namingStrategy"/>
    <property name="autodetect" value="true"/>
    <property name="server" ref="mbeanServerFactory" />
    <property name="beans">
    <entry key="org.springframework.ldap:name=ldapPoolStatist icsbean" value-ref="ldapJMXMBean" />

    <bean id="mbeanServerFactory" class=" FactoryBean">
    <property name="locateExistingServerIfPossible" value="true" />

    <bean id="jmxAttributeSource" class="org.springframework.jmx.export.annotation.A nnotationJmxAttributeSource"/>

    <bean id="assembler" class="org.springframework.jmx.export.assembler.Me tadataMBeanInfoAssembler">
    <property name="attributeSource" ref="jmxAttributeSource"/>

    <bean id="namingStrategy" class="org.springframework.jmx.export.naming.Metad ataNamingStrategy">
    <property name="attributeSource" ref="jmxAttributeSource"/>

    <bean id="ldapJMXMBean" class="com.ldap.jmx.LdapJMXMBean">
    <property name="contextSource" ref="contextSourcePooled" />

    I could see the MBeans in Jconsole. But the values are not changing at runtime. The Mbeans are loaded with the default values which I set for the beans. Could anyone suggest me a way to resolve this

    Seems like if we call any method on the org.springframework.ldap.pool.factory.PoolingConte xtSource object(contextSource) - ie contextSource.getNumActive() will always returns the default values. But whenever we click on Jconsole the corresponding Custom MBean's method gets invoked; but always returns 0. Any suggestions

    Attached Files
    Last edited by manideepu; Jul 18th, 2012, 04:45 AM.