question: @ Override @ Transactional ( value = "cacheTransactionManager" , propagation = Propagation . REQUIRES_NEW ) public void doUpdateRuleTag ( Long id , Properties properties ) throws IllegalAccessException { LOGGER . trace ( "Updating RuleTag " + id ) ; tagCache . acquireWriteLockOnKey ( id ) ; try { RuleTag ruleTagCopy = tagCache . getCopy ( id ) ; Collection < Long > oldTagIds = null ; if ( properties . containsKey ( "ruleText" ) ) { oldTagIds = ruleTagCopy . getRuleInputTagIds ( ) ; } try { commonTagFacade . updateConfig ( ruleTagCopy , properties ) ; configurableDAO . updateConfig ( ruleTagCopy ) ; tagCache . putQuiet ( ruleTagCopy ) ; } catch ( RuntimeException e ) { String msg = "Exception caught while updating Rule" ; LOGGER . error ( msg , e ) ; throw new UnexpectedRollbackException ( msg , e ) ; } try { if ( oldTagIds != null ) { for ( Long oldTagId : oldTagIds ) { tagConfigGateway . removeRuleFromTag ( oldTagId , ruleTagCopy . getId ( ) ) ; } for ( Long newTagId : ruleTagCopy . getRuleInputTagIds ( ) ) { tagConfigGateway . addRuleToTag ( newTagId , ruleTagCopy . getId ( ) ) ; } } } catch ( RuntimeException e ) { String errMessage = "Exception caught while updating a RuleTag in cache - rolling back DB transaction and removing from cache." ; LOGGER . error ( errMessage , e ) ; if ( oldTagIds != null ) { for ( Long oldTagId : oldTagIds ) { try { tagConfigGateway . addRuleToTag ( oldTagId , ruleTagCopy . getId ( ) ) ; } catch ( Exception ex ) { LOGGER . warn ( "Exception caught while rolling back rule update" , ex ) ; } } for ( Long newTagId : ruleTagCopy . getRuleInputTagIds ( ) ) { try { tagConfigGateway . removeRuleFromTag ( newTagId , ruleTagCopy . getId ( ) ) ; } catch ( Exception ex ) { LOGGER . warn ( "Exception caught while rolling back rule update" , ex ) ; } } } throw new UnexpectedRollbackException ( errMessage , e ) ; } tagCache . releaseWriteLockOnKey ( id ) ; try { LOGGER . trace ( "Resetting all relevant Rule parent Process/Equipment ids" ) ; for ( Long parentRuleId : ruleTagCopy . getRuleIds ( ) ) { ruleTagFacade . setParentSupervisionIds ( parentRuleId ) ; } } catch ( Exception e ) { String msg = "Exception while reloading rule parent ids: cache may be left in inconsistent state! - need to remove this rule to try and recover consistency" ; LOGGER . error ( msg , e ) ; throw new UnexpectedRollbackException ( msg , e ) ; } } finally { if ( tagCache . isWriteLockedByCurrentThread ( id ) ) { tagCache . releaseWriteLockOnKey ( id ) ; } } }
target:  Takes all the necessary actions when updating the configuration of a rule tag (updating the cache object and the database).