User: chirino 
  Date: 01/07/27 17:33:38

  Modified:    src/main/org/jbossmq/pm/logged PersistenceManager.java
                        PersistenceManagerMBean.java
  Log:
  Once again many changes.
  - The logic that handled the processing of queue and topic messages
   was seperated our more to make it easier to follow.
  - A QueuedTask class was created to avoid unneeded processing of queues.
  - The interface between the client-server-queues-peristence manager to handel
   DurableSubscription was too verbose, created a DurableSubscripton class and now
   SpyTopics can be inspected to see if they are being used as a DurableSubscription
  - The MBeans that add queues and topics makes it simpler to configure a queue/topic.
  
  Revision  Changes    Path
  1.2       +77 -71    jbossmq/src/main/org/jbossmq/pm/logged/PersistenceManager.java
  
  Index: PersistenceManager.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jbossmq/src/main/org/jbossmq/pm/logged/PersistenceManager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PersistenceManager.java   2001/07/11 02:52:17     1.1
  +++ PersistenceManager.java   2001/07/28 00:33:38     1.2
  @@ -32,7 +32,7 @@
    *
    *   @author Hiram Chirino ([EMAIL PROTECTED])
    *
  - *   @version $Revision: 1.1 $
  + *   @version $Revision: 1.2 $
    */
   public class PersistenceManager 
        extends ServiceMBeanSupport  
  @@ -49,12 +49,10 @@
        static class LogInfo {
                SpyMessageLog log;
                SpyDestination destination;
  -             String queueId;
   
  -             LogInfo(SpyMessageLog log, SpyDestination destination, String queueId) 
{
  +             LogInfo(SpyMessageLog log, SpyDestination destination) {
                        this.log=log;
                        this.destination=destination;
  -                     this.queueId=queueId;
                }
   
        }
  @@ -75,81 +73,14 @@
   
   
   
  -     public void initQueue( SpyDestination dest, String queueId ) throws 
javax.jms.JMSException {
   
  -             try {
  -
  -                     URL logFile = new URL(dataDirURL, 
dest.toString()+"-"+queueId+".dat");
  -                     SpyMessageLog log = new SpyMessageLog(logFile.getFile());
  -
  -                     LogInfo info = new LogInfo(log, dest, queueId);
  -
  -                     messageLogs.put(""+dest+"-"+queueId, info);
  -
  -             } catch (javax.jms.JMSException e) {
  -                     throw e;
  -             } catch (Exception e) {
  -                     javax.jms.JMSException newE = new 
javax.jms.JMSException("Invalid configuration.");
  -                     newE.setLinkedException(e);
  -                     throw newE;
  -             }
  -
  -     }
  -
  -     public void destroyQueue( SpyDestination dest, String queueId ) throws 
javax.jms.JMSException {
  -
  -             try {
  -
  -                     URL logFile = new URL(dataDirURL, 
dest.toString()+"-"+queueId+".dat");
  -                     java.io.File file = new java.io.File(logFile.getFile());
  -
  -                     SpyMessageLog log = 
(SpyMessageLog)messageLogs.remove(""+dest+"-"+queueId);
  -                     if( log == null )
  -                             throw new JMSException("The persistence log was never 
initialized");
  -                     log.close();
  -
  -                     file.delete();
  -
  -             } catch (javax.jms.JMSException e) {
  -                     throw e;
  -             } catch (Exception e) {
  -                     javax.jms.JMSException newE = new 
javax.jms.JMSException("Invalid configuration.");
  -                     newE.setLinkedException(e);
  -                     throw newE;
  -             }
  -
  -     }
  -
  -     public void add(String queueId, org.jbossmq.SpyMessage message, Long txId) 
throws javax.jms.JMSException {
  -
  -             LogInfo logInfo;
  -
  -             synchronized (messageLogs) {
  -                     logInfo = (LogInfo) 
messageLogs.get(""+message.getJMSDestination()+"-"+queueId);
  -             }
  -
  -             if (logInfo == null)
  -                     throw new javax.jms.JMSException("Destination was not 
initalized with the PersistenceManager");
   
  -             logInfo.log.add(message, txId);
   
  -     }
   
  -     public void remove(String queueId, org.jbossmq.SpyMessage message, Long txId) 
throws javax.jms.JMSException {
   
  -             LogInfo logInfo;
   
  -             synchronized (messageLogs) {
  -                     logInfo = (LogInfo) 
messageLogs.get(""+message.getJMSDestination()+"-"+queueId);
  -             }
   
  -             if (logInfo == null)
  -                     throw new javax.jms.JMSException("Destination was not 
initalized with the PersistenceManager");
   
  -             logInfo.log.remove(message, txId);
  -
  -     }
  -
        // The directory where persistence data should be stored
        URL dataDirURL;
        TxManager txManager;
  @@ -208,7 +139,7 @@
                        //TODO: make sure this lock is good enough
                        synchronized (q) {
                                for (int i = 0; i < rebuild.length; i++) {
  -                                     q.restoreMessage(rebuild[i], logInfo.queueId);
  +                                     q.restoreMessage(rebuild[i]);
                                }
                        }
                }
  @@ -229,5 +160,80 @@
                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 {
  +
  +             LogInfo logInfo;
  +
  +             synchronized (messageLogs) {
  +                     logInfo = (LogInfo) 
messageLogs.get(""+message.getJMSDestination());
  +             }
  +
  +             if (logInfo == null)
  +                     throw new javax.jms.JMSException("Destination was not 
initalized with the PersistenceManager");
  +
  +             logInfo.log.add(message, txId);
  +
  +     }
  +
  +     public void destroyQueue( SpyDestination dest) throws javax.jms.JMSException {
  +
  +             try {
  +
  +                     URL logFile = new URL(dataDirURL, dest.toString()+".dat");
  +                     java.io.File file = new java.io.File(logFile.getFile());
  +
  +                     SpyMessageLog log = (SpyMessageLog)messageLogs.remove(""+dest);
  +                     if( log == null )
  +                             throw new JMSException("The persistence log was never 
initialized");
  +                     log.close();
  +
  +                     file.delete();
  +
  +             } catch (javax.jms.JMSException e) {
  +                     throw e;
  +             } catch (Exception e) {
  +                     javax.jms.JMSException newE = new 
javax.jms.JMSException("Invalid configuration.");
  +                     newE.setLinkedException(e);
  +                     throw newE;
  +             }
  +
  +     }
  +
  +     public void initQueue( SpyDestination dest) throws javax.jms.JMSException {
  +
  +             try {
  +
  +                     URL logFile = new URL(dataDirURL, dest.toString()+".dat");
  +                     SpyMessageLog log = new SpyMessageLog(logFile.getFile());
  +
  +                     LogInfo info = new LogInfo(log, dest);
  +
  +                     messageLogs.put(""+dest, info);
  +
  +             } catch (javax.jms.JMSException e) {
  +                     throw e;
  +             } catch (Exception e) {
  +                     javax.jms.JMSException newE = new 
javax.jms.JMSException("Invalid configuration.");
  +                     newE.setLinkedException(e);
  +                     throw newE;
  +             }
  +
  +     }
  +
  +     public void remove(org.jbossmq.SpyMessage message, Long txId) throws 
javax.jms.JMSException {
  +
  +             LogInfo logInfo;
  +
  +             synchronized (messageLogs) {
  +                     logInfo = (LogInfo) 
messageLogs.get(""+message.getJMSDestination());
  +             }
  +
  +             if (logInfo == null)
  +                     throw new javax.jms.JMSException("Destination was not 
initalized with the PersistenceManager");
  +
  +             logInfo.log.remove(message, txId);
  +
        }
   }
  
  
  
  1.3       +1 -1      
jbossmq/src/main/org/jbossmq/pm/logged/PersistenceManagerMBean.java
  
  Index: PersistenceManagerMBean.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jbossmq/src/main/org/jbossmq/pm/logged/PersistenceManagerMBean.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PersistenceManagerMBean.java      2001/07/16 02:51:46     1.2
  +++ PersistenceManagerMBean.java      2001/07/28 00:33:38     1.3
  @@ -41,7 +41,7 @@
    *      
    *   @see <related>
    *   @author Vincent Sheffer ([EMAIL PROTECTED])
  - *   @version $Revision: 1.2 $
  + *   @version $Revision: 1.3 $
    */
   public interface PersistenceManagerMBean
      extends org.jboss.util.ServiceMBean
  @@ -61,4 +61,4 @@
      // Public --------------------------------------------------------
   public java.lang.String getDataDirectory();
   public void setDataDirectory(java.lang.String newDataDirectory);
  -}
  +}
  \ No newline at end of file
  
  
  

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

Reply via email to