Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
2.9.1
-
None
-
None
-
Mac, Java 11
-
Docs Required, Release Notes Required
Description
The onGet method in cache interceptors appears not to be called since version 2.9.0. Or at least, the API changed. I have the following code:
CacheConfiguration<Long, Object> cacheConfiguration = new CacheConfiguration<>();
cacheConfiguration.setName("PERSON_CACHE");
cacheConfiguration.setAtomicityMode(CacheAtomicityMode.ATOMIC);
cacheConfiguration.setIndexedTypes(Long.class, Person.class);
cacheConfiguration.setInterceptor(new CacheInterceptor<Long, Object>() {
@Override
public Object onGet(Long aLong, Object p)
@Override
public Object onBeforePut(Cache.Entry<Long, Object> entry, Object p) {
if (p.getClass().equals(Person.class))
else if (p.getClass().equals(BinaryObjectImpl.class)) {
BinaryObjectBuilder person = ((BinaryObject) p).toBuilder();
String name = person.getField("name");
person.setField("name", new StringBuilder(name).reverse().toString());
return person.build();
}
else {
return null;
}
}
@Override
public void onAfterPut(Cache.Entry<Long, Object> entry) {
// do nothing
}
@Override
public IgniteBiTuple<Boolean, Object> onBeforeRemove(Cache.Entry<Long, Object> entry) {
return new IgniteBiTuple<>(true, entry.getValue());
}
@Override
public void onAfterRemove(Cache.Entry<Long, Object> entry) {
// do nothing
}
});
It reverses the name before storing it and reverses it again on a get. In 2.9.0 this works as expected. In every version since it fails. It reverses the string on a put but the onGet method never gets called.
Attachments
Issue Links
- relates to
-
IGNITE-1903 Cache configuration is serialized to nodes whether they require it or not
- Resolved
-
IGNITE-13417 Cache Interceptors deserialization on client nodes
- Resolved