17.3.2. Adding Custom Interceptors Programmatically
To add a custom interceptor programmatically in JBoss Data Grid, first obtain a reference to the
AdvancedCache
.
For example:
CacheManager cm = getCacheManager(); Cache aCache = cm.getCache("aName"); AdvancedCache advCache = aCache.getAdvancedCache();
Then use an
addInterceptor()
method to add the interceptor.
For example:
advCache.addInterceptor(new MyInterceptor(), 0);