HHH-8211 - Checkstyle and FindBugs fix-ups
This commit is contained in:
parent
f841c2ab3b
commit
6fe63e035c
|
@ -56,20 +56,15 @@ public class EhcacheHibernateMBeanRegistrationImpl
|
|||
EhcacheHibernateMBeanRegistrationImpl.class.getName()
|
||||
);
|
||||
private static final int MAX_MBEAN_REGISTRATION_RETRIES = 50;
|
||||
private String cacheManagerClusterUUID;
|
||||
private String registeredCacheManagerName;
|
||||
private Status status = Status.STATUS_UNINITIALISED;
|
||||
private volatile EhcacheHibernate ehcacheHibernate;
|
||||
private volatile ObjectName cacheManagerObjectName;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public synchronized void registerMBeanForCacheManager(final CacheManager manager, final Properties properties)
|
||||
throws Exception {
|
||||
final String sessionFactoryName = properties.getProperty( Environment.SESSION_FACTORY_NAME );
|
||||
String name = null;
|
||||
final String name;
|
||||
if ( sessionFactoryName == null ) {
|
||||
name = manager.getName();
|
||||
}
|
||||
|
@ -82,11 +77,12 @@ public class EhcacheHibernateMBeanRegistrationImpl
|
|||
private void registerBean(String name, CacheManager manager) throws Exception {
|
||||
ehcacheHibernate = new EhcacheHibernate( manager );
|
||||
int tries = 0;
|
||||
boolean success = false;
|
||||
boolean success;
|
||||
Exception exception = null;
|
||||
cacheManagerClusterUUID = manager.getClusterUUID();
|
||||
final String cacheManagerClusterUUID = manager.getClusterUUID();
|
||||
String registeredCacheManagerName;
|
||||
do {
|
||||
this.registeredCacheManagerName = name;
|
||||
registeredCacheManagerName = name;
|
||||
if ( tries != 0 ) {
|
||||
registeredCacheManagerName += "_" + tries;
|
||||
}
|
||||
|
@ -121,9 +117,6 @@ public class EhcacheHibernateMBeanRegistrationImpl
|
|||
return ManagementFactory.getPlatformMBeanServer();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void enableHibernateStatisticsSupport(SessionFactory sessionFactory) {
|
||||
ehcacheHibernate.enableHibernateStatistics( sessionFactory );
|
||||
|
|
|
@ -69,11 +69,10 @@ public abstract class EhcacheHibernateMbeanNames {
|
|||
*/
|
||||
public static ObjectName getCacheManagerObjectName(String cacheManagerClusterUUID, String name)
|
||||
throws MalformedObjectNameException {
|
||||
final ObjectName objectName = new ObjectName(
|
||||
GROUP_ID + ":type=" + EHCACHE_HIBERNATE_TYPE + ",name=" + mbeanSafe( name )
|
||||
+ getBeanNameSuffix( cacheManagerClusterUUID )
|
||||
return new ObjectName(
|
||||
GROUP_ID + ":type=" + EHCACHE_HIBERNATE_TYPE
|
||||
+ ",name=" + mbeanSafe( name ) + getBeanNameSuffix( cacheManagerClusterUUID )
|
||||
);
|
||||
return objectName;
|
||||
}
|
||||
|
||||
private static String getBeanNameSuffix(String cacheManagerClusterUUID) {
|
||||
|
|
|
@ -130,7 +130,6 @@ public class ProviderMBeanRegistrationHelper {
|
|||
);
|
||||
this.cancel();
|
||||
}
|
||||
return;
|
||||
}
|
||||
else {
|
||||
ehcacheHibernateMBeanRegistration.enableHibernateStatisticsSupport( sessionFactory );
|
||||
|
@ -152,9 +151,8 @@ public class ProviderMBeanRegistrationHelper {
|
|||
if ( map == null ) {
|
||||
return null;
|
||||
}
|
||||
final Iterator values = map.values().iterator();
|
||||
while ( values.hasNext() ) {
|
||||
final SessionFactory sessionFactory = (SessionFactory) values.next();
|
||||
for ( Object o : map.values() ) {
|
||||
final SessionFactory sessionFactory = (SessionFactory) o;
|
||||
final Class sessionFactoryType = sessionFactory.getClass();
|
||||
final Field propertiesField = getField( sessionFactoryType, "properties" );
|
||||
if ( propertiesField != null ) {
|
||||
|
|
|
@ -324,8 +324,8 @@ public class QueryStats implements Serializable {
|
|||
*/
|
||||
public static QueryStats[] fromTabularData(final TabularData tabularData) {
|
||||
final List<QueryStats> countList = new ArrayList( tabularData.size() );
|
||||
for ( final Iterator pos = tabularData.values().iterator(); pos.hasNext(); ) {
|
||||
countList.add( new QueryStats( (CompositeData) pos.next() ) );
|
||||
for ( Object o : tabularData.values() ) {
|
||||
countList.add( new QueryStats( (CompositeData) o ) );
|
||||
}
|
||||
return countList.toArray( new QueryStats[countList.size()] );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue