[jboss-cvs] JBoss Messaging SVN: r2860 - trunk/src/main/org/jboss/messaging/core/impl.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Jul 9 17:23:49 EDT 2007


Author: clebert.suconic at jboss.com
Date: 2007-07-09 17:23:49 -0400 (Mon, 09 Jul 2007)
New Revision: 2860

Modified:
   trunk/src/main/org/jboss/messaging/core/impl/JDBCPersistenceManager.java
Log:
http://jira.jboss.com/jira/browse/JBMESSAGING-1010

Modified: trunk/src/main/org/jboss/messaging/core/impl/JDBCPersistenceManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/JDBCPersistenceManager.java	2007-07-09 15:35:01 UTC (rev 2859)
+++ trunk/src/main/org/jboss/messaging/core/impl/JDBCPersistenceManager.java	2007-07-09 21:23:49 UTC (rev 2860)
@@ -483,7 +483,7 @@
    // ===============================                 
    
    public void pageReferences(long channelID, List references, boolean paged) throws Exception
-   {  
+   {
       Connection conn = null;
       PreparedStatement psInsertReference = null;  
       PreparedStatement psInsertMessage = null;
@@ -507,13 +507,10 @@
          boolean messageInsertsInBatch = false;
          boolean messageUpdatesInBatch = false;
          
-         if (usingBatchUpdates)
-         {
-            psInsertReference = conn.prepareStatement(getSQLStatement("INSERT_MESSAGE_REF"));
-            psInsertMessage = conn.prepareStatement(getSQLStatement("INSERT_MESSAGE"));
-            psUpdateMessage = conn.prepareStatement(getSQLStatement("INC_CHANNEL_COUNT"));
-         }
-         
+         psInsertReference = conn.prepareStatement(getSQLStatement("INSERT_MESSAGE_REF"));
+         psInsertMessage = conn.prepareStatement(getSQLStatement("INSERT_MESSAGE"));
+         psUpdateMessage = conn.prepareStatement(getSQLStatement("INC_CHANNEL_COUNT"));
+
          while (iter.hasNext())
          {
             //We may need to persist the message itself 
@@ -521,11 +518,6 @@
                                             
             //For non reliable refs we insert the ref (and maybe the message) itself
                            
-            if (!usingBatchUpdates)
-            {
-               psInsertReference = conn.prepareStatement(getSQLStatement("INSERT_MESSAGE_REF"));
-            }
-            
             //Now store the reference
             addReference(channelID, ref, psInsertReference, paged);
                         
@@ -541,17 +533,8 @@
                {
                   log.trace("Inserted " + rows + " rows");
                }
-               
-               psInsertReference.close();
-               psInsertReference = null;
             }
             
-            if (!usingBatchUpdates)
-            {
-               psInsertMessage = conn.prepareStatement(getSQLStatement("INSERT_MESSAGE"));
-               psUpdateMessage = conn.prepareStatement(getSQLStatement("INC_CHANNEL_COUNT"));
-            }
-                                                                                     
             //Maybe we need to persist the message itself
             Message m = ref.getMessage();
             
@@ -633,10 +616,6 @@
                      log.trace("Updated " + rows + " rows");
                   }
                }
-               psInsertMessage.close();
-               psInsertMessage = null;
-               psUpdateMessage.close();
-               psUpdateMessage = null;
             }      
          }         
          
@@ -658,13 +637,6 @@
                
                if (trace) { logBatchUpdate(getSQLStatement("INC_CHANNEL_COUNT"), rowsMessage, "updated"); }
             }
-            
-            psInsertReference.close();
-            psInsertReference = null;
-            psInsertMessage.close();
-            psInsertMessage = null;
-            psUpdateMessage.close();
-            psUpdateMessage = null;
          }        
       }
       catch (Exception e)
@@ -712,22 +684,14 @@
          
          Iterator iter = references.iterator();
          
-         if (usingBatchUpdates)
-         {
-            psDeleteReference = conn.prepareStatement(getSQLStatement("DELETE_MESSAGE_REF"));
-            psDeleteMessage = conn.prepareStatement(getSQLStatement("DELETE_MESSAGE"));
-            psUpdateMessage = conn.prepareStatement(getSQLStatement("DEC_CHANNEL_COUNT"));
-         }
-         
+         psDeleteReference = conn.prepareStatement(getSQLStatement("DELETE_MESSAGE_REF"));
+         psDeleteMessage = conn.prepareStatement(getSQLStatement("DELETE_MESSAGE"));
+         psUpdateMessage = conn.prepareStatement(getSQLStatement("DEC_CHANNEL_COUNT"));
+
          while (iter.hasNext())
          {
             MessageReference ref = (MessageReference) iter.next();
                                                              
-            if (!usingBatchUpdates)
-            {
-               psDeleteReference = conn.prepareStatement(getSQLStatement("DELETE_MESSAGE_REF"));
-            }
-            
             removeReference(channelID, ref, psDeleteReference);
             
             if (usingBatchUpdates)
@@ -739,17 +703,8 @@
                int rows = updateWithRetry(psDeleteReference);
                
                if (trace) { log.trace("Deleted " + rows + " rows"); }
-               
-               psDeleteReference.close();
-               psDeleteReference = null;
             }
             
-            if (!usingBatchUpdates)
-            {
-               psDeleteMessage = conn.prepareStatement(getSQLStatement("DELETE_MESSAGE"));
-               psUpdateMessage = conn.prepareStatement(getSQLStatement("DEC_CHANNEL_COUNT"));
-            }
-               
             Message m = ref.getMessage();
                                     
             //Maybe we need to delete the message itself
@@ -776,11 +731,6 @@
                rows = updateWithRetry(psDeleteMessage);
         
                if (trace) { log.trace("Deleted " + rows + " rows"); }
-            
-               psDeleteMessage.close();
-               psDeleteMessage = null;
-               psUpdateMessage.close();
-               psUpdateMessage = null;
             }  
             
          }         
@@ -798,13 +748,6 @@
             rowsReference = updateWithRetryBatch(psDeleteMessage);
             
             if (trace) { logBatchUpdate(getSQLStatement("DELETE_MESSAGE"), rowsReference, "deleted"); }
-                                    
-            psDeleteReference.close();
-            psDeleteReference = null;
-            psDeleteMessage.close();
-            psDeleteMessage = null;
-            psUpdateMessage.close();
-            psUpdateMessage = null;
          }              
       }
       catch (Exception e)
@@ -1082,6 +1025,7 @@
    
    public void updatePageOrder(long channelID, List references) throws Exception
    {
+      log.info("updatePageOrder", new Exception());
       Connection conn = null;
       PreparedStatement psUpdateReference = null;  
       TransactionWrapper wrap = new TransactionWrapper();
@@ -1094,20 +1038,12 @@
          
          Iterator iter = references.iterator();
          
-         if (usingBatchUpdates)
-         {
-            psUpdateReference = conn.prepareStatement(getSQLStatement("UPDATE_PAGE_ORDER"));
-         }
-         
+         psUpdateReference = conn.prepareStatement(getSQLStatement("UPDATE_PAGE_ORDER"));
+
          while (iter.hasNext())
          {
             MessageReference ref = (MessageReference) iter.next();
                  
-            if (!usingBatchUpdates)
-            {
-               psUpdateReference = conn.prepareStatement(getSQLStatement("UPDATE_PAGE_ORDER"));
-            }
-            
             psUpdateReference.setLong(1, ref.getPagingOrder());
 
             psUpdateReference.setLong(2, ref.getMessage().getMessageID());
@@ -1123,9 +1059,6 @@
                int rows = updateWithRetry(psUpdateReference);
                
                if (trace) { log.trace("Updated " + rows + " rows"); }
-               
-               psUpdateReference.close();
-               psUpdateReference = null;
             }
          }
                      
@@ -1134,9 +1067,6 @@
             int[] rowsReference = updateWithRetryBatch(psUpdateReference);
             
             if (trace) { logBatchUpdate(getSQLStatement("UPDATE_PAGE_ORDER"), rowsReference, "updated"); }
-                        
-            psUpdateReference.close();
-            psUpdateReference = null;
          }
       }
       catch (Exception e)
@@ -1662,7 +1592,7 @@
             {
                psReference = conn.prepareStatement(getSQLStatement("INSERT_MESSAGE_REF"));
             }
-            
+
             // Now store the reference
             addReference(pair.channelID, ref, psReference, false);
               
@@ -1675,7 +1605,7 @@
                int rows = updateWithRetry(psReference);
                
                if (trace) { log.trace("Inserted " + rows + " rows"); }                              
-               
+
                psReference.close();
                psReference = null;
             }
@@ -1687,7 +1617,7 @@
                psInsertMessage = conn.prepareStatement(getSQLStatement("INSERT_MESSAGE"));
                psIncMessage = conn.prepareStatement(getSQLStatement("INC_CHANNEL_COUNT"));
             }
-                         
+
             boolean added;
             if (!m.isPersisted())
             {               
@@ -1758,7 +1688,7 @@
                int[] rowsMessage = updateWithRetryBatch(psIncMessage);
                if (trace) { logBatchUpdate(getSQLStatement("INC_CHANNEL_COUNT"), rowsMessage, "updated"); }
             }
-            
+
             psReference.close();
             psReference = null;
             psInsertMessage.close();
@@ -1766,7 +1696,7 @@
             psIncMessage.close();
             psIncMessage = null;
          }
-         
+
          // Now the removes
 
          psReference = null;
@@ -1789,7 +1719,7 @@
             {
                psReference = conn.prepareStatement(getSQLStatement("DELETE_MESSAGE_REF"));
             }
-            
+
             removeReference(pair.channelID, pair.ref, psReference);
             
             if (batch)
@@ -1809,7 +1739,7 @@
                psDeleteMessage = conn.prepareStatement(getSQLStatement("DELETE_MESSAGE"));
                psDecMessage = conn.prepareStatement(getSQLStatement("DEC_CHANNEL_COUNT"));
             }
-            
+
             Message m = pair.ref.getMessage();
                                 
             // Update the channel count
@@ -1837,7 +1767,7 @@
                psDeleteMessage = null;
                psDecMessage.close();
                psDecMessage = null;
-            }            
+            }
          }
          
          if (batch)
@@ -1862,7 +1792,7 @@
             psDeleteMessage = null;
             psDecMessage.close();
             psDecMessage = null;
-         }         
+         }
       }
       catch (Exception e)
       {
@@ -2067,7 +1997,7 @@
             psInsertMessage = conn.prepareStatement(getSQLStatement("INSERT_MESSAGE"));
             psUpdateMessage = conn.prepareStatement(getSQLStatement("INC_CHANNEL_COUNT"));
          }
-         
+
          while (iter.hasNext())
          {
             ChannelRefPair pair = (ChannelRefPair) iter.next();
@@ -2076,7 +2006,7 @@
             {
                psReference = conn.prepareStatement(getSQLStatement("INSERT_MESSAGE_REF"));
             }
-            
+
             prepareToAddReference(pair.channelID, pair.ref, tx, psReference);
             
             if (batch)
@@ -2088,7 +2018,7 @@
                int rows = updateWithRetry(psReference);
                
                if (trace) { log.trace("Inserted " + rows + " rows"); }
-               
+
                psReference.close();
                psReference = null;
             }
@@ -2098,7 +2028,7 @@
                psInsertMessage = conn.prepareStatement(getSQLStatement("INSERT_MESSAGE"));
                psUpdateMessage = conn.prepareStatement(getSQLStatement("INC_CHANNEL_COUNT"));
             }
-            
+
             Message m = pair.ref.getMessage();
                    
             boolean added;         
@@ -2172,7 +2102,7 @@
                
                if (trace) { logBatchUpdate(getSQLStatement("INC_CHANNEL_COUNT"), rowsMessage, "updated"); }
             }
-            
+
             psReference.close();
             psReference = null;
             psInsertMessage.close();




More information about the jboss-cvs-commits mailing list