[jboss-cvs] JBossAS SVN: r81815 - projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/framework/server.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sat Nov 29 12:41:48 EST 2008
Author: bstansberry at jboss.com
Date: 2008-11-29 12:41:48 -0500 (Sat, 29 Nov 2008)
New Revision: 81815
Modified:
projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/framework/server/DistributedStateImpl.java
Log:
More warnings suppression
Modified: projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/framework/server/DistributedStateImpl.java
===================================================================
--- projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/framework/server/DistributedStateImpl.java 2008-11-29 17:28:44 UTC (rev 81814)
+++ projects/cluster/ha-server-cache-jbc/trunk/src/main/java/org/jboss/ha/framework/server/DistributedStateImpl.java 2008-11-29 17:41:48 UTC (rev 81815)
@@ -58,8 +58,8 @@
{
// Constants -----------------------------------------------------
- public static final String ROOT = "__DISTRIBUTED_STATE__";
- public static final Fqn ROOTFQN = Fqn.fromElements(ROOT);
+ public static final Serializable ROOT = "__DISTRIBUTED_STATE__";
+ public static final Fqn<Serializable> ROOTFQN = Fqn.fromElements(ROOT);
public static final int ROOTFQNSIZE = ROOTFQN.size();
protected static final String SERVICE_NAME = "DistributedState";
@@ -69,7 +69,7 @@
protected Map<String, List<Object>> keyListeners = new HashMap<String, List<Object>>();
protected Logger log = Logger.getLogger(this.getClass());
protected String name = null;
- protected Cache cache;
+ protected Cache<Serializable, Serializable> cache;
protected boolean replAsync;
protected HAPartitionCacheHandlerImpl cacheHandler;
protected boolean acquiredCache = false;
@@ -89,6 +89,7 @@
throw new IllegalStateException("No clustered cache available");
}
+ @SuppressWarnings("unchecked")
Cache c = null;
synchronized (cacheHandler)
{
@@ -101,7 +102,9 @@
}
}
cacheHandler.startCache();
- setClusteredCache(c);
+ @SuppressWarnings("unchecked")
+ Cache<Serializable, Serializable> unchecked = c;
+ setClusteredCache(unchecked);
}
this.cache.addCacheListener(this);
@@ -124,14 +127,14 @@
public String listContent() throws Exception
{
StringBuilder result = new StringBuilder();
- Collection cats = this.getAllCategories();
+ Collection<String> cats = this.getAllCategories();
if (cats == null) return result.toString();
- Iterator catsIter = cats.iterator();
+ Iterator<String> catsIter = cats.iterator();
while (catsIter.hasNext())
{
String category = (String) catsIter.next();
- Iterator keysIter = this.getAllKeys(category).iterator();
+ Iterator<Serializable> keysIter = this.getAllKeys(category).iterator();
result.append("-----------------------------------------------\n");
result.append("Logger : ").append(category).append("\n\n");
@@ -155,14 +158,14 @@
{
StringBuilder result = new StringBuilder();
result.append("<DistributedState>\n");
- Collection cats = this.getAllCategories();
+ Collection<String> cats = this.getAllCategories();
if (cats != null)
{
- Iterator catsIter = cats.iterator();
+ Iterator<String> catsIter = cats.iterator();
while (catsIter.hasNext())
{
String category = (String) catsIter.next();
- Iterator keysIter = this.getAllKeys(category).iterator();
+ Iterator<Serializable> keysIter = this.getAllKeys(category).iterator();
result.append("\t<Logger>\n");
result.append("\t\t<LoggerName>").append(category).append("</LoggerName>\n");
@@ -185,7 +188,7 @@
return result.toString();
}
- public Cache getClusteredCache()
+ public Cache<Serializable, Serializable> getClusteredCache()
{
return this.cache;
}
@@ -326,12 +329,14 @@
}
}
- public Collection getAllCategories()
+ public Collection<String> getAllCategories()
{
try
{
+ @SuppressWarnings("unchecked")
Node base = this.cache.getRoot().getChild(ROOTFQN);
- Collection keys = (base == null ? null : base.getChildrenNames());
+ @SuppressWarnings("unchecked")
+ Collection<String> keys = (base == null ? null : base.getChildrenNames());
if (keys != null && keys.size() > 0)
{
keys = Collections.unmodifiableCollection(keys);
@@ -350,7 +355,7 @@
* @see org.jboss.ha.framework.interfaces.DistributedState#getAllKeys(java.lang.String)
* @return - returns null in case of CacheException
*/
- public Collection getAllKeys(String category)
+ public Collection<Serializable> getAllKeys(String category)
{
try
{
@@ -370,17 +375,17 @@
* @see org.jboss.ha.framework.interfaces.DistributedState#getAllValues(java.lang.String)
* @return - returns null in case of CacheException
*/
- public Collection getAllValues(String category)
+ public Collection<Serializable> getAllValues(String category)
{
try
{
- Node categoryNode = this.getNode(category);
+ Node<Serializable, Serializable> categoryNode = this.getNode(category);
if (categoryNode == null) return null;
- Set childNodes = categoryNode.getKeys();
+ Set<Serializable> childNodes = categoryNode.getKeys();
if (childNodes == null) return null;
- Map entries = categoryNode.getData();
+ Map<Serializable, Serializable> entries = categoryNode.getData();
if (entries == null) return null;
- Collection retVal = new HashSet(entries.values());
+ Collection<Serializable> retVal = new HashSet<Serializable>(entries.values());
return Collections.unmodifiableCollection(retVal);
}
catch (CacheException ce)
@@ -389,21 +394,25 @@
}
}
+ @SuppressWarnings("deprecation")
public void registerDSListenerEx(String category, DSListenerEx subscriber)
{
this.registerListener(category, subscriber);
}
+ @SuppressWarnings("deprecation")
public void unregisterDSListenerEx(String category, DSListenerEx subscriber)
{
this.unregisterListener(category, subscriber);
}
+ @SuppressWarnings("deprecation")
public void registerDSListener(String category, DSListener subscriber)
{
this.registerListener(category, subscriber);
}
+ @SuppressWarnings("deprecation")
public void unregisterDSListener(String category, DSListener subscriber)
{
this.unregisterListener(category, subscriber);
@@ -442,6 +451,7 @@
}
}
+ @SuppressWarnings("deprecation")
protected void notifyKeyListeners(String category, Serializable key, Serializable value, boolean locallyModified)
{
synchronized (this.keyListeners)
@@ -466,6 +476,7 @@
}
}
+ @SuppressWarnings("deprecation")
protected void notifyKeyListenersOfRemove(String category, Serializable key, Serializable oldContent,
boolean locallyModified)
{
@@ -499,22 +510,22 @@
/** ExtendedTreeCacheListener methods */
// Private -------------------------------------------------------
- protected Fqn buildFqn(String category)
+ protected Fqn<Serializable> buildFqn(String category)
{
return Fqn.fromRelativeElements(ROOTFQN, category);
}
- protected Fqn buildFqn(String category, Serializable key)
+ protected Fqn<Serializable> buildFqn(String category, Serializable key)
{
return Fqn.fromElements(ROOT, category, key);
}
- protected Fqn buildFqn(String category, Serializable key, Serializable value)
+ protected Fqn<Serializable> buildFqn(String category, Serializable key, Serializable value)
{
return Fqn.fromElements(ROOT, category, key, value);
}
- protected Node getNode(String category) throws CacheException
+ protected Node<Serializable, Serializable> getNode(String category) throws CacheException
{
return this.cache.getRoot().getChild(this.buildFqn(category));
}
@@ -531,14 +542,16 @@
if (!modType.equals(ModificationType.PUT_DATA) && !modType.equals(ModificationType.REMOVE_DATA)) return;
// ignore changes for other roots in a shared cache
- Fqn fqn = event.getFqn();
+ @SuppressWarnings("unchecked")
+ Fqn<Serializable> fqn = event.getFqn();
if (!fqn.isChildOf(ROOTFQN)) return;
Serializable key = null;
Serializable value = null;
// there should be exactly one key/value pair in the map
- Map data = event.getData();
+ @SuppressWarnings("unchecked")
+ Map<Serializable, Serializable> data = event.getData();
if (data != null && !data.isEmpty())
{
key = (Serializable) data.keySet().iterator().next();
More information about the jboss-cvs-commits
mailing list