Package org.jboss.messaging.core.plugin.postoffice

Examples of org.jboss.messaging.core.plugin.postoffice.Binding


                 
      //First deactivate
     
      if (isQueue)
      {
         Binding binding = postOffice.getBindingForQueueName(name);
        
         if (binding != null)
         {
            binding.getQueue().deactivate();
         }
      }
      else
      {
         JMSCondition topicCond = new JMSCondition(false, name);   
        
         Collection bindings = postOffice.getBindingsForCondition(topicCond);
        
         Iterator iter = bindings.iterator();
         while (iter.hasNext())           
         {
            Binding binding = (Binding)iter.next();
           
            binding.getQueue().deactivate();
         }
      }
           
      //Delete any message data
     
      mbeanServer.invoke(on, "removeAllMessages", null, null);
     
      //undeploy the mbean
      if (!undeployDestination(isQueue, name))
      {
         return false;
      }
           
      //Unbind from the post office
     
      if (isQueue)
      {
         Binding binding = postOffice.getBindingForQueueName(name);
        
         if (binding != null)
         {
            try
            {
               Queue queue = binding.getQueue();
               if (!queue.isClustered())
               {
                  postOffice.unbindQueue(queue.getName());
               }
               else
               {
                  ((ClusteredPostOffice)postOffice).unbindClusteredQueue(queue.getName());
               }
            }
            catch (Throwable t)
            {
               throw new Exception("Failed to unbind queue", t);
            }
         }
      }
      else
      {
         JMSCondition topicCond = new JMSCondition(false, name);   
        
         Collection bindings = postOffice.getBindingsForCondition(topicCond);
        
         Iterator iter = bindings.iterator();
         while (iter.hasNext())           
         {
            Binding binding = (Binding)iter.next();
           
            try
            {
               postOffice.unbindQueue(binding.getQueue().getName());
            }
            catch (Throwable t)
            {
               throw new Exception("Failed to unbind queue", t);
            }
View Full Code Here


      if (queue.getNodeId() != this.currentNodeId)
      {
          throw new IllegalArgumentException("Queue node id does not match office node id");
      }

      Binding binding = (Binding)super.bindQueue(condition, queue);

      sendBindRequest(condition, queue, binding);

      return binding;
   }
View Full Code Here

   public Binding unbindClusteredQueue(String queueName) throws Throwable
   {
      if (trace) { log.trace(this.currentNodeId + " unbind clustered queue: " + queueName); }

      Binding binding = (Binding)super.unbindQueue(queueName);

      UnbindRequest request = new UnbindRequest(this.currentNodeId, queueName);

      syncSendRequest(request);
View Full Code Here

         }

         // We currently only allow one binding per name per node
         Map nameMap = (Map)nameMaps.get(new Integer(nodeId));

         Binding binding = null;

         if (nameMap != null)
         {
            binding = (Binding)nameMap.get(queueName);
         }
View Full Code Here

            Iterator iter = bindings.iterator();

            while (iter.hasNext())
            {
               Binding binding = (Binding)iter.next();

               if (binding.getNodeID() == this.currentNodeId)
               {
                  boolean handle = true;

                  if (queueNameNodeIdMap != null)
                  {
                     Integer in = (Integer)queueNameNodeIdMap.get(binding.getQueue().getName());

                     //When there are more than one queues with the same name across the cluster we only
                     //want to chose one of them

                     if (in != null)
                     {
                        handle = in.intValue() == currentNodeId;
                     }
                  }

                  if (handle)
                  {
                     //It's a local binding so we pass the message on to the subscription

                     LocalClusteredQueue queue = (LocalClusteredQueue)binding.getQueue();

                     Delivery del = queue.handleFromCluster(ref);

                     if (trace)
                     {
View Full Code Here

         else
         {
            for(Iterator i = statsList.iterator(); i.hasNext(); )
            {
               QueueStats st = (QueueStats)i.next();
               Binding bb = (Binding)nameMap.get(st.getQueueName());

               if (bb == null)
               {
                  // I guess this is possible if the queue was unbound
                  if (trace) { log.trace(this + " cannot find binding for queue " + st.getQueueName() + " it could have been unbound"); }
               }
               else
               {
                  RemoteQueueStub stub = (RemoteQueueStub)bb.getQueue();

                  stub.setStats(st);

                  if (trace) { log.trace(this.currentNodeId + " setting stats: " + st + " on remote stub " + stub.getName()); }
View Full Code Here

         {
            Iterator iter = nameMap.values().iterator();

            while (iter.hasNext())
            {
               Binding bb = (Binding)iter.next();

               Queue q = bb.getQueue();

               //Only send stats for clustered queues
              
               if (q instanceof ClusteredQueue)
               {              
View Full Code Here

   public void handleMessagePullResult(int remoteNodeId, long holdingTxId,
                                       String queueName, org.jboss.messaging.core.message.Message message) throws Throwable
   {
      if (trace) { log.trace(this.currentNodeId + " handling pull result " + message + " for " + queueName); }

      Binding binding = getBindingForQueueName(queueName);

      //The binding might be null if the queue was unbound

      boolean handled = false;

      if (!failHandleResult && binding != null)
      {
         LocalClusteredQueue localQueue = (LocalClusteredQueue)binding.getQueue();

         RemoteQueueStub remoteQueue = localQueue.getPullQueue();

         if (remoteNodeId != remoteQueue.getNodeId())
         {
            //It might have changed since the request was sent
            Map bindings = (Map)nameMaps.get(new Integer(remoteNodeId));

            if (bindings != null)
            {
               binding = (Binding)bindings.get(queueName);

               if (binding != null)
               {
                 remoteQueue = (RemoteQueueStub)binding.getQueue();
               }
            }
         }

         if (remoteQueue != null)
View Full Code Here

         {
            List toRemove = new ArrayList();

            for(Iterator i = nameMap.values().iterator(); i.hasNext(); )
            {
               Binding binding = (Binding)i.next();

               if (!binding.getQueue().isRecoverable())
               {
                  // We only remove the non durable bindings - we still need to be able to handle
                  // messages for a durable subscription "owned" by a node that is not active any
                  // more!
                  toRemove.add(binding);
               }
            }

            for(Iterator i = toRemove.iterator(); i.hasNext(); )
            {
               Binding binding = (Binding)i.next();
               removeBinding(nodeToRemove.intValue(), binding.getQueue().getName());
            }
         }
      }
      finally
      {
View Full Code Here

         Iterator iter2 = map.values().iterator();

         while (iter2.hasNext())
         {
            Binding binding = (Binding)iter2.next();

            Queue queue = binding.getQueue();
           
            //we only replicate the clustered queues
           
            if (queue.isClustered())
            {
               BindingInfo info = new BindingInfo(binding.getNodeID(), queue.getName(),
                                                  binding.getCondition().toText(),
                                                  queue.getFilter() == null ? null : queue.getFilter().getFilterString(),
                                                  queue.getChannelID(),
                                                  queue.isRecoverable());
              
               bindings.add(info);
View Full Code Here

TOP

Related Classes of org.jboss.messaging.core.plugin.postoffice.Binding

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.