-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Using StatisticsService statically
PostPosted: Wed Feb 18, 2009 7:44 pm 
Newbie

Joined: Wed Feb 18, 2009 7:29 pm
Posts: 1
Hibernate version: 3.2

In every example I've found, the StatisticsService is being used dynamically by a running system. I'm trying to add it to my jboss-service.xml, with
Code:
    <mbean code="org.hibernate.jmx.StatisticsService" name="hibernate:name=StatisticsService">
        <attribute name="SessionFactoryJNDIName">java:/dvsSessionFactory</attribute>
   </mbean>


The problem is, the session factory doesn't exist when the jboss-service.xml file is parsed, and the attribute is set (i.e. the setSessionFactoryJNDIName() method is called).

In that method, the code looks like this:
Code:
   public void setSessionFactoryJNDIName(String sfJNDIName) {
      this.sfJNDIName = sfJNDIName;
      try {
         Object obj = new InitialContext().lookup(sfJNDIName);
         .
         .
         .

IMO, the lookup should not be done when the setter is called, because the MBean hasn't started yet. The value should only be stored for later use. When the MBean gets started, that's when the lookup should happen.

Am I wrong?

BTW, I can add this as an MBean without the attribute being set, and set the value in the JMX Console, but I have to put in the SessionFactory name.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.