cache2.getAdvancedCache().removeInterceptor(ErrorInducingInterceptor.class);
}
}
private void induceListenerMalfunctioning(boolean throwError, FailureType failureType) throws Throwable {
Cache cache1 = cache(0, "replSync");
Cache cache2 = cache(1, "replSync");
ErrorInducingListener listener = new ErrorInducingListener(throwError);
cache2.addListener(listener);
try {
cache1.put(failureType, 1);
} catch (RemoteException e) {
Throwable cause = e.getCause(); // get the exception behind the remote one
if (throwError && cause.getCause() instanceof InvocationTargetException)
throw cause.getCause().getCause();
else
throw cause.getCause();
} finally {
cache2.removeListener(listener);
}
}