User: pkendall
  Date: 01/08/08 18:18:28

  Modified:    src/main/org/jbossmq/pm/jdbc MessageLog.java
                        PersistenceManager.java TxLog.java
  Log:
  Major updates (especially to topics).
  Speed improvements.
  Make JVM IL work (by using a singleton JMSServer).
  Message Listeners re-implemented using client-side thread.
  
  Revision  Changes    Path
  1.3       +12 -11    jbossmq/src/main/org/jbossmq/pm/jdbc/MessageLog.java
  
  Index: MessageLog.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbossmq/src/main/org/jbossmq/pm/jdbc/MessageLog.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MessageLog.java   2001/07/28 00:33:38     1.2
  +++ MessageLog.java   2001/08/09 01:18:28     1.3
  @@ -21,13 +21,14 @@
   
   import org.jbossmq.SpyMessage;
   import org.jbossmq.SpyDestination;
  +import org.jbossmq.SpyJMSException;
   
   /**
    * This is used to keep SpyMessages on the disk and is used reconstruct the
    * queue in case of provider failure.
    *
    * @author: Jayesh Parayali ([EMAIL PROTECTED])
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    */
   public class MessageLog {
   
  @@ -37,16 +38,16 @@
     //private File queueName;
     protected static DataSource datasource;
   
  -    
   
   
  +
     /////////////////////////////////////////////////////////////////////
     // Public Methods
     /////////////////////////////////////////////////////////////////////
     public void close() throws JMSException {
  -  }      
  +  }
   
  -  public void add( SpyMessage message, Long transactionId ) throws JMSException {
  +  public void add( SpyMessage message, org.jbossmq.pm.Tx transactionId ) throws 
JMSException {
        PreparedStatement pstmt = null;
        Connection con = null;
   
  @@ -89,9 +90,9 @@
          }
   
        }
  -  }      
  +  }
   
  -  public void remove( SpyMessage message, Long transactionId ) throws JMSException {
  +  public void remove( SpyMessage message, org.jbossmq.pm.Tx transactionId ) throws 
JMSException {
        PreparedStatement pstmt = null;
        Connection con = null;
        try{
  @@ -122,7 +123,7 @@
          }
   
        }
  -  }      
  +  }
   
     public SpyMessage[] restore(java.util.TreeSet comittingTXs, String dest) throws 
JMSException {
        String destin = dest.substring(21,dest.length());
  @@ -182,13 +183,13 @@
        for( int i=0; iter.hasNext(); i++ )
          rc[i] = (SpyMessage)iter.next();
        return rc;
  -  }        
  +  }
   
     private void throwJMSException(String message, Exception e) throws JMSException {
  -     JMSException newE = new JMSException(message);
  +     JMSException newE = new SpyJMSException(message);
        newE.setLinkedException(e);
        throw newE;
  -  }      
  +  }
   
     /////////////////////////////////////////////////////////////////////
     // Constructor
  @@ -196,5 +197,5 @@
     public MessageLog(DataSource datasource, String dest) throws JMSException {
           if (this.datasource == null)
                 this.datasource = datasource;
  -  }    
  +  }
   }
  
  
  
  1.3       +26 -26    jbossmq/src/main/org/jbossmq/pm/jdbc/PersistenceManager.java
  
  Index: PersistenceManager.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jbossmq/src/main/org/jbossmq/pm/jdbc/PersistenceManager.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PersistenceManager.java   2001/07/28 00:33:38     1.2
  +++ PersistenceManager.java   2001/08/09 01:18:28     1.3
  @@ -26,8 +26,8 @@
   import org.jbossmq.server.JMSDestination;
   import org.jbossmq.SpyMessage;
   import org.jbossmq.SpyDestination;
  +import org.jbossmq.SpyJMSException;
   
  -
   import org.jboss.util.ServiceMBeanSupport;
   import org.jbossmq.ConnectionToken;
   import javax.naming.InitialContext;
  @@ -40,9 +40,9 @@
    *
    * @author: Jayesh Parayali ([EMAIL PROTECTED])
    *
  - *  @version $Revision: 1.2 $
  + *  @version $Revision: 1.3 $
    */
  -public class PersistenceManager extends ServiceMBeanSupport  
  +public class PersistenceManager extends ServiceMBeanSupport
        implements org.jbossmq.pm.PersistenceManager, PersistenceManagerMBean, 
MBeanRegistration {
   
   
  @@ -73,15 +73,15 @@
   
   
   
  -  public Long createPersistentTx() throws javax.jms.JMSException {
  -     Long txId = txLog.createTx();
  +  public org.jbossmq.pm.Tx createPersistentTx() throws javax.jms.JMSException {
  +     org.jbossmq.pm.Tx txId = txLog.createTx();
        synchronized (transactedTasks) {
          transactedTasks.put(txId, new LinkedList());
        }
        return txId;
  -  }      
  +  }
   
  -  public void commitPersistentTx(Long txId) throws javax.jms.JMSException {
  +  public void commitPersistentTx(org.jbossmq.pm.Tx txId) throws 
javax.jms.JMSException {
   
        LinkedList transacted;
        synchronized (transactedTasks) {
  @@ -96,9 +96,9 @@
        }
   
        txLog.commitTx(txId);
  -  }      
  +  }
   
  -  public void rollbackPersistentTx(Long txId) throws javax.jms.JMSException {
  +  public void rollbackPersistentTx(org.jbossmq.pm.Tx txId) throws 
javax.jms.JMSException {
   
        LinkedList transacted;
        synchronized(transactedTasks){
  @@ -113,22 +113,22 @@
        }
   
        txLog.rollbackTx(txId);
  -  }      
  +  }
  +
  +
  +
   
  -    
   
  -    
   
  -    
   
  -    
   
  +
     class Transaction {
        private LogInfo logInfo;
        private SpyMessage message;
  -     private Long txId;
  +     private org.jbossmq.pm.Tx txId;
        private boolean add;
  -     public Transaction(boolean add, LogInfo logInfo, SpyMessage message, Long 
txId) {
  +     public Transaction(boolean add, LogInfo logInfo, SpyMessage message, 
org.jbossmq.pm.Tx txId) {
          this.add = add;
          this.logInfo = logInfo;
          this.message = message;
  @@ -174,7 +174,7 @@
            datasource= (DataSource) ctx.lookup(jmsDBPoolName);
            txLog= new TxLog(datasource);
   
  -             JMSServer server = (JMSServer)getServer().invoke(new 
ObjectName(org.jbossmq.server.JBossMQServiceMBean.OBJECT_NAME), "getJMSServer", new 
Object[] {}, new String[] {} );                
  +             JMSServer server = (JMSServer)getServer().invoke(new 
ObjectName(org.jbossmq.server.JBossMQServiceMBean.OBJECT_NAME), "getJMSServer", new 
Object[] {}, new String[] {} );
                server.setPersistenceManager(this);
   
        }
  @@ -204,7 +204,7 @@
          }
        }
   
  -  }          
  +  }
   
   /**
    * Insert the method's description here.
  @@ -217,12 +217,12 @@
   
        public void startService() throws Exception {
   
  -             JMSServer server = (JMSServer)getServer().invoke(new 
ObjectName(org.jbossmq.server.JBossMQServiceMBean.OBJECT_NAME), "getJMSServer", new 
Object[] {}, new String[] {} );                
  +             JMSServer server = (JMSServer)getServer().invoke(new 
ObjectName(org.jbossmq.server.JBossMQServiceMBean.OBJECT_NAME), "getJMSServer", new 
Object[] {}, new String[] {} );
                restore(server);
   
        }
   
  -  public void add(org.jbossmq.SpyMessage message, Long txId) throws 
javax.jms.JMSException {
  +  public void add(org.jbossmq.SpyMessage message, org.jbossmq.pm.Tx txId) throws 
javax.jms.JMSException {
        LogInfo logInfo;
   
        synchronized (messageLogs) {
  @@ -246,7 +246,7 @@
          }
        }
   
  -  }    
  +  }
   
     public void destroyQueue( SpyDestination dest ) throws javax.jms.JMSException {
   
  @@ -260,7 +260,7 @@
                logInfo = (LogInfo)messageLogs.remove(""+dest);
          }
          if( logInfo == null )
  -             throw new JMSException("The persistence log was never initialized");
  +             throw new SpyJMSException("The persistence log was never initialized");
   
          logInfo.log.close();
          //file.delete();
  @@ -273,7 +273,7 @@
          throw newE;
        }
   
  -  }    
  +  }
   
     public void initQueue( SpyDestination dest) throws javax.jms.JMSException {
        try {
  @@ -295,9 +295,9 @@
          throw newE;
        }
   
  -  }        
  +  }
   
  -  public void remove(org.jbossmq.SpyMessage message, Long txId) throws 
javax.jms.JMSException {
  +  public void remove(org.jbossmq.SpyMessage message, org.jbossmq.pm.Tx txId) throws 
javax.jms.JMSException {
        LogInfo logInfo;
   
        synchronized (messageLogs) {
  @@ -321,5 +321,5 @@
          }
        }
   
  -  }    
  +  }
   }
  
  
  
  1.3       +15 -13    jbossmq/src/main/org/jbossmq/pm/jdbc/TxLog.java
  
  Index: TxLog.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbossmq/src/main/org/jbossmq/pm/jdbc/TxLog.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TxLog.java        2001/07/28 00:33:38     1.2
  +++ TxLog.java        2001/08/09 01:18:28     1.3
  @@ -6,6 +6,8 @@
    */
   package org.jbossmq.pm.jdbc;
   
  +import org.jbossmq.SpyJMSException;
  +
   import java.io.Serializable;
   import java.io.IOException;
   import java.io.RandomAccessFile;
  @@ -22,7 +24,7 @@
    * It is used to rollback transactions when the system restarts.
    *
    * @author: Jayesh Parayali ([EMAIL PROTECTED])
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    */
   public class TxLog {
   
  @@ -38,14 +40,14 @@
     public TxLog(DataSource datasource) throws JMSException {
                  if (ds == null)
                ds = datasource;
  -  }      
  +  }
   
     private final Connection getConnection() throws SQLException {
        return ds.getConnection();
  -  }      
  +  }
   
  -  synchronized public Long createTx() throws JMSException {
  -     Long id = new Long(nextTransactionId++);
  +  synchronized public org.jbossmq.pm.Tx createTx() throws JMSException {
  +     org.jbossmq.pm.Tx id = new org.jbossmq.pm.Tx(nextTransactionId++);
        Connection con = null;
        PreparedStatement stmt = null;
        try {
  @@ -74,9 +76,9 @@
                throwJMSException("Could not close database connection in transaction 
log (createTx).",e);
          }
        return id;
  -  }      
  +  }
   
  -  synchronized public void commitTx(Long txId) throws JMSException {
  +  synchronized public void commitTx(org.jbossmq.pm.Tx txId) throws JMSException {
        Connection con = null;
        PreparedStatement stmt = null;
        try {
  @@ -104,9 +106,9 @@
          catch(SQLException e) {
                throwJMSException("Could not close database connection in transaction 
log (commitTx)",e);
          }
  -  }      
  +  }
   
  -  synchronized public void rollbackTx(Long txId) throws JMSException {
  +  synchronized public void rollbackTx(org.jbossmq.pm.Tx txId) throws JMSException {
        Connection con = null;
        PreparedStatement stmt = null;
        try {
  @@ -134,7 +136,7 @@
          catch(SQLException e) {
                throwJMSException("Could not close database connection in transaction 
log (rollbackTx)",e);
          }
  -  }      
  +  }
   
     synchronized public java.util.TreeSet restore() throws JMSException {
        TreeSet items = new TreeSet();;
  @@ -167,15 +169,15 @@
        }
   
        return items;
  -  }      
  +  }
   
     /////////////////////////////////////////////////////////////////////
     // Private Methods
     /////////////////////////////////////////////////////////////////////
     private void throwJMSException(String message, Exception e) throws JMSException {
  -     JMSException newE = new JMSException(message);
  +     JMSException newE = new SpyJMSException(message);
        newE.setLinkedException(e);
        throw newE;
  -  }      
  +  }
   
   }
  
  
  

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

Reply via email to