tags:

views:

51

answers:

0

I have a event ServerStateReceived here checking condition of 4 servers whether they are UP or Down is going on.Here if flag ReadySent = true and 4 servers DOWN(Both are rare condition in a typical scenario) there will be a logic so that cotrol will go to the calling function only after all servers became UP here is bit of code

    private enum StateType : int
                  {
                     Initial = 0,
                     Up = 1,
                     Down = 2
                  }
   bool ReadySent = true

 public event ServerStateEventHandler ServerStateReceived 
      {
         // When a user attaches an event handler to the ServerStateReceived event 
         // (ServerStateReceived += myHandler;), the Add method 
         // adds the handler to the delegate for the ServerStateReceived event.
         add 
         {
            m_events.AddHandler(ServerStateEvent, value);

        if (m_alarmServerUp == ServerStateType.Up) 
        {
           value(this,
              new ServerStateEventArgs(ServerComponentType.AlarmServer, true));
        }
        else 
        {
           value(this,
              new ServerStateEventArgs(ServerComponentType.AlarmServer, false));
        }
        . 
        .
        .// like this other 3 servers check going on

    }

  }

///

If any body give c# code for this logic that will be the fix public event ServerStateEventHandler ServerStateReceived { //once finished all checks in the old code and reached down side there down need a check if(flag=true && all DOWN) do{ check the status of server }while(all UP) then only