Java Code Examples for javax.cache.event.CacheEntryEvent#isOldValueAvailable()

The following examples show how to use javax.cache.event.CacheEntryEvent#isOldValueAvailable() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CacheListenersTest.java    From blazingcache with Apache License 2.0 5 votes vote down vote up
@Override
public void onRemoved(Iterable<CacheEntryEvent<? extends K, ? extends V>> events) throws CacheEntryListenerException {            
    for (CacheEntryEvent<? extends K, ? extends V> event : events) {
        
        assertEquals(REMOVED.toString(), event.getEventType().toString());
        removed.incrementAndGet();
        event.getKey();
        if (event.isOldValueAvailable()) {
            event.getOldValue();
        }
    }
}
 
Example 2
Source File: CacheListenersTest.java    From blazingcache with Apache License 2.0 5 votes vote down vote up
@Override
public void onUpdated(Iterable<CacheEntryEvent<? extends K, ? extends V>> events) throws CacheEntryListenerException {
    for (CacheEntryEvent<? extends K, ? extends V> event : events) {
        assertEquals(UPDATED.toString(), event.getEventType().toString());
        updated.incrementAndGet();
        event.getKey();
        if (event.isOldValueAvailable()) {
            event.getOldValue();
        }
    }
}
 
Example 3
Source File: CacheTestSupport.java    From cache2k with Apache License 2.0 5 votes vote down vote up
@Override
public void onRemoved(Iterable<CacheEntryEvent<? extends K, ? extends V>> events) throws CacheEntryListenerException {
  for (CacheEntryEvent<? extends K, ? extends V> event : events) {
    assertEquals(REMOVED, event.getEventType());
    assertTrue("isOldValueAvailable() for onRemoved", event.isOldValueAvailable());
    assertNotNull("old value non-null for onRemoved", event.getOldValue());
    assertEquals("old value identical to value at onRemoved", event.getOldValue(), event.getValue());
    removed.incrementAndGet();
    event.getKey();
    if (event.isOldValueAvailable()) {
      event.getOldValue();
    }
  }
}
 
Example 4
Source File: CacheTestSupport.java    From cache2k with Apache License 2.0 5 votes vote down vote up
@Override
public void onUpdated(Iterable<CacheEntryEvent<? extends K, ? extends V>> events) throws CacheEntryListenerException {
  for (CacheEntryEvent<? extends K, ? extends V> event : events) {
    assertEquals(UPDATED, event.getEventType());
    assertTrue("isOldValueAvailable() for onUpdated", event.isOldValueAvailable());
    assertNotNull("old value non-null for onUpdated", event.getOldValue());
    updated.incrementAndGet();
    event.getKey();
    if (event.isOldValueAvailable()) {
      event.getOldValue();
    }
  }
}