_accountDao.releaseFromLockTable(ownerId);
@DB private InstanceGroupVO createVmGroup(String groupName, long accountId) { Account account = null; try { account = _accountDao.acquireInLockTable(accountId); // to ensure // duplicate // vm group // names are // not // created. if (account == null) { s_logger.warn("Failed to acquire lock on account"); return null; } InstanceGroupVO group = _vmGroupDao.findByAccountAndName(accountId, groupName); if (group == null) { group = new InstanceGroupVO(groupName, accountId); group = _vmGroupDao.persist(group); } return group; } finally { if (account != null) { _accountDao.releaseFromLockTable(accountId); } } }
s_logger.debug("Releasing lock account " + ipOwner); _accountDao.releaseFromLockTable(ipOwner.getId()); s_logger.debug("Associate IP address lock released");
public LoadBalancer handleCreateLoadBalancerRule(final CreateLoadBalancerRuleCmd lb, Account account, final long networkId) throws InsufficientAddressCapacityException, NetworkRuleConflictException { //this part of code is executed when the LB provider is Elastic Load Balancer vm if (!_networkModel.isProviderSupportServiceInNetwork(lb.getNetworkId(), Service.Lb, Provider.ElasticLoadBalancerVm)) { return null; } final Long ipId = lb.getSourceIpAddressId(); if (ipId != null) { return null; } account = _accountDao.acquireInLockTable(account.getId()); if (account == null) { s_logger.warn("ELB: CreateLoadBalancer: Failed to acquire lock on account"); throw new CloudRuntimeException("Failed to acquire lock on account"); } try { return handleCreateLoadBalancerRuleWithLock(lb, account, networkId); } finally { if (account != null) { _accountDao.releaseFromLockTable(account.getId()); } } }
} finally { s_logger.debug("Releasing lock for " + locked); _accountDao.releaseFromLockTable(locked.getId());