public override void Start() { Console.WriteLine("View new"); MetadataServer.PauseServer(); //Multicast All to STOP. All servers will change to Paused. Manager.MulticastMsg(new ViewMsg(ViewMsgType.NewRowdy, ServerStatus.New, Manager.ThisMetaserverId, MetadataServer.GetQueueStateVector( ))); //ViewStatusChanged will finish and change status: //Aguardar que os restantes passem a off ou a paused (ou se for novo, segue while (!CheckIfStatusIsKnown()) { lock (locker) { Monitor.Wait(locker, 1000); } } CopyProcess( ); if (Manager.CountOnServers( ) == 1) { Console.WriteLine("Single server "); Manager.ToOnline( ); return; } //Change state to ready Manager.ToReady(); }
public override void Start() { MetadataServer.PauseServer( ); long[] state = MetadataServer.GetQueueStateVector( ); Console.WriteLine("View Pause with state: " + state.ToArray()); Manager.UpdateViewServerState(ServerStatus.Pause, MetadataServer.ThisMetaserverId, state); // ask Paused to other Manager.MulticastMsg(new ViewMsg(ViewMsgType.StatusUpdate, ServerStatus.Pause, Manager.ThisMetaserverId, state)); //Wait to know the state of all new servers //Se houver algum online, paused ou ready, queremos saber o estado dele //Verificar quais as maiores posicoes long[] lastestStatus = WaitUntilSameStatus(state); //Deliver all message on application layer Console.WriteLine("All message delivered"); //Change state to ready Manager.ToReady(); }