Hi all (:
I encountered a problem using Spring 3.0.7 / Spring Security 3.1.0.RC3 and hope you guys can help me out or at least point me to the right direction.
The scenario is as follows:
When a expection is thrown inside my transactional, the transaction (using JTA - Atomikos Transactionmanager) gets rolled back correctly on the database, but the ACL Mutations made are still in the aclCache (I'm using EhCache).
I found a workaround, but imo it's pretty ugly:
I looked into the source. The desired behaviour is obviously inside of JdbcMutableAclService' private method 'clearCacheIncludingChildren(ObjectIdentity objectIdentity)'
This function is usually called aftern ACL Update.Code:private void clearCacheIncludingChildren(ObjectIdentity objectIdentity) { Assert.notNull(objectIdentity, "ObjectIdentity required"); List<ObjectIdentity> children = findChildren(objectIdentity); if (children != null) { for (ObjectIdentity child : children) { clearCacheIncludingChildren(child); } } aclCache.evictFromCache(objectIdentity); }
Since neither this method nor the aclCache is accessible from another class, I extended JdbcMutableAclService and added a reference to aclCache, a public cleanUp Method (see below) and copy of the above method.
When I throw an Exception the the corresponding ObjectIdentity is passed. The catch block looks like thisCode:public MutableAcl cleanupAcl( ObjectIdentityImpl oi) { clearCacheIncludingChildren( oi); return (MutableAcl) super.readAclById(oi); }
Code:try { //doSomething is a Transactional Service Method where the object is updated and the acl update/insert is made doSomething(); catch (CustomException e) { MutableAcl acl = customJdbcMutableAcleService.cleanupAcl( e.getObjectIdentity()); }
I assume (or lets say I hope) there is another easy way to notify the EHCache after a transaction is rolled back.
thanks in advance... appreciate it.


:
) there is another easy way to notify the EHCache after a transaction is rolled back.
Reply With Quote
