Hi. I'm designing Tile Cache for mapping service. I'm using Jboss Cache. I want to
cache Tiles. Tiles are instances of class Image from SWT package. Those Images have
dispose() method that should be called when You don't need the Image anymore.
I would like to invoke this method when node in cache that contains Image tile is evicted.
I need this only for local cache on client application without replication and
clusterring. I tried to make TileEvictionActionPolicy with such method:
| @Override
| public boolean evict(Fqn fqn) {
| try
| {
| System.out.println("Start Eviction of: " + fqn);
| if (log.isTraceEnabled()) log.trace("Evicting Fqn " + fqn);
| Node<String, Object> node = (Node<String, Object>)
cache.getNode(fqn);
| Image img = node.get("tile");
| if (img!= null && !img.isDisposed())) {
| img.dispose();
| }
| cache.evict(fqn);
| return true;
| }
| catch (Exception e)
| {
| if (log.isDebugEnabled()) log.debug("Unable to evict " + fqn, e);
| return false;
| }
|
| }
|
But I notice that when I call in this method cache.getNode(fqn) then I have another node
evicted too and I don't know what to do.
Is there any place to controll node removal from cache. I would like to call dispose() on
Image that is evicted because of node limit in LRU strategy.
//Have a nice day
//Martin
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4215283#...
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&a...