[jboss-dev-forums] [Design of Messaging on JBoss (Messaging/JBoss)] - Re: Server side HA and failover

clebert.suconic@jboss.com do-not-reply at jboss.com
Mon Oct 30 23:35:47 EST 2006


Just for reference, this method from DefaultClusteredPostOffice is going to be the heart of serverSide failover:


  |    public void failOver(int nodeId) throws Exception
  |    {
  |        log.info("Preparing failover against node " + nodeId);
  |        Map subMaps = (Map)nameMaps.get(new Integer(nodeId));
  |        ArrayList namesToRemove = new ArrayList();
  |        for (Iterator iterNames = subMaps.entrySet().iterator();iterNames.hasNext();)
  |        {
  |            Map.Entry entry = (Map.Entry)iterNames.next();
  |            Binding binding = (Binding )entry.getValue();
  |            if (binding.getQueue().isClustered())
  |            {
  |                ClusteredQueue queue = (ClusteredQueue) binding.getQueue();
  |                if (!queue.isLocal())
  |                {
  |                    namesToRemove.add(entry);
  |                }
  |            }
  |        }
  | 
  |        for (Iterator iterNames = namesToRemove.iterator();iterNames.hasNext();)
  |        {
  |            Map.Entry entry = (Map.Entry)iterNames.next();
  |            DefaultBinding binding = (DefaultBinding)entry.getValue();
  |            RemoteQueueStub stub = (RemoteQueueStub)binding.getQueue();
  |            this.removeBinding(nodeId,(String)entry.getKey());
  | 
  |            Binding newBinding = this.createBinding(this.nodeId,nodeId,binding.getCondition(),stub.getName(),stub.getChannelID(),stub.getFilter(),stub.isRecoverable());
  |            LocalClusteredQueue clusteredQueue = (LocalClusteredQueue )newBinding.getQueue();
  |            clusteredQueue.deactivate();
  |            clusteredQueue.load();
  |            clusteredQueue.activate();
  |            addBinding(newBinding);
  |        }
  |    }
  | 
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3981951#3981951

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3981951



More information about the jboss-dev-forums mailing list