clearAll() of LRU Cache!!!

All
2005-11-30
2013-03-22
  • Jonathan Taub
    Jonathan Taub
    2005-11-30

    I just wrote a piece of code that flushes the LRU cache by calling clearAll. It doesn't do anything.
    It that related to your posting (the map.clear() bug)?

    Are there any elegant workarounds?
    (iterating through the entire cache and clearing each element individually is considered elegant).

     
  • Jonathan Taub
    Jonathan Taub
    2005-11-30

    When I do the "clearAll" call, it works only on one VM. Other VMs do not clear the cache.
    However, when clearing a single element from the cache, other VMs get the change.

    So this is clearly not a networking issue.

     
  • I've been experimenting/debugging this issue, and have noticed that when one JVM sends a CacheNotification with a key "(ALL)" (MultiCacheManager.CLEAR_ALL) the second JVM will receive this CacheNotification and execute the method receiveNotification on MultiCacheManager.
    And there the code is + - like this:
    (...)
    if (notification.getKey() == CLEAR_ALL) {
         cache.doClearAll();
    } else {
         cache.doClear(notification.getKey());
    }
    (...)

    So being CLEAR_ALL a String with value "(ALL)", the first condition will only be true if both are the same object on this JVM, which is not the case I think.
    So should the `if` be rather something like:
    if (CLEAR_ALL.equals(notification.getKey())) ?

    Can John Watkinson or one of the active developers clarify this please?

    Thanks
    Fernando Martins

     
  • Coder
    Coder
    2006-02-20

    This is a swarmcache bug I also ran into.

    You should patch it to use .equals()

    I think patch 1048007 (see patches in swarmcache project page) fixes this.

    Too bad swarmcache seems not to be maintained any more, it needs an RC3 release bad.

    --Coder