Author: amila Date: Mon Mar 24 22:59:11 2008 New Revision: 15053 Log:
fixed an issue calling back Modified: trunk/commons/mercury/modules/core/src/main/java/org/wso2/mercury/handlers/MercuryInHandler.java trunk/commons/mercury/modules/core/src/main/java/org/wso2/mercury/state/InvokerBuffer.java Modified: trunk/commons/mercury/modules/core/src/main/java/org/wso2/mercury/handlers/MercuryInHandler.java ============================================================================== --- trunk/commons/mercury/modules/core/src/main/java/org/wso2/mercury/handlers/MercuryInHandler.java (original) +++ trunk/commons/mercury/modules/core/src/main/java/org/wso2/mercury/handlers/MercuryInHandler.java Mon Mar 24 22:59:11 2008 @@ -275,12 +275,21 @@ // all the sequence messages comes. here we wait this thread in // Mercury message context. at the invoke buffer level this thread will // notify when the time comes. - synchronized (mercuryMessageContext) { - try { - mercuryMessageContext.wait(); - } catch (InterruptedException e) { + // here we have to wait only if the invoker buffer has not + // decided to release this message + synchronized (rmdSequence.getInvokerBuffer()) { + long lastMessageSendToApplication = + rmdSequence.getInvokerBuffer().getLastMessageSendToApplication(); + if (sequence.getMessageNumber() > lastMessageSendToApplication) { + synchronized (mercuryMessageContext) { + try { + mercuryMessageContext.wait(); + } catch (InterruptedException e) { + } + } } } + } } Modified: trunk/commons/mercury/modules/core/src/main/java/org/wso2/mercury/state/InvokerBuffer.java ============================================================================== --- trunk/commons/mercury/modules/core/src/main/java/org/wso2/mercury/state/InvokerBuffer.java (original) +++ trunk/commons/mercury/modules/core/src/main/java/org/wso2/mercury/state/InvokerBuffer.java Mon Mar 24 22:59:11 2008 @@ -688,7 +688,7 @@ this.lastMessageNumber = lastMessageNumber; } - public long getLastMessageSendToApplication() { + public synchronized long getLastMessageSendToApplication() { return lastMessageSendToApplication; } _______________________________________________ Commons-dev mailing list Commons-dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/commons-dev