User: pkendall
  Date: 01/05/17 00:50:22

  Modified:    src/main/org/jbossmq/server JMSServer.java
  Log:
  Fix synchronization issues with messageQueue map.
  throw TransactionRolledBackException when rollback called in commit.
  
  Revision  Changes    Path
  1.6       +28 -7     jbossmq/src/main/org/jbossmq/server/JMSServer.java
  
  Index: JMSServer.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbossmq/src/main/org/jbossmq/server/JMSServer.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- JMSServer.java    2001/03/14 21:36:54     1.5
  +++ JMSServer.java    2001/05/17 07:50:22     1.6
  @@ -7,6 +7,7 @@
   package org.jbossmq.server;
   
   import javax.jms.JMSException;
  +import javax.jms.TransactionRolledBackException;
   import javax.jms.Destination;
   import javax.jms.TemporaryTopic;
   import javax.jms.TemporaryQueue;
  @@ -32,7 +33,7 @@
    *   @author Norbert Lataille ([EMAIL PROTECTED])
    *   @author Hiram Chirino ([EMAIL PROTECTED])
    * 
  - *   @version $Revision: 1.5 $
  + *   @version $Revision: 1.6 $
    */
   public class JMSServer 
                implements Runnable, JMSServerMBean
  @@ -200,7 +201,11 @@
                }
                catch(Exception e){
                  //remove the topic from the messageQueue
  -               messageQueue.remove(newTopic);
  +               synchronized (messageQueue) {
  +                 HashMap newMap=(HashMap)messageQueue.clone();
  +                 newMap.remove(newTopic);    
  +                 messageQueue=newMap;
  +               }
                  throw new JMSException("Exception binding Topic to the JNDI topic 
context: "+e);
                }
   
  @@ -233,7 +238,11 @@
                }
                catch(Exception ioe){
                  //remove the topic from the messageQueue
  -               messageQueue.remove(newTopic);
  +               synchronized (messageQueue) {
  +                 HashMap newMap=(HashMap)messageQueue.clone();
  +                 newMap.remove(newTopic);    
  +                 messageQueue=newMap;
  +               }
                  //remove the topic from the jndi topic context
                  try{
                    subcontext.unbind(name);
  @@ -342,7 +351,11 @@
                }
                catch(Exception e){
                  //remove the queue from the messageQueue
  -               messageQueue.remove(newQueue);
  +               synchronized (messageQueue) {
  +                 HashMap newMap=(HashMap)messageQueue.clone();
  +                 newMap.remove(newQueue);
  +                 messageQueue=newMap;
  +               }
                  throw new JMSException("Exception binding Queue to the JNDI queue 
context: "+e);
                }
                
  @@ -376,7 +389,11 @@
                }
                catch(Exception ioe){
                  //remove the queue from the messageQueue
  -               messageQueue.remove(newQueue);
  +               synchronized (messageQueue) {
  +                 HashMap newMap=(HashMap)messageQueue.clone();
  +                 newMap.remove(newQueue);
  +                 messageQueue=newMap;
  +               }
                  //remove the queue from the jndi queue context
                  try{
                    subcontext.unbind(name);
  @@ -560,7 +577,9 @@
                                
                        } catch ( JMSException e ) {
                                persistenceManager.rollbackTx(txId);
  -                             throw e;
  +                             TransactionRolledBackException newE = new 
TransactionRolledBackException("Transaction was rolled back.");
  +                             newE.setLinkedException(e);
  +                             throw newE;
                        }
                } else if ( t.requestType == t.TWO_PHASE_COMMIT_PREPARE_REQUEST) {
                        
  @@ -581,7 +600,9 @@
                                
                        } catch ( JMSException e ) {
                                persistenceManager.rollbackTx(txId);
  -                             throw e;
  +                             TransactionRolledBackException newE = new 
TransactionRolledBackException("Transaction was rolled back.");
  +                             newE.setLinkedException(e);
  +                             throw newE;
                        }
                } else if ( t.requestType == t.TWO_PHASE_COMMIT_ROLLBACK_REQUEST ) {
   
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to