use of com.hazelcast.map.MapInterceptor in project hazelcast by hazelcast.
the class MapServiceContextImpl method interceptAfterRemove.
@Override
public void interceptAfterRemove(String mapName, Object value) {
MapContainer mapContainer = getMapContainer(mapName);
InterceptorRegistry interceptorRegistry = mapContainer.getInterceptorRegistry();
List<MapInterceptor> interceptors = interceptorRegistry.getInterceptors();
if (!interceptors.isEmpty()) {
for (MapInterceptor interceptor : interceptors) {
value = toObject(value);
interceptor.afterRemove(value);
}
}
}
use of com.hazelcast.map.MapInterceptor in project hazelcast by hazelcast.
the class MapServiceContextImpl method interceptPut.
@Override
public Object interceptPut(String mapName, Object oldValue, Object newValue) {
MapContainer mapContainer = getMapContainer(mapName);
List<MapInterceptor> interceptors = mapContainer.getInterceptorRegistry().getInterceptors();
Object result = null;
if (!interceptors.isEmpty()) {
result = toObject(newValue);
oldValue = toObject(oldValue);
for (MapInterceptor interceptor : interceptors) {
Object temp = interceptor.interceptPut(oldValue, result);
if (temp != null) {
result = temp;
}
}
}
return result == null ? newValue : result;
}
use of com.hazelcast.map.MapInterceptor in project hazelcast by hazelcast.
the class MapServiceContextImpl method interceptAfterGet.
@Override
public void interceptAfterGet(String mapName, Object value) {
MapContainer mapContainer = getMapContainer(mapName);
List<MapInterceptor> interceptors = mapContainer.getInterceptorRegistry().getInterceptors();
if (!interceptors.isEmpty()) {
value = toObject(value);
for (MapInterceptor interceptor : interceptors) {
interceptor.afterGet(value);
}
}
}
use of com.hazelcast.map.MapInterceptor in project hazelcast by hazelcast.
the class MapServiceContextImpl method interceptGet.
// todo interceptors should get a wrapped object which includes the serialized version
@Override
public Object interceptGet(String mapName, Object value) {
MapContainer mapContainer = getMapContainer(mapName);
InterceptorRegistry interceptorRegistry = mapContainer.getInterceptorRegistry();
List<MapInterceptor> interceptors = interceptorRegistry.getInterceptors();
Object result = null;
if (!interceptors.isEmpty()) {
result = toObject(value);
for (MapInterceptor interceptor : interceptors) {
Object temp = interceptor.interceptGet(result);
if (temp != null) {
result = temp;
}
}
}
return result == null ? value : result;
}
use of com.hazelcast.map.MapInterceptor in project hazelcast by hazelcast.
the class PostJoinMapOperation method run.
@Override
public void run() throws Exception {
MapService mapService = getService();
MapServiceContext mapServiceContext = mapService.getMapServiceContext();
for (MapIndexInfo mapIndex : indexInfoList) {
final MapContainer mapContainer = mapServiceContext.getMapContainer(mapIndex.mapName);
final Indexes indexes = mapContainer.getIndexes();
for (MapIndexInfo.IndexInfo indexInfo : mapIndex.lsIndexes) {
indexes.addOrGetIndex(indexInfo.attributeName, indexInfo.ordered);
}
}
for (InterceptorInfo interceptorInfo : interceptorInfoList) {
final MapContainer mapContainer = mapServiceContext.getMapContainer(interceptorInfo.mapName);
InterceptorRegistry interceptorRegistry = mapContainer.getInterceptorRegistry();
Map<String, MapInterceptor> interceptorMap = interceptorRegistry.getId2InterceptorMap();
List<Map.Entry<String, MapInterceptor>> entryList = interceptorInfo.interceptors;
for (Map.Entry<String, MapInterceptor> entry : entryList) {
if (!interceptorMap.containsKey(entry.getKey())) {
interceptorRegistry.register(entry.getKey(), entry.getValue());
}
}
}
createQueryCaches();
}
Aggregations