0 Replies Latest reply on Oct 29, 2004 11:04 AM by Paul Smith

    Calling batchInvalidate (InvalidationManager) doesn't work

    Paul Smith Newbie

      I have an entity bean deployed to a container with InvalidableEntityInstanceCache cache implementation. The entity bean has an invalidation-group-name of "bob".

      Note that I haven't mentioned the cache-invalidation setting or the presence or not of EntityBeanCacheBatchInvalidatorInterceptor in the interceptor stack for the container as both are irrelevant to this issue.

      I load 4 entites into the cache by calling a test method. I can see the cache size through the JMX console. I then run the code below and should see the cache size drop to 2. It stays as 4.

      I'm using JBoss 3.2.5. I'm pretty certain that I'm not doing anything wrong as the code below is very standard. Is there something wrong below, or is this another JBoss bug?

      MBeanServer server = (MBeanServer) MBeanServerFactory.findMBeanServer(null).iterator().next();

      String invalidationManagerName = "jboss.cache:service=InvalidationManager";

      ObjectName invalidationManager = new ObjectName(invalidationManagerName);

      Class batchInvalidationClass = Class.forName("org.jboss.cache.invalidation.BatchInvalidation");

      Constructor c = batchInvalidationClass.getDeclaredConstructor(new Class[] {keys.getClass(),String.class});

      Object[] invalidations = (Object[]) Array.newInstance(batchInvalidationClass,1);

      // keys below is an array of 2 serializable objects (strings in my case, matching the PKs of the 2 entities I want to evict from the cache
      Array.set(invalidations,0,c.newInstance(new Object[] {keys,"bob"}));

      Object[] params = {invalidations};
      String[] signature = {"[Lorg.jboss.cache.invalidation.BatchInvalidation;"};

      server.invoke(invalidationManager, "batchInvalidate", params, signature);