Patches item #651469, was opened at 2002-12-10 16:17
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376687&aid=651469&group_id=22866

Category: JBossMQ
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Ulf Schroeter (schrouf)
Assigned to: Nobody/Anonymous (nobody)
Summary: Fix for JMS duplicate message error

Initial Comment:
JMS queue restore on server startup fails in case of high 
message count  with JMS duplicate message error 
when using JDBC2 persistence manager.
 
This patch is related to patch #588620

Reason:

Within the message restore loop of JDBC2 
PersistenceManager.restoreQueue() every message is 
added to the MessageCache with MessageCache.add().
A new MessageReference is created with isStored=false 
and persistData=null and added to the MessageCache. 
In case of high memory load the call
 to MessageCache.validateSoftReferenceDepth()  leads 
to a call of MessageCache.makeSoft(), which in turn 
calls MessageCache.saveToStorage() 
with a MessageReference with attributes isStored=false 
and persistData=null. This leads to an SQL INSERT 
attempt within the JDBC2 PersistenceManager
for a persistent message that is already stored within 
the database ( and has just been restored by the JDBC2 
persistence manager ).

Patch:

(1) Add additional MessageCache.add() method second 
with parameter for specifying PM persistData 


public MessageReference add(SpyMessage message, 
Object persistData) throws javax.jms.JMSException
   {
      boolean trace = log.isTraceEnabled();
      if (trace)
         log.trace("add lock aquire");
      
      MessageReference mh = null;
      synchronized (this)
      {
         mh = new MessageReference();
         mh.init(this, messageCounter++, message);
         
         mh.setStored( persistData );
         
         lruCache.addMostRecent(mh);
         totalCacheSize++;
         validateSoftReferenceDepth();
  
         if(trace)
            log.trace("add lock release");

      }

      return mh;
   }


(2) In JDBC2.PersistenceManager.restoreQueue() ( 
maybe also in the file based persistence mangers ? ) 
call new MessageCache.add() method

replace original code

MessageReference mr = messageCache.add(message);
mr.setStored(((SpyDestination) 
message.getJMSDestination()).toString());


with 

MessageReference mr = messageCache.add(message, 
((SpyDestination) message.getJMSDestination
()).toString());
 

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376687&aid=651469&group_id=22866


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to