public void handleBootStrappingRequestPlaceHolder(object arg) { Logger.Debug("Begin handleBootStrappingRequestPlaceHolder ()"); BootStrappingRequest request = (BootStrappingRequest)arg; handleBootStrappingRequest(FileServerComm.getInstance().getFileServerGroup(), FileServerComm.getInstance().getOOBHandler(), FileServerComm.getInstance().getFileHandler().filesystem, request.RequestName, request.requestNodeAddress); }
public void sendBootStrappingRequest(Group group, Address lastSelectedNode) { Address [] liveMembers = group.getLiveMembers(); Address myAddress = IsisSystem.GetMyAddress(); if (liveMembers.Length > 1) { Random rnd = new Random(); int sendNodeIndex = 0; int numTries = 0; do { sendNodeIndex = rnd.Next(0, liveMembers.Length); if (liveMembers [sendNodeIndex].Equals(myAddress)) { continue; } Logger.Debug("Stuck in a Infinite Loop : Length: " + liveMembers.Length); numTries = numTries + 1; break; } while(true); if (numTries != liveMembers.Length) { Logger.Debug("sendBootStrappingRequest Succeeded :). Sending to Address " + liveMembers [sendNodeIndex].ToStringVerboseFormat()); Logger.Debug("My Address is :) " + IsisSystem.GetMyAddress().ToStringVerboseFormat()); BootStrappingRequest request = new BootStrappingRequest(IsisSystem.GetMyAddress(), FileServerComm.getInstance().transManager.generateTransactionId()); state.selectedNode = liveMembers [sendNodeIndex]; state.currState = eBootStrapState.SentBootStrappingBeginRequest; group.RawP2PSend(liveMembers [sendNodeIndex], FileServerComm.BootStrapRequest, request); } else { Logger.Debug("sendBootStrappingRequest Failed :) Try After Backup"); state.selectedNode = lastSelectedNode; state.currState = eBootStrapState.Initialized; state.setBootStrappingTimer(group, this); } } else { Logger.Debug("There are No Live Members Available, Just Continue : " + liveMembers.Length); state.currState = eBootStrapState.BootStrappingComplete; waitBootStrap.Release(); } }
public void sendBootStrappingRequest(Group group, Address lastSelectedNode) { Address [] liveMembers = group.getLiveMembers (); Address myAddress = IsisSystem.GetMyAddress (); if (liveMembers.Length > 1) { Random rnd = new Random (); int sendNodeIndex = 0; int numTries = 0; do { sendNodeIndex = rnd.Next (0, liveMembers.Length); if (liveMembers [sendNodeIndex].Equals (myAddress)) { continue; } Logger.Debug ("Stuck in a Infinite Loop : Length: " + liveMembers.Length); numTries = numTries + 1; break; } while(true); if (numTries != liveMembers.Length) { Logger.Debug ("sendBootStrappingRequest Succeeded :). Sending to Address " + liveMembers [sendNodeIndex].ToStringVerboseFormat ()); Logger.Debug ("My Address is :) " + IsisSystem.GetMyAddress ().ToStringVerboseFormat ()); BootStrappingRequest request = new BootStrappingRequest (IsisSystem.GetMyAddress (), FileServerComm.getInstance ().transManager.generateTransactionId ()); state.selectedNode = liveMembers [sendNodeIndex]; state.currState = eBootStrapState.SentBootStrappingBeginRequest; group.RawP2PSend (liveMembers [sendNodeIndex], FileServerComm.BootStrapRequest, request); } else { Logger.Debug ("sendBootStrappingRequest Failed :) Try After Backup"); state.selectedNode = lastSelectedNode; state.currState = eBootStrapState.Initialized; state.setBootStrappingTimer (group, this); } } else { Logger.Debug("There are No Live Members Available, Just Continue : " + liveMembers.Length); state.currState = eBootStrapState.BootStrappingComplete; waitBootStrap.Release(); } }