Source:
private void forceComplete(MessageGroup group) { Object correlationKey = group.getGroupId(); Lock lock = this.lockRegistry.obtain(UUIDConverter.getUUID(correlationKey).toString()); boolean removeGroup = true; try { lock.lockInterruptibly(); try { MessageGroup groupNow = group; if (!group.isComplete()) { groupNow = this.messageStore.getMessageGroup(correlationKey); } long lastModifiedNow = groupNow.getLastModified(); int groupSize = groupNow.size(); if ((!groupNow.isComplete() || groupSize == 0) && group.getLastModified() == lastModifiedNow && group.getTimestamp() == groupNow.getTimestamp()) { if (groupSize > 0) { if (releaseStrategy.canRelease(groupNow)) { this.completeGroup(correlationKey, groupNow); } else { this.expireGroup(correlationKey, groupNow); } } else { removeGroup = lastModifiedNow <= (System.currentTimeMillis() - this.minimumTimeoutForEmptyGroups); if (removeGroup && logger.isDebugEnabled()) { logger.debug("Removing empty group: " + correlationKey); } } } else { removeGroup = false; if (logger.isDebugEnabled()) { logger.debug("Group expiry candidate (" + correlationKey + ") has changed - it may be reconsidered for a future expiration"); } } } finally { if (removeGroup) { this.remove(group); } ScheduledFuture<?> scheduledFuture = this.expireGroupScheduledFutures.get(UUIDConverter.getUUID(correlationKey)); if (scheduledFuture != null) { if (logger.isDebugEnabled()) { logger.debug("Cancel 'forceComplete' scheduling for MessageGroup [ " + group + "]."); } scheduledFuture.cancel(true); } lock.unlock(); } } catch (InterruptedException ie) { Thread.currentThread().interrupt(); throw new MessagingException("Thread was interrupted while trying to obtain lock"); } }

Target:
private void forceComplete(MessageGroup group) { Object correlationKey = group.getGroupId(); Lock lock = this.lockRegistry.obtain(UUIDConverter.getUUID(correlationKey).toString()); boolean removeGroup = true; try { lock.lockInterruptibly(); try { ScheduledFuture<?> scheduledFuture = this.expireGroupScheduledFutures.remove(UUIDConverter.getUUID(correlationKey)); if (scheduledFuture != null) { boolean canceled = scheduledFuture.cancel(false); if (canceled && logger.isDebugEnabled()) { logger.debug("Cancel 'forceComplete' scheduling for MessageGroup [ " + group + "]."); } } MessageGroup groupNow = group; if (!group.isComplete()) { groupNow = this.messageStore.getMessageGroup(correlationKey); } long lastModifiedNow = groupNow.getLastModified(); int groupSize = groupNow.size(); if ((!groupNow.isComplete() || groupSize == 0) && group.getLastModified() == lastModifiedNow && group.getTimestamp() == groupNow.getTimestamp()) { if (groupSize > 0) { if (releaseStrategy.canRelease(groupNow)) { this.completeGroup(correlationKey, groupNow); } else { this.expireGroup(correlationKey, groupNow); } } else { removeGroup = lastModifiedNow <= (System.currentTimeMillis() - this.minimumTimeoutForEmptyGroups); if (removeGroup && logger.isDebugEnabled()) { logger.debug("Removing empty group: " + correlationKey); } } } else { removeGroup = false; if (logger.isDebugEnabled()) { logger.debug("Group expiry candidate (" + correlationKey + ") has changed - it may be reconsidered for a future expiration"); } } } finally { if (removeGroup) { this.remove(group); } lock.unlock(); } } catch (InterruptedException ie) { Thread.currentThread().interrupt(); logger.debug("Thread was interrupted while trying to obtain lock"); } }