[jboss-user] [JBossCache] - CacheAPI

FredrikJ do-not-reply at jboss.com
Thu Mar 29 08:40:18 EDT 2007


I'm using the 2.0 Habanero cache and I want to access my cache as a CacheSPI. The reason being that I want to access nodes as NodeSPI so I can inspect (and possible upgrade) the node lock.

Now,
I started to check the Javadoc on how to get the CacheSPI instead of the regular Cache interface, but couldn't relly find anything. So I checked the test implementations for the 2.0, and found that you do this:

cache = (CacheSPI) DefaultCacheFactory.getInstance().createCache(...);

However, in the Javadoc we find:

You should NEVER attempt to directly cast a Cache instance to this interface. 

ok, so I'm guessing that you want guys like me not to look at the unit tests and cast the Cache to a CacheSPI (because it may not work in the future) =)

But, do you have any recommend way of getting a CacheSPI? 
Is there any other way then to make a cast at the moment?




View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4032738#4032738

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4032738



More information about the jboss-user mailing list