1 Reply Latest reply on Jan 23, 2013 8:00 AM by Rob Gratz

    Deleting a cache within a transactional method times out

    Rob Gratz Newbie

      I'm having trouble removing a cache from a DefaultCacheManager while inside a transactional method.  The code I am using follows which is called from another method that is marked as @Transactional.  I am currently using Atomikos from within a spring managed application to handle transactions.

       

      <code>

      Cache cacheToRemove = cacheManager.getCache(name, false);

      if (cacheToRemove != null)

      {

        cacheToRemove.clear();

        cacheManager.removeCache(name);

      </code>

       

      In debugging the issue, it seems the code in the org.infinispan.transaction.TransactionTable.shutdownGracefully() method loops until there are no transactions that are current or until it times out.  It seems that because I'm removing the cache within a transaction, this will always timeout.  I guess my question is, am I doing the right steps to remove a cache, and if so, is it possible to remove a cache from within a transaction? Should it be run asynchronously?  If so, is that a configuration setting or do I need to spin up the thread myself?

       

      Thank you for any help that can be provided.