[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jboss-cvs-commits
Subject:    [jboss-cvs] jboss-jms/src/main/org/jboss/jms/server/plugin   ...
From:       Ovidiu Feodorov <ovidiu.feodorov () jboss ! com>
Date:       2006-01-31 23:37:16
Message-ID: E1F453k-00021U-6Q () committer01 ! frg ! pub ! inap ! atl ! jboss ! com
[Download RAW message or body]

  User: ovidiu  
  Date: 06/01/31 18:37:16

  Modified:    src/main/org/jboss/jms/server/plugin  
                        DurableSubscriptionStoreSupport.java
                        JDBCDurableSubscriptionStore.java
  Log:
  - Clarified the distinction between destination undeployment/re-deployment and \
destination drop.  Added a test case that checks whether the current convention is \
enforced.  Currently, is not possible to drop destinations, they will be always \
"re-deployed" or "activated".  See http://jira.jboss.org/jira/browse/JBMESSAGING-220
  - Move various tests under the correct packages.
  
  Revision  Changes    Path
  1.13      +49 -12    \
jboss-jms/src/main/org/jboss/jms/server/plugin/DurableSubscriptionStoreSupport.java  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: DurableSubscriptionStoreSupport.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-jms/src/main/org/jboss/jms/server/plugin/DurableSubscriptionStoreSupport.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -b -r1.12 -r1.13
  --- DurableSubscriptionStoreSupport.java	31 Jan 2006 05:43:00 -0000	1.12
  +++ DurableSubscriptionStoreSupport.java	31 Jan 2006 23:37:16 -0000	1.13
  @@ -9,11 +9,12 @@
   import java.util.Map;
   import java.util.Collections;
   import java.util.Set;
  +import java.util.HashSet;
   
   import javax.jms.JMSException;
   
   import org.jboss.logging.Logger;
  -import org.jboss.messaging.core.local.DurableSubscription;
  +import org.jboss.messaging.core.local.CoreDurableSubscription;
   import org.jboss.messaging.core.local.Topic;
   import org.jboss.messaging.core.plugin.contract.TransactionLog;
   import org.jboss.messaging.core.plugin.contract.MessageStore;
  @@ -31,7 +32,7 @@
    * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
    * @author <a href="mailto:ovidiu@jboss.com">Ovidiu Feodorov</a>
    *
  - * $Id: DurableSubscriptionStoreSupport.java,v 1.12 2006/01/31 05:43:00 ovidiu Exp \
$  + * $Id: DurableSubscriptionStoreSupport.java,v 1.13 2006/01/31 23:37:16 ovidiu \
                Exp $
    */
   public abstract class DurableSubscriptionStoreSupport
      extends ServiceMBeanSupport implements DurableSubscriptionStore
  @@ -45,7 +46,7 @@
   
      // Attributes ----------------------------------------------------
   
  -   // Map<clientID - Map<subscriptionName - DurableSubscription>>
  +   // Map<clientID - Map<subscriptionName - CoreDurableSubscription>>
      protected Map subscriptions;
   
      // Constructors --------------------------------------------------
  @@ -69,7 +70,7 @@
   
      // DurableSubscriptionStore implementation ---------------
   
  -   public DurableSubscription createDurableSubscription(String topicName,
  +   public CoreDurableSubscription createDurableSubscription(String topicName,
                                                           String clientID,
                                                           String subscriptionName,
                                                           String selector,
  @@ -86,7 +87,7 @@
            subscriptions.put(clientID, subs);
         }
   
  -      DurableSubscription subscription =
  +      CoreDurableSubscription subscription =
            internalCreateDurableSubscription(clientID,
                                              subscriptionName,
                                              topicName,
  @@ -118,7 +119,7 @@
   
         if (log.isTraceEnabled()) { log.trace("removing durable subscription " + \
subscriptionName); }  
  -      DurableSubscription removed = \
(DurableSubscription)subs.remove(subscriptionName);  +      CoreDurableSubscription \
removed = (CoreDurableSubscription)subs.remove(subscriptionName);  
         if (subs.size() == 0)
         {
  @@ -128,19 +129,55 @@
         return removed != null;
      }
   
  +//   public void clearSubscriptionsForTopic(String topicName) throws JMSException
  +//   {
  +//      List toRemove = new ArrayList();
  +//      for(Iterator i = subscriptions.keySet().iterator(); i.hasNext(); )
  +//      {
  +//         String clientID = (String)i.next();
  +//         Map subs = (Map)subscriptions.get(clientID);
  +//         for(Iterator j = subs.keySet().iterator(); j.hasNext(); )
  +//         {
  +//            String name = (String)j.next();
  +//            CoreDurableSubscription ds = \
(CoreDurableSubscription)subs.get(name);  +//            if \
(ds.getTopic().getName().equals(topicName))  +//            {
  +//               toRemove.add(ds);
  +//            }
  +//         }
  +//
  +//         if (subs.keySet().size() == 0)
  +//         {
  +//            i.remove();
  +//         }
  +//      }
  +//
  +//      for(Iterator i = toRemove.iterator(); i.hasNext(); )
  +//      {
  +//         CoreDurableSubscription ds = (CoreDurableSubscription)i.next();
  +//         removeDurableSubscription(ds.getClientID(), ds.getName());
  +//      }
  +//
  +//      if (log.isTraceEnabled()) { log.trace(toRemove.size() + " durable \
subscription(s) removed for topic " + topicName); }  +//   }
  +
  +
      // JMX Managed Operations ----------------------------------------
   
      /**
       * @return a Set<String>. It may return an empty Set, but never null.
       */
  -   public Set listSubscriptions(String clientID)
  +   public Set getSubscriptions(String clientID)
      {
         Map m = (Map)subscriptions.get(clientID);
         if (m == null)
         {
            return Collections.EMPTY_SET;
         }
  -      return m.keySet();
  +      // concurrent keyset is not serializable
  +      Set result = new HashSet();
  +      result.addAll(m.keySet());
  +      return result;
      }
   
      // Public --------------------------------------------------------
  @@ -149,16 +186,16 @@
      
      // Protected -----------------------------------------------------
   
  -   protected DurableSubscription getDurableSubscription(String clientID,
  +   protected CoreDurableSubscription getDurableSubscription(String clientID,
                                                           String subscriptionName) \
throws JMSException  {
         Map subs = (Map)subscriptions.get(clientID);
  -      return subs == null ? null : \
(DurableSubscription)subs.get(subscriptionName);  +      return subs == null ? null : \
(CoreDurableSubscription)subs.get(subscriptionName);  }
   
      // Private -------------------------------------------------------
   
  -   private DurableSubscription internalCreateDurableSubscription(String clientID,
  +   private CoreDurableSubscription internalCreateDurableSubscription(String \
                clientID,
                                                                    String subName,
                                                                    String topicName,
                                                                    String selector,
  @@ -174,7 +211,7 @@
            throw new javax.jms.IllegalStateException("Topic " + topicName + " is not \
loaded");  }
   
  -      return new DurableSubscription(clientID, subName, topic, selector, noLocal, \
ms, tl);  +      return new CoreDurableSubscription(clientID, subName, topic, \
selector, noLocal, ms, tl);  }
   
      // Inner classes -------------------------------------------------
  
  
  
  1.12      +22 -8     \
jboss-jms/src/main/org/jboss/jms/server/plugin/JDBCDurableSubscriptionStore.java  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: JDBCDurableSubscriptionStore.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-jms/src/main/org/jboss/jms/server/plugin/JDBCDurableSubscriptionStore.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -b -r1.11 -r1.12
  --- JDBCDurableSubscriptionStore.java	31 Jan 2006 05:43:00 -0000	1.11
  +++ JDBCDurableSubscriptionStore.java	31 Jan 2006 23:37:16 -0000	1.12
  @@ -28,7 +28,7 @@
   import javax.transaction.TransactionManager;
   
   import org.jboss.logging.Logger;
  -import org.jboss.messaging.core.local.DurableSubscription;
  +import org.jboss.messaging.core.local.CoreDurableSubscription;
   import org.jboss.messaging.core.persistence.JDBCUtil;
   import org.jboss.messaging.core.plugin.contract.TransactionLog;
   import org.jboss.tm.TransactionManagerServiceMBean;
  @@ -41,7 +41,7 @@
    * @author <a href="mailto:adrian@jboss.org">Adrian Brock</a>
    * @author <a href="mailto:ivelin@jboss.org">Ivelin Ivanov</a>
    *
  - * $Id: JDBCDurableSubscriptionStore.java,v 1.11 2006/01/31 05:43:00 ovidiu Exp $
  + * $Id: JDBCDurableSubscriptionStore.java,v 1.12 2006/01/31 23:37:16 ovidiu Exp $
    */
   public class JDBCDurableSubscriptionStore extends DurableSubscriptionStoreSupport
   {
  @@ -140,7 +140,7 @@
         return this;
      }
   
  -   public DurableSubscription getDurableSubscription(String clientID, 
  +   public CoreDurableSubscription getDurableSubscription(String clientID,
                                                        String subscriptionName,
                                                        DestinationManager dm,
                                                        MessageStore ms,
  @@ -148,7 +148,7 @@
         throws JMSException
      {
         // Look in memory first
  -      DurableSubscription sub = super.getDurableSubscription(clientID, \
subscriptionName);  +      CoreDurableSubscription sub = \
super.getDurableSubscription(clientID, subscriptionName);  
         if (sub != null)
         {
  @@ -237,7 +237,7 @@
   
      }
   
  -   public DurableSubscription createDurableSubscription(String topicName, 
  +   public CoreDurableSubscription createDurableSubscription(String topicName,
                                                           String clientID,
                                                           String subscriptionName, 
                                                           String selector, 
  @@ -269,7 +269,7 @@
               ps.executeUpdate();
   
               // create it in memory too
  -            DurableSubscription sub = super.createDurableSubscription(topicName,
  +            CoreDurableSubscription sub = \
                super.createDurableSubscription(topicName,
                                                                         clientID,
                                                                         \
                subscriptionName,
                                                                         selector,
  @@ -318,12 +318,15 @@
      public boolean removeDurableSubscription(String clientID, String \
subscriptionName)  throws JMSException
      {
  +      if (log.isTraceEnabled()) { log.trace("removing durable subscription " + \
subscriptionName); }  +
         try
         {
   
            Connection conn = null;
            PreparedStatement ps  = null;
            TransactionWrapper wrap = new TransactionWrapper();
  +         int rows = -1;
   
            try
            {
  @@ -335,7 +338,7 @@
   
               ps.setString(2, subscriptionName);
   
  -            int rows = ps.executeUpdate();
  +            rows = ps.executeUpdate();
   
               if (rows == 1)
               {
  @@ -354,6 +357,12 @@
            }
            finally
            {
  +            if (log.isTraceEnabled())
  +            {
  +               String s = JDBCUtil.statementToString(deleteSubscription, clientID, \
subscriptionName);  +               log.trace(s + (rows == -1 ? " failed!" : " \
deleted " + rows + " rows"));  +            }
  +
               if (ps != null)
               {
                  ps.close();
  @@ -524,7 +533,7 @@
            String selector = (String)subData[2];
            boolean noLocal = ((Boolean)subData[3]).booleanValue();
   
  -         DurableSubscription sub = super.getDurableSubscription(clientID, \
subName);  +         CoreDurableSubscription sub = \
super.getDurableSubscription(clientID, subName);  
            if (sub == null)
            {
  @@ -624,6 +633,11 @@
         return tmObjectName;
      }
   
  +   public String toString()
  +   {
  +      return "JDBCDurableSubscriptionStore[" + Integer.toHexString(hashCode()) + \
"]";  +   }
  +
      // Package protected ---------------------------------------------
      
      // Protected -----------------------------------------------------
  
  
  


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
jboss-cvs-commits mailing list
jboss-cvs-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-cvs-commits


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic