Author: mckierna
Date: Tue Jan 15 03:08:04 2008
New Revision: 612080

URL: http://svn.apache.org/viewvc?rev=612080&view=rev
Log:
further timing window when storing invoker beans

Modified:
    
webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/storage/inmemory/InMemoryInvokerBeanMgr.java

Modified: 
webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/storage/inmemory/InMemoryInvokerBeanMgr.java
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/storage/inmemory/InMemoryInvokerBeanMgr.java?rev=612080&r1=612079&r2=612080&view=diff
==============================================================================
--- 
webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/storage/inmemory/InMemoryInvokerBeanMgr.java
 (original)
+++ 
webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/storage/inmemory/InMemoryInvokerBeanMgr.java
 Tue Jan 15 03:08:04 2008
@@ -22,6 +22,8 @@
 import java.util.List;
 
 import org.apache.axis2.context.AbstractContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.sandesha2.Sandesha2Constants;
 import org.apache.sandesha2.SandeshaException;
 import org.apache.sandesha2.storage.SandeshaStorageException;
@@ -29,13 +31,28 @@
 import org.apache.sandesha2.storage.beans.InvokerBean;
 
 public class InMemoryInvokerBeanMgr extends InMemoryBeanMgr implements 
InvokerBeanMgr {
+       
+       private static final Log log = 
LogFactory.getLog(InMemoryInvokerBeanMgr.class);
 
        public InMemoryInvokerBeanMgr(InMemoryStorageManager mgr, 
AbstractContext context) {
                super(mgr, context, Sandesha2Constants.BeanMAPs.STORAGE_MAP);
        }
 
        public boolean insert(InvokerBean bean) throws SandeshaStorageException 
{
-               return super.insert(bean.getMessageContextRefKey(), bean);
+               //first check that an invoker bean does not already exist with 
the same msg and seq numbers
+               InvokerBean finder = new InvokerBean();
+               finder.setMsgNo(bean.getMsgNo());
+               finder.setSequenceID(bean.getSequenceID());
+               synchronized(this){
+                       if(super.findUnique(finder)!=null){
+                               if(log.isDebugEnabled()) 
log.debug("InMemoryInvokerBeanMgr insert failed due to existing invoker bean");
+                               return false;
+                       }
+                       else{
+                               return 
super.insert(bean.getMessageContextRefKey(), bean);
+                       }
+               }
+
        }
 
        public boolean delete(String key) throws SandeshaStorageException {



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to