Freeman Yue Fang created CXF-9259:
-------------------------------------

             Summary: JCacheReplayCache does not respect entry expiry or shared 
CacheManager ownership
                 Key: CXF-9259
                 URL: https://issues.apache.org/jira/browse/CXF-9259
             Project: CXF
          Issue Type: Bug
            Reporter: Freeman Yue Fang


{{JCacheReplayCache}} has two lifecycle issues:

h3. 1. Closing one cache closes unrelated caches

Each instance obtains the provider's shared default {{CacheManager}}, but 
{{close()}} destroys its named cache and then closes the entire manager.

*Steps to reproduce:*
# Create two {{CXFJCacheReplayCache}} instances with different names.
# Add an entry to the second cache.
# Close the first cache.
# Access the second cache.

*Actual result:* The second cache throws {{IllegalStateException}} because its 
cache is closed.

*Expected result:* Closing one replay cache leaves other active caches usable.

h3. 2. The supplied entry expiry is ignored

{{add(identifier, expiry)}} and {{addIfAbsent(identifier, expiry)}} store the 
expiry in {{EHCacheValue}}, but the configured expiry policy always uses the 
default one-hour TTL.

*Steps to reproduce:*
# Insert an identifier with a short explicit expiry.
# Wait until that expiry has passed.
# Call {{contains(identifier)}}.
# Attempt another {{addIfAbsent()}} for the same identifier.

*Actual result:* The identifier remains present and reinsertion returns 
{{false}}.

*Expected result:* Entries expire according to the supplied expiry, subject to 
the replay-cache contract's limits.

h3. Proposed behavior

The implementation should respect shared cache-manager ownership and apply 
per-entry expiration while preserving atomic replay checks.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to