Announcement Announcement Module
Collapse
No announcement yet.
Claim check out calls getMessage twice (for some implementations) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Claim check out calls getMessage twice (for some implementations)

    Hi there,

    I'm wondering if there is any reason why the ClaimCheckOutTransformer uses MessageStore.getMessage instead of MessageStore.removeMessage to retrieve the row? MessageStore.removeMessage is supposed to return the message as well.

    It ends up, for JdbcMessageStore anyways, retrieving the row twice (and performing the row mapping twice). For large payloads, this deserialization might take some time.

    Instead of:
    Code:
    	Message<?> retrievedMessage = this.messageStore.getMessage(id);
    	Assert.notNull(retrievedMessage, "unable to locate Message for ID: " + id
    			+ " within MessageStore [" + this.messageStore + "]");
    	if (this.removeMessage) {
    		this.messageStore.removeMessage(id);
    		if (logger.isDebugEnabled()) {
    			logger.debug("Removed Message with claim-check '" + id + "' from the MessageStore.");
    		}
    	}
    Couldn't it be:
    Code:
    	Message<?> retrievedMessage;
    	if (this.removeMessage) {
    		retrievedMessage = this.messageStore.removeMessage(id);
    		if (logger.isDebugEnabled()) {
    			logger.debug("Removed Message with claim-check '" + id + "' from the MessageStore.");
    		}
    	}
    	else {
    		retrievedMessage = this.messageStore.getMessage(id);
    	}
    	Assert.notNull(retrievedMessage, "unable to locate Message for ID: " + id
    			+ " within MessageStore [" + this.messageStore + "]")

  • #2
    Seems like a good suggestion to me. Would you mind creating a JIRA "improvement" issue?... and if you're interested, you could even submit a Pull Request for that issue (after signing the CLA here if you have not done so earlier: https://support.springsource.com/spr...mmitter_signup).

    Thanks!
    -Mark

    Comment


    • #3
      By the way, one thing I do notice is that the current behavior would always throw an Exception if the item is NULL (due to the Assert.notNull), so in your suggested change, that behavior would need to be accounted for by asserting against the object returned from the remove call.

      Comment


      • #4
        Nevermind, you have it at the end. I should read the whole thing before commenting next time

        Cheers,
        Mark

        Comment


        • #5
          Great, I did all of those things you suggested.

          https://jira.springsource.org/browse/INT-2920
          https://github.com/SpringSource/spri...ation/pull/736

          Happy to help!

          Comment

          Working...
          X