Package org.jboss.messaging.core.contract

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


                  if (selector != null)
                  {
                     filter = filterFactory.createFilter(selector);
                  }

                  Queue queue = new MessagingQueue(thisNodeID, queueName, channelID, ms, pm,
                                                   true, filter, bindingClustered && clustered);

                  if (trace) { log.trace(this + " loaded binding from storage: " + queueName); }
                 
                  Condition condition = conditionFactory.createCondition(conditionText);
View Full Code Here


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

        Queue queue = binding.queue;

         Long scid = (Long)ref.getMessage().removeHeader(Message.SOURCE_CHANNEL_ID);

         Delivery del = queue.handleMove(ref, scid.longValue());

        if (del == null)
        {
          throw new JMSException("Failed to route " + ref + " to " + dest.getName());
        }
View Full Code Here

         Iterator iter = queues.iterator();

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

           if (!localOnly || (queue.getNodeID() == thisNodeID))
           {
             list.add(queue);
           }
         }
View Full Code Here

         if (mapping.getFilterString() != null)
         {
           filter = filterFactory.createFilter(mapping.getFilterString());
         }
        
         Queue queue = new MessagingQueue(mapping.getNodeId(), mapping.getQueueName(), mapping.getChannelId(),
                                          mapping.isRecoverable(), filter, true);
        
         Condition condition = conditionFactory.createCondition(mapping.getConditionText());
        
         addBindingInMemory(new Binding(condition, queue, false));
        
         if (mapping.isAllNodes())
         {
           // insert into db if not already there
           if (!loadedBindings.containsKey(queue.getName()))
           {
             //Create a local binding too
            
            long channelID = channelIDManager.getID();
                       
            Queue queue2 = new MessagingQueue(thisNodeID, mapping.getQueueName(), channelID, ms, pm,
                                             mapping.isRecoverable(), mapping.getMaxSize(), filter,
                                             mapping.getFullSize(), mapping.getPageSize(), mapping.getDownCacheSize(),
                                             true, mapping.getRecoverDeliveriesTimeout());    
           
            Binding localBinding = new Binding(condition, queue2, true);
View Full Code Here

         
          while (iter2.hasNext())
          {
            Binding binding = (Binding)iter2.next();
         
            Queue queue = binding.queue;
           
            //We only get the clustered queues
            if (queue.isClustered())
            {             
              String filterString = queue.getFilter() == null ? null : queue.getFilter().getFilterString();
             
              MappingInfo mapping;
             
              if (binding.allNodes)
              {
                mapping = new MappingInfo(queue.getNodeID(), queue.getName(), binding.condition.toText(), filterString,
                                           queue.getChannelID(), queue.isRecoverable(), true, true,
                                    queue.getFullSize(), queue.getPageSize(), queue.getDownCacheSize(),
                                    queue.getMaxSize(), queue.getRecoverDeliveriesTimeout());
              }
              else
              {
                mapping = new MappingInfo(queue.getNodeID(), queue.getName(), binding.condition.toText(),
                                        filterString, queue.getChannelID(), queue.isRecoverable(),
                                        true, false);    
              }
              list.add(mapping);
            }
          }
View Full Code Here

      if (mapping.getFilterString() != null)
      {
        filter = filterFactory.createFilter(mapping.getFilterString());
      }
     
      Queue queue = new MessagingQueue(mapping.getNodeId(), mapping.getQueueName(), mapping.getChannelId(),
                                       mapping.isRecoverable(), filter, mapping.isClustered());
     
      Condition condition = conditionFactory.createCondition(mapping.getConditionText());
     
      //addBindingInMemory(new Binding(condition, queue, mapping.isAllNodes()));
      addBindingInMemory(new Binding(condition, queue, false));
     
      if (allNodes)
     {
       if (trace) { log.trace("allNodes is true, so also forcing a local bind"); }
      
       //There is the possibility that two nodes send a bind all with the same name simultaneously OR
       //a node starts and sends a bind "ALL" and the other nodes already have a queue with that name
       //This is ok - but we must check for this and not create the local binding in this case
                            
       //Bind locally

       long channelID = channelIDManager.getID();
      
       Queue queue2 = new MessagingQueue(thisNodeID, mapping.getQueueName(), channelID, ms, pm,
                                        mapping.isRecoverable(), mapping.getMaxSize(), filter,
                                        mapping.getFullSize(), mapping.getPageSize(), mapping.getDownCacheSize(), true,
                                        mapping.getRecoverDeliveriesTimeout());

       //We must cast back asynchronously to avoid deadlock
       //we need put adding binding and queue's loading and activations into one sync block
       //https://jira.jboss.org/jira/browse/JBMESSAGING-1760
         synchronized (queue2)
         {
            boolean added = internalAddBinding(new Binding(condition, queue2, true), false, false);

            if (added)
            {
               if (trace)
               {
                  log.trace(this + " inserted in binding locally");
               }
               queue2.load();

               queue2.activate();
            }
         }
     }
     
      synchronized (waitForBindUnbindLock)
View Full Code Here

       //will request for deliveries to be sent to it in a batch
       //We still send back a response though to prevent the sender blocking waiting for a reply
     }
     else
     {    
       Queue queue = binding.queue;
      
       queue.addToRecoveryArea(nodeID, messageID, sessionID);    
     }
    
     if (trace) { log.trace(this + " reply address is " + replyAddress); }
    
     if (replyAddress != null)
View Full Code Here

     {
       //This is ok - maybe new failover node but queue is not yet deployed
       return;
     }
    
     Queue queue = binding.queue;
    
     queue.removeFromRecoveryArea(nodeID, messageID)
   }
View Full Code Here

         throw new IllegalArgumentException("Binding is null");
      }
    
     Condition condition = binding.condition;
    
     Queue queue = binding.queue;
    
     if (queue == null)
      {
         throw new IllegalArgumentException("Queue is null");
      }
    
     if (queue.getNodeID() != thisNodeID)
     {
       throw new IllegalArgumentException("Cannot bind a queue from another node");
     }

      if (condition == null)
      {
         throw new IllegalArgumentException("Condition is null");
      }
          
     //The binding might already exist - this could happen if the queue is bind all simultaneously from more than one node of the cluster
      boolean added = addBindingInMemory(binding);   
     
      if (added)
      {
        if (queue.isRecoverable())
        {
          // Need to write the mapping to the database
          insertBindingInStorage(condition, queue, binding.allNodes);
        }
       
        if (clustered && queue.isClustered())
         {
           String filterString = queue.getFilter() == null ? null : queue.getFilter().getFilterString();       
          
           MappingInfo info = new MappingInfo(thisNodeID, queue.getName(), condition.toText(), filterString, queue.getChannelID(),
                                            queue.isRecoverable(), true,
                                            binding.allNodes,
                                            queue.getFullSize(), queue.getPageSize(), queue.getDownCacheSize(),
                                            queue.getMaxSize(),
                                            queue.getRecoverDeliveriesTimeout());
          
            ClusterRequest request = new BindRequest(info, allNodes);

            groupMember.multicastControl(request, sync);
         }       
View Full Code Here

      Binding removed = removeBindingInMemory(thisNodeID, queueName);

      //The queue might not be removed (it's already removed) if two unbind all requests are sent simultaneously on the cluster
      if (removed != null)
      {
        Queue queue = removed.queue;

        Condition condition = removed.condition;

        if (queue.isRecoverable())
        {
           //Need to remove from db too

           deleteBindingFromStorage(queue);
        }

        if (clustered && queue.isClustered())
        {
          String filterString = queue.getFilter() == null ? null : queue.getFilter().getFilterString();

          MappingInfo info = new MappingInfo(thisNodeID, queue.getName(), condition.toText(), filterString, queue.getChannelID(),
                                           queue.isRecoverable(), true, allNodes);

          UnbindRequest request = new UnbindRequest(info, allNodes);

          groupMember.multicastControl(request, sync);
        }

         queue.removeAllReferences();

      }

      return removed;
   }
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.