Package org.jboss.messaging.core.contract

Examples of org.jboss.messaging.core.contract.PostOffice


      // If this is a consumer of a non durable subscription then we want to unbind the
      // subscription and delete all its data.

      if (destination.isTopic())
      {
         PostOffice postOffice = sessionEndpoint.getConnectionEndpoint().getServerPeer().getPostOfficeInstance();
                 
         ServerPeer sp = sessionEndpoint.getConnectionEndpoint().getServerPeer();
        
         Queue queue = postOffice.getBindingForQueueName(queueName).queue;       
        
         ManagedDestination mDest = sp.getDestinationManager().getDestination(destination.getName(), false);
        
         if (!queue.isRecoverable())
         {
            postOffice.removeBinding(queueName, false);           

            if (!mDest.isTemporary())
            {
              String counterName = TopicService.SUBSCRIPTION_MESSAGECOUNTER_PREFIX + queueName;
 
              MessageCounter counter = sp.getMessageCounterManager().unregisterMessageCounter(counterName);
 
              if (counter == null)
              {
                 throw new IllegalStateException("Cannot find counter to remove " + counterName);
              }
            }
         }
         else
         {
           //Durable sub consumer
          
           if (queue.isClustered() && postOffice.isClustered())
            {
              //Clustered durable sub consumer created - we need to remove this info from the replicator
             
              Replicator rep = (Replicator)postOffice;
             
View Full Code Here


   {
      super.startService();
     
      try
      {
         PostOffice po = serverPeer.getPostOfficeInstance();
               
         // We deploy any queues corresponding to pre-existing durable subscriptions

         Collection queues = po.getQueuesForCondition(new JMSCondition(false, destination.getName()), true);
       
         Iterator iter = queues.iterator();
         while (iter.hasNext())
         {
            Queue queue = (Queue)iter.next();
           
            boolean actuallyClustered = po.isClustered() && destination.isClustered();
           
            if (actuallyClustered != queue.isClustered())
           {
             throw new IllegalArgumentException("Topic " + destination.getName() + " is already deployed as clustered = " +
                                              queue.isClustered() + " so cannot redeploy as clustered=" + destination.isClustered() +
View Full Code Here

         //from memory
        
         //First we remove any data for a non durable sub - a non durable sub might have data in the
         //database since it might have paged
        
         PostOffice po = serverPeer.getPostOfficeInstance();
                 
         Collection queues = serverPeer.getPostOfficeInstance().getQueuesForCondition(new JMSCondition(false, destination.getName()), true);
       
         Iterator iter = queues.iterator();
        
         while (iter.hasNext())           
         {
            Queue queue = (Queue)iter.next();
           
            if (!queue.isRecoverable())
            {
               // Unbind
               po.removeBinding(queue.getName(), false);
            }
                       
            queue.deactivate();
           
            queue.unload();
View Full Code Here

    * @throws Exception if  the post office can't be reached.
    */
   private void setMaxSizeForQueues() throws Exception
   {
     Condition cond = new JMSCondition(isQueue(), this.getName());       
     PostOffice postOffice = serverPeer.getPostOfficeInstance();       
     Collection subs = postOffice.getQueuesForCondition(cond, true);       
     Iterator iter = subs.iterator();
     while (iter.hasNext())
     {
        Queue queue = (Queue)iter.next();          
        queue.setMaxSize(this.getMaxSize());
View Full Code Here

      {                          
         // Binding must be added before destination is registered in JNDI otherwise the user could
         // get a reference to the destination and use it while it is still being loaded. Also,
         // binding might already exist.
          
         PostOffice po = serverPeer.getPostOfficeInstance();
                          
         Binding binding = po.getBindingForQueueName(destination.getName());
        
         Queue queue;
        
         if (binding != null)
         {                    
           queue = binding.queue;
          
           if (queue.isActive())
           {
             throw new IllegalStateException("Cannot deploy queue " + destination.getName() + " it is already deployed");
           }
          
           //Sanity check - currently it is not possible to change the clustered attribute of a destination
           //See http://jira.jboss.org/jira/browse/JBMESSAGING-1235
          
           boolean actuallyClustered = po.isClustered() && destination.isClustered();
          
           if (actuallyClustered != queue.isClustered())
           {
             throw new IllegalArgumentException("Queue " + destination.getName() + " is already deployed as clustered = " +
                                              queue.isClustered() + " so cannot redeploy as clustered=" + destination.isClustered() +
                                              " . You must delete the destination first before redeploying");
            
           }
          
            queue.setPagingParams(destination.getFullSize(),
                                  destination.getPageSize(),
                                  destination.getDownCacheSize())
           
            queue.load();
              
            // Must be done after load
            queue.setMaxSize(destination.getMaxSize());
           
            queue.activate();          
         }
         else
         {          
            // Create a new queue

            JMSCondition queueCond = new JMSCondition(true, destination.getName());
           
            queue = new MessagingQueue(nodeId, destination.getName(),
                                     serverPeer.getChannelIDManager().getID(),
                                       serverPeer.getMessageStore(), serverPeer.getPersistenceManagerInstance(),
                                       true,
                                       destination.getMaxSize(), null,
                                       destination.getFullSize(), destination.getPageSize(),
                                       destination.getDownCacheSize(), destination.isClustered(),
                                       serverPeer.getRecoverDeliveriesTimeout());
            po.addBinding(new Binding(queueCond, queue, false), false);        
           
            queue.activate();
         }
        
         ((ManagedQueue)destination).setQueue(queue);
View Full Code Here

      // If this is a consumer of a non durable subscription then we want to unbind the
      // subscription and delete all its data.

      if (destination.isTopic())
      {
         PostOffice postOffice = sessionEndpoint.getConnectionEndpoint().getServerPeer().getPostOfficeInstance();
                 
         ServerPeer sp = sessionEndpoint.getConnectionEndpoint().getServerPeer();
        
         Queue queue = postOffice.getBindingForQueueName(queueName).queue;       
        
         ManagedDestination mDest = sp.getDestinationManager().getDestination(destination.getName(), false);
        
         if (!queue.isRecoverable())
         {
            postOffice.removeBinding(queueName, false);           

            if (!mDest.isTemporary())
            {
              String counterName = TopicService.SUBSCRIPTION_MESSAGECOUNTER_PREFIX + queueName;
 
              MessageCounter counter = sp.getMessageCounterManager().unregisterMessageCounter(counterName);
 
              if (counter == null)
              {
                 throw new IllegalStateException("Cannot find counter to remove " + counterName);
              }
            }
         }
         else
         {
           //Durable sub consumer
          
           if (queue.isClustered() && postOffice.isClustered())
            {
              //Clustered durable sub consumer created - we need to remove this info from the replicator
             
              Replicator rep = (Replicator)postOffice;
             
View Full Code Here

   {
      super.startService();
     
      try
      {
         PostOffice po = serverPeer.getPostOfficeInstance();
               
         // We deploy any queues corresponding to pre-existing durable subscriptions

         Collection queues = po.getQueuesForCondition(new JMSCondition(false, destination.getName()), true);
       
         Iterator iter = queues.iterator();
         while (iter.hasNext())
         {
            Queue queue = (Queue)iter.next();
View Full Code Here

         //from memory
        
         //First we remove any data for a non durable sub - a non durable sub might have data in the
         //database since it might have paged
        
         PostOffice po = serverPeer.getPostOfficeInstance();
                 
         Collection queues = serverPeer.getPostOfficeInstance().getQueuesForCondition(new JMSCondition(false, destination.getName()), true);
       
         Iterator iter = queues.iterator();
        
         while (iter.hasNext())           
         {
            Queue queue = (Queue)iter.next();
           
            if (!queue.isRecoverable())
            {
               // Unbind
               po.removeBinding(queue.getName(), false);
            }
                       
            queue.deactivate();
           
            queue.unload();
View Full Code Here

      {                          
         // Binding must be added before destination is registered in JNDI otherwise the user could
         // get a reference to the destination and use it while it is still being loaded. Also,
         // binding might already exist.
          
         PostOffice po = serverPeer.getPostOfficeInstance();
                          
         Binding binding = po.getBindingForQueueName(destination.getName());
        
         Queue queue;
        
         if (binding != null)
         {                    
           queue = binding.queue;
          
           if (queue.isActive())
           {
             throw new IllegalStateException("Cannot deploy queue " + destination.getName() + " it is already deployed");
           }
          
            queue.setPagingParams(destination.getFullSize(),
                                  destination.getPageSize(),
                                  destination.getDownCacheSize())
           
            queue.load();
              
            // Must be done after load
            queue.setMaxSize(destination.getMaxSize());
           
            queue.activate();          
         }
         else
         {          
            // Create a new queue

            JMSCondition queueCond = new JMSCondition(true, destination.getName());
           
            queue = new MessagingQueue(nodeId, destination.getName(),
                                     serverPeer.getChannelIDManager().getID(),
                                       serverPeer.getMessageStore(), serverPeer.getPersistenceManagerInstance(),
                                       true,
                                       destination.getMaxSize(), null,
                                       destination.getFullSize(), destination.getPageSize(),
                                       destination.getDownCacheSize(), destination.isClustered(),
                                       serverPeer.getRecoverDeliveriesTimeout());
            po.addBinding(new Binding(queueCond, queue, false), false);        
           
            queue.activate();
         }
        
         ((ManagedQueue)destination).setQueue(queue);
View Full Code Here

      // If this is a consumer of a non durable subscription then we want to unbind the
      // subscription and delete all its data.

      if (destination.isTopic())
      {
         PostOffice postOffice = sessionEndpoint.getConnectionEndpoint().getServerPeer().getPostOfficeInstance();
                 
         ServerPeer sp = sessionEndpoint.getConnectionEndpoint().getServerPeer();
        
         Queue queue = postOffice.getBindingForQueueName(queueName).queue;       
        
         ManagedDestination mDest = sp.getDestinationManager().getDestination(destination.getName(), false);
        
         if (!queue.isRecoverable())
         {
            postOffice.removeBinding(queueName, false);           

            if (!mDest.isTemporary())
            {
              String counterName = TopicService.SUBSCRIPTION_MESSAGECOUNTER_PREFIX + queueName;
 
              MessageCounter counter = sp.getMessageCounterManager().unregisterMessageCounter(counterName);
 
              if (counter == null)
              {
                 throw new IllegalStateException("Cannot find counter to remove " + counterName);
              }
            }
         }
         else
         {
           //Durable sub consumer
          
           if (queue.isClustered() && postOffice.isClustered())
            {
              //Clustered durable sub consumer created - we need to remove this info from the replicator
             
              Replicator rep = (Replicator)postOffice;
             
View Full Code Here

TOP

Related Classes of org.jboss.messaging.core.contract.PostOffice

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.