From 01ae7120ac2d8a9c673ab5d54d45f604a4a88581 Mon Sep 17 00:00:00 2001 From: Prachi Damle Date: Tue, 16 Dec 2014 16:46:28 -0800 Subject: [PATCH] CLOUDSTACK-8078: [Automation] Deletion of Affinity Groups - CloudRuntimeException: No Event Pubish can be wrapped within DB Transaction! Changes: - The event of deleteing an affinity group is published on the MessageBus so that IAM Service can listen and process the event, However the publish operation should not be handled within a DB transaction, since it may take longer and hold the DB transaction for long unnecessarily - Publish any events to MessageBus outside of the transaction Conflicts: server/src/org/apache/cloudstack/affinity/AffinityGroupServiceImpl.java --- .../cloudstack/affinity/AffinityGroupServiceImpl.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/server/src/org/apache/cloudstack/affinity/AffinityGroupServiceImpl.java b/server/src/org/apache/cloudstack/affinity/AffinityGroupServiceImpl.java index 8e606ca0584..91835ea8b9d 100644 --- a/server/src/org/apache/cloudstack/affinity/AffinityGroupServiceImpl.java +++ b/server/src/org/apache/cloudstack/affinity/AffinityGroupServiceImpl.java @@ -298,13 +298,14 @@ public class AffinityGroupServiceImpl extends ManagerBase implements AffinityGro if (groupDomain != null) { _affinityGroupDomainMapDao.remove(groupDomain.getId()); } - // remove its related ACL permission - Pair, Long> params = new Pair, Long>(AffinityGroup.class, affinityGroupIdFinal); - _messageBus.publish(_name, EntityManager.MESSAGE_REMOVE_ENTITY_EVENT, PublishScope.LOCAL, params); } } }); + // remove its related ACL permission + Pair, Long> params = new Pair, Long>(AffinityGroup.class, affinityGroupIdFinal); + _messageBus.publish(_name, EntityManager.MESSAGE_REMOVE_ENTITY_EVENT, PublishScope.LOCAL, params); + if (s_logger.isDebugEnabled()) { s_logger.debug("Deleted affinity group id=" + affinityGroupId); }