Hi,
Just posting this if someone wants some fun with jmx:
Put the following code in TestCase.setSessions:
List servers=MBeanServerFactory.findMBeanServer(null);
List servers=MBeanServerFactory.findMBeanServer(null);
if(servers != null && servers.size() != 0) {
try {
MBeanServer server = (MBeanServer) servers.get(
0 );
SessionFactory sessionFactory = sessions;
ObjectName on = null;
on = new ObjectName(
"Hibernate:type=statistics,application="
+ this.getClass().getName() );
StatisticsService mBean = new
StatisticsService();
mBean.setStatisticsEnabled( true );
mBean.setSessionFactory( sessionFactory );
server.registerMBean( mBean, on );
}
catch (Exception e) {
// buh
}
}
Remember to enable stats in hibernate.properties or on the configuration
by doing
cfg.setProperty(Environment.GENERATE_STATISTICS, "true");
And put -Dcom.sun.management.jmxremote as a VM argument and you now get
starts
for every testcase run.
It's simple and probably mostly a toy...but hey it looks cool in JConsole
,)
-max
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
hibernate-devel mailing list
hibernate-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hibernate-devel