2011-09-21 8 views
0

JBossCache에 새로운 기능입니다. 사용자 설명서를 읽으면 리스너가 사용 된 Eviction 클래스에 추가 될 수 있다고 말했지만 구성 파일에 리스너를 추가하는 방법이나이를 추가하는 방법을 찾지 못했습니다.JBossCache 퇴거 리스너

나는 방법 @NodeEvicted와 함께 @CacheListener을 추가하려고했지만, 그 방법

@CacheListener 
public class EvictionListener { 

    @NodeEvicted 
    public void nodeEvicted(NodeEvent ne) { 
     System.out.println("Se borro el nodo"); 
    } 
} 

캐시 인스턴스

CacheFactory factory = new DefaultCacheFactory(); 
this.cache = factory.createCache(); 

EvictionListener listener = new EvictionListener(); 
this.cache.create(); 
this.cache.addCacheListener(listener); 

에 추가하지만 SYSOUT은 실행되지 않습니다. 그것을 테스트하기 위해, 나는 단지 간단한 Main 값을 실행하고있다. 이 내가 사용하고있는 설정 값입니다 : 내가 XML 구성 파일을 읽는되지 않았기 때문에

<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns="urn:jboss:jbosscache-core:config:3.2"> 


    <transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/> 


    <eviction wakeUpInterval="20"> 
     <default algorithmClass="org.jboss.cache.eviction.FIFOAlgorithm" wakeUpInterval="20"> 
      <property name="maxNodes" value="20" />   
     </default>   
    </eviction> 

</jbosscache> 

답변

0

문제는 해결되었다.

나는 실종됐다 :

factory.createCache(file);