[infinispan-issues] [JBoss JIRA] (ISPN-5482) JSR-107 - Provide mechanism to handle expiration events

Gustavo Fernandes (JIRA) issues at jboss.org
Thu Dec 3 13:09:00 EST 2015


     [ https://issues.jboss.org/browse/ISPN-5482?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gustavo Fernandes updated ISPN-5482:
------------------------------------
    Git Pull Request: https://github.com/infinispan/infinispan/pull/3861, https://github.com/infinispan/infinispan/pull/3879  (was: https://github.com/infinispan/infinispan/pull/3879)


> JSR-107 - Provide mechanism to handle expiration events 
> --------------------------------------------------------
>
>                 Key: ISPN-5482
>                 URL: https://issues.jboss.org/browse/ISPN-5482
>             Project: Infinispan
>          Issue Type: Feature Request
>          Components: JCache
>            Reporter: Matej Čimbora
>            Assignee: Gustavo Fernandes
>             Fix For: 8.1.0.Final, 8.0.3.Final
>
>
> Currently, expiration events are supported only by embedded mode & additionally require entry to be accessed in order to be created. This can lead to CacheEntryExpiredListener not being notified when an entry expires.
> Note: Not covered by TCK tests.
> Example:
> {code}
>    @Test
>    public void testExpiration(Method m) {
>       Cache<String, String> cache1 = getCache1(m);
>       Cache<String, String> cache2 = getCache2(m);
>       TestExpiredListener listener = new TestExpiredListener();
>       MutableCacheEntryListenerConfiguration conf1 = new MutableCacheEntryListenerConfiguration(FactoryBuilder.factoryOf(listener), null, false, false);
>       cache1.registerCacheEntryListener(conf1);
>       cache2.put("key1", "val1");
>       sleep(5000);
>       // Required by embedded JCache implementation to work 
>       assert cache1.get("key1") == null;
>       // Failing for remote JCache implementation
>       assertEquals(1, listener.invocationCount);
>    }
>    private static class TestExpiredListener implements CacheEntryExpiredListener, Serializable {
>       private int invocationCount;
>       @Override
>       public void onExpired(Iterable iterable) throws CacheEntryListenerException {
>          Iterator iterator = iterable.iterator();
>          while (iterator.hasNext()) {
>             iterator.next();
>             invocationCount++;
>          }
>       }
>    }
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)



More information about the infinispan-issues mailing list