[jboss-cvs] JBossAS SVN: r94995 - in projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss: web/tomcat/service/session/distributedcache/impl and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Oct 15 22:17:17 EDT 2009
Author: bstansberry at jboss.com
Date: 2009-10-15 22:17:16 -0400 (Thu, 15 Oct 2009)
New Revision: 94995
Modified:
projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/cachemanager/CacheManager.java
projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/DistributedCacheManagerFactoryImpl.java
projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/sso/jbc/JBossCacheSSOClusterManager.java
Log:
Fix FindBugs issues
Modified: projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/cachemanager/CacheManager.java
===================================================================
--- projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/cachemanager/CacheManager.java 2009-10-16 02:16:52 UTC (rev 94994)
+++ projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/cachemanager/CacheManager.java 2009-10-16 02:17:16 UTC (rev 94995)
@@ -69,7 +69,7 @@
*/
public class CacheManager
extends org.jboss.cache.CacheManagerImpl
- implements org.jboss.cache.CacheManager, PojoCacheManager, MBeanRegistration, CacheManagerMBean
+ implements PojoCacheManager, MBeanRegistration, CacheManagerMBean
{
private static final Logger log = Logger.getLogger(CacheManager.class);
@@ -557,8 +557,8 @@
{
Integer count = pojoCacheCheckouts.get(configName);
if (count == null)
- count = new Integer(0);
- Integer newVal = new Integer(count.intValue() + 1);
+ count = Integer.valueOf(0);
+ Integer newVal = Integer.valueOf(count.intValue() + 1);
pojoCacheCheckouts.put(configName, newVal);
return newVal.intValue();
}
@@ -572,7 +572,7 @@
if (count == null || count.intValue() < 1)
throw new IllegalStateException("invalid count of " + count + " for " + configName);
- Integer newVal = new Integer(count.intValue() - 1);
+ Integer newVal = Integer.valueOf(count.intValue() - 1);
pojoCacheCheckouts.put(configName, newVal);
return newVal.intValue();
}
Modified: projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/DistributedCacheManagerFactoryImpl.java
===================================================================
--- projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/DistributedCacheManagerFactoryImpl.java 2009-10-16 02:16:52 UTC (rev 94994)
+++ projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/DistributedCacheManagerFactoryImpl.java 2009-10-16 02:17:16 UTC (rev 94995)
@@ -68,7 +68,6 @@
org.jboss.cache.transaction.BatchModeTransactionManagerLookup.class.getName();
private TomcatClusterConfig tomcatConfig;
- private MBeanServer mserver;
private boolean pojoCacheLocal = false;
private PojoCache pojoCache;
@@ -117,9 +116,9 @@
pojoCache.stop();
pojoCache.destroy();
- if (pojoCacheLocal && mserver != null && tomcatConfig.getCacheObjectName() != null)
+ if (pojoCacheLocal && tomcatConfig.getMBeanServer() != null && tomcatConfig.getCacheObjectName() != null)
{
- mserver.unregisterMBean(new ObjectName(tomcatConfig.getCacheObjectName()));
+ tomcatConfig.getMBeanServer().unregisterMBean(new ObjectName(tomcatConfig.getCacheObjectName()));
}
}
}
@@ -192,14 +191,13 @@
if (configFile != null)
{
pcWrapper = new PojoCacheJmxWrapper(PojoCacheFactory.createCache(configFile.getAbsolutePath(), false));
- Configuration config = pojoCache.getCache().getConfiguration();
if (clusterName != null)
{
// Override the XML config with the name provided in
// server.xml. Method setClusterName is specified in the
// Cluster interface, otherwise we would not do this
- config.setClusterName(clusterName);
+ pcWrapper.getPojoCache().getCache().getConfiguration().setClusterName(clusterName);
}
}
else
Modified: projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/sso/jbc/JBossCacheSSOClusterManager.java
===================================================================
--- projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/sso/jbc/JBossCacheSSOClusterManager.java 2009-10-16 02:16:52 UTC (rev 94994)
+++ projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/web/tomcat/service/sso/jbc/JBossCacheSSOClusterManager.java 2009-10-16 02:17:16 UTC (rev 94995)
@@ -28,6 +28,7 @@
import java.util.Map;
import java.util.Set;
+import javax.management.JMException;
import javax.management.MBeanAttributeInfo;
import javax.management.MBeanInfo;
import javax.management.MBeanServer;
@@ -654,8 +655,7 @@
*/
private void launchSSOCleaner(boolean notifyIfEmpty)
{
- SSOCleanerTask cleaner = new SSOCleanerTask();
- cleaner.setCheckForEmpty(notifyIfEmpty);
+ SSOCleanerTask cleaner = new SSOCleanerTask(notifyIfEmpty);
if (threadPool != null)
{
threadPool.run(cleaner);
@@ -1009,13 +1009,9 @@
*/
// Find out our address
- Object address = cache.getLocalAddress();
- // In reality this is a JGroups IpAddress, but the API says
- // "Object" so we have to be sure its Serializable
- if (address instanceof Serializable)
- localAddress = (Serializable) address;
- else if (address != null)
- localAddress = address.toString();
+ Address address = cache.getLocalAddress();
+ if (address != null)
+ localAddress = address;
else if (CacheMode.LOCAL == cache.getConfiguration().getCacheMode())
localAddress = "LOCAL";
else
@@ -1080,13 +1076,14 @@
{
if (forceCheck || treeCacheAvailable == false)
{
- boolean available = (cacheName != null);
+ String configuredCacheName = getCacheName();
+ boolean available = (configuredCacheName != null);
if (available)
{
try
{
CacheManager cm = CacheManagerLocator.getCacheManagerLocator().getCacheManager(null);
- available = cm.getConfigurationNames().contains(cacheName);
+ available = cm.getConfigurationNames().contains(configuredCacheName);
}
catch (IllegalStateException ise)
{
@@ -1097,8 +1094,8 @@
if (!available && getMBeanServer() != null)
{
// See if there is a legacy JMX binding
- String onameStr = cacheName;
- if (DEFAULT_CACHE_NAME.equals(cacheName))
+ String onameStr = configuredCacheName;
+ if (DEFAULT_CACHE_NAME.equals(configuredCacheName))
onameStr = LEGACY_CACHE_NAME;
try
{
@@ -1113,7 +1110,7 @@
cacheName = onameStr;
}
}
- catch (Exception e)
+ catch (JMException e)
{
// no jmx
}
@@ -1170,7 +1167,6 @@
ContextClassLoaderSwitcher.SwitchContext switchContext = switcher.getSwitchContext(getClass().getClassLoader());
try
{
- // Determine if our cache is a PojoCache or a plain Cache
if (cacheObjectName == null)
{
CacheManager cm = CacheManagerLocator.getCacheManagerLocator().getCacheManager(null);
@@ -1183,6 +1179,7 @@
MBeanAttributeInfo[] attrs = info.getAttributes();
for (MBeanAttributeInfo attr : attrs)
{
+ // Determine if our cache is a PojoCache or a plain Cache
if ("PojoCache".equals(attr.getName()))
{
cache = ((PojoCache) getMBeanServer().getAttribute(cacheObjectName, "PojoCache")).getCache();
@@ -1348,7 +1345,7 @@
threadPool = (ThreadPool) server.getAttribute(on, "Instance");
log.debug("Using ThreadPool at " + threadPoolName + " to clean dead members");
}
- catch (Exception e)
+ catch (JMException e)
{
log.info("Unable to access ThreadPool at " + threadPoolName +
" -- will use individual threads for cleanup work");
@@ -1401,15 +1398,9 @@
*/
private class SSOCleanerTask implements Runnable
{
- boolean checkForEmpty = false;
-
-
- boolean getCheckForEmpty()
- {
- return checkForEmpty;
- }
+ private final boolean checkForEmpty;
- void setCheckForEmpty(boolean checkForEmpty)
+ private SSOCleanerTask(boolean checkForEmpty)
{
this.checkForEmpty = checkForEmpty;
}
More information about the jboss-cvs-commits
mailing list