Package org.jboss.messaging.core.contract

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


      // Need to lookup the local queue

      Binding binding = this.postOffice.getBindingForQueueName(queueName);

      Queue localQueue = binding.queue;
     
      if (localQueue.isClustered())
      {       
         //Find channel id for remote queue - we need this for doing shared DB optimisation
         Collection coll = this.postOffice.getAllBindingsForQueueName(queueName);
         Iterator iter = coll.iterator();
         long sourceChannelID = -1;
View Full Code Here


     
      //Find a local queue if any
     
      Iterator iter2 = queues.iterator();
     
      Queue localQueue = null;
     
      while (iter2.hasNext())
      {
        Queue queue = (Queue)iter2.next();
       
        if (queue.getNodeID() == this.nodeID)
        {
          localQueue = queue;
         
          break;
        }
      }
     
      if (localQueue != null)
      {
        iter2 = queues.iterator();
       
        while (iter2.hasNext())
        {
          Queue queue = (Queue)iter2.next();
         
          if (queue.getNodeID() != this.nodeID && queue.isClustered())
          {
            //Now we have found a local and remote with matching names - so we can create a sucker
                                   
            createSucker(queueName, queue.getNodeID());
          }
        }
      }         
    }
  }
View Full Code Here

      }
   }

   public synchronized Queue getDefaultDLQInstance() throws Exception
   {
      Queue dlq = null;

      if (defaultDLQObjectName != null)
      {
         ManagedQueue dest = null;

         // This can be null... JMXAccessor will return null if InstanceNotFoundException is caught
         dest = (ManagedQueue) JMXAccessor.getJMXAttributeOverSecurity(getServer(), defaultDLQObjectName, "Instance");

         if (dest != null && dest.getName() != null)
         {
            Binding binding = postOffice.getBindingForQueueName(dest.getName());

            if (binding == null)
            {
              throw new IllegalStateException("Cannot find binding for queue " + dest.getName());
            }

            Queue queue = binding.queue;

            if (queue.isActive())
            {
              dlq = queue;
            }
         }
      }
View Full Code Here

      return dlq;
   }

   public synchronized Queue getDefaultExpiryQueueInstance() throws Exception
   {
      Queue expiryQueue = null;

      if (defaultExpiryQueueObjectName != null)
      {
         ManagedQueue dest = null;

         try
         {

            dest = (ManagedQueue)JMXAccessor.getJMXAttributeOverSecurity(getServer(), defaultExpiryQueueObjectName, "Instance");
         }
         catch (InstanceNotFoundException e)
         {
            //Ok
         }

         if (dest != null && dest.getName() != null)
         {
           Binding binding = postOffice.getBindingForQueueName(dest.getName());

            if (binding == null)
            {
              throw new IllegalStateException("Cannot find binding for queue " + dest.getName());
            }

            Queue queue = binding.queue;

            if (queue.isActive())
            {
              expiryQueue = queue;
            }
         }
      }
View Full Code Here

      Iterator iter = queues.iterator();

      while (iter.hasNext())
      {
         Queue queue = (Queue)iter.next();

         queue.removeAllReferences();
      }

      //undeploy the mbean
      if (!undeployDestination(isQueue, name))
      {
         return false;
      }

      //Unbind the destination's queues

      while (iter.hasNext())
      {
         Queue queue = (Queue)iter.next();

         queue.removeAllReferences();

         //Durable subs need to be removed on all nodes
         boolean all = !isQueue && queue.isRecoverable();

         postOffice.removeBinding(queue.getName(), all);
      }

      return true;
   }
View Full Code Here

   {
      try
      {
        serverPeer.getDestinationManager().unregisterDestination(destination);
       
         Queue queue = ((ManagedQueue)destination).getQueue();
        
         String counterName = QUEUE_MESSAGECOUNTER_PREFIX + destination.getName();
                 
         MessageCounter counter = serverPeer.getMessageCounterManager().unregisterMessageCounter(counterName);
        
         if (counter == null)
         {
            //https://jira.jboss.org/jira/browse/JBMESSAGING-1698
            log.warn("Cannot find counter to unregister " + counterName);
         }
        
         queue.deactivate();
        
         queue.unload();
        
         started = false;
        
         log.info(this + " stopped");
      }
View Full Code Here

      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

          
         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);
        
         String counterName = QUEUE_MESSAGECOUNTER_PREFIX + destination.getName();
        
         int dayLimitToUse = destination.getMessageCounterHistoryDayLimit();
         if (dayLimitToUse == -1)
         {
            //Use override on server peer
            dayLimitToUse = serverPeer.getDefaultMessageCounterHistoryDayLimit();
         }
        
         MessageCounter counter =
            new MessageCounter(counterName, null, queue, false, false,
                               dayLimitToUse);
        
         ((ManagedQueue)destination).setMessageCounter(counter);
                 
         serverPeer.getMessageCounterManager().registerMessageCounter(counterName, counter);
                      
         serverPeer.getDestinationManager().registerDestination(destination);
       
         log.debug(this + " security configuration: " + (destination.getSecurityConfig() == null ?
            "null" : "\n" + XMLUtil.elementToString(destination.getSecurityConfig())));
        
         started = true;        
        
         //Now we need to trigger a delivery - this is because message suckers might have
         //been create *before* the queue was deployed - this is because message suckers can be
         //created when the clusterpullconnectionfactory deploy is detected which then causes
         //the clusterconnectionmanager to inspect the bindings for queues to create suckers
         //to - but these bindings will exist before the queue or topic is deployed and before
         //it has had its messages loaded
         //Therefore we need to trigger a delivery now so remote suckers get messages
         //See http://jira.jboss.org/jira/browse/JBMESSAGING-1136
         //For JBM we should remove the distinction between activation and deployment to
         //remove these annoyances and edge cases.
         //The post office should load(=deploy) all bindings on startup including loading their
         //state before adding the binding - there should be no separate deployment stage
         //If the queue can be undeployed there should be a separate flag for this on the
         //binding
         queue.deliver();
        
         log.info(this + " started, fullSize=" + destination.getFullSize() +
                  ", pageSize=" + destination.getPageSize() + ", downCacheSize=" + destination.getDownCacheSize());
      }
      catch (Throwable t)
View Full Code Here

      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

      }
   }

   public synchronized Queue getDefaultDLQInstance() throws Exception
   {
      Queue dlq = null;

      if (defaultDLQObjectName != null)
      {
         ManagedQueue dest = null;

         // This can be null... JMXAccessor will return null if InstanceNotFoundException is caught
         dest = (ManagedQueue) JMXAccessor.getJMXAttributeOverSecurity(getServer(), defaultDLQObjectName, "Instance");

         if (dest != null && dest.getName() != null)
         {
            Binding binding = postOffice.getBindingForQueueName(dest.getName());

            if (binding == null)
            {
              throw new IllegalStateException("Cannot find binding for queue " + dest.getName());
            }

            Queue queue = binding.queue;

            if (queue.isActive())
            {
              dlq = queue;
            }
         }
      }
View Full Code Here

TOP

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

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.