- _authorizer.check(this, new WriteOperation());
- int oldsize = _authorizedEntries.get().size();
- _authorizedEntries.invalidate();
- decorated().addImage(aId, aImage);
- int newsize = _authorizedEntries.get().size();
- if (newsize != oldsize + 1) {
- throw new RuntimeException("cache was not refreshed property");
+ try {
+ _authorizer.check(this, new WriteOperation());
+ decorated().addImage(aId, aImage);
+ } finally {
+ _authorizedEntries.invalidate();