コード例 #1
0
        /// <summary>
        /// Check method implementation
        /// </summary>
        public bool Check(List <string> servernames, ReplayRecord record)
        {
            bool tempresult = false;

            try
            {
                lock (_lock)
                {
                    tempresult = _manager.AddToReplay(record);
                    if (tempresult)
                    {
                        if ((record.MustDispatch) && (servernames != null))
                        {
                            foreach (string fqdn in servernames)
                            {
                                ReplayClient replaymanager = new ReplayClient();
                                replaymanager.Initialize(fqdn);
                                try
                                {
                                    IReplay client = replaymanager.Open();
                                    try
                                    {
                                        record.MustDispatch = false;
                                        tempresult          = client.Check(servernames, record);
                                    }
                                    catch (Exception e)
                                    {
                                        _log.WriteEntry(string.Format("Error on Check Remote Service method : {0} => {1}.", fqdn, e.Message), EventLogEntryType.Error, 1011);
                                    }
                                    finally
                                    {
                                        replaymanager.Close(client);
                                    }
                                }
                                finally
                                {
                                    replaymanager.UnInitialize();
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                _log.WriteEntry(string.Format("Error on Check Service method : {0}.", e.Message), EventLogEntryType.Error, 1010);
            }
            return(tempresult);
        }
コード例 #2
0
 /// <summary>
 /// Reset method implementation
 /// </summary>
 public void Reset(List <string> servernames)
 {
     try
     {
         lock (_lock)
         {
             _manager.Reset();
         }
         if (servernames != null)
         {
             foreach (string fqdn in servernames)
             {
                 ReplayClient replaymanager = new ReplayClient();
                 replaymanager.Initialize(fqdn);
                 try
                 {
                     IReplay client = replaymanager.Open();
                     try
                     {
                         client.Reset(null);
                     }
                     catch (Exception e)
                     {
                         _log.WriteEntry(string.Format("Error on Check Remote Service method : {0} => {1}.", fqdn, e.Message), EventLogEntryType.Error, 1011);
                     }
                     finally
                     {
                         replaymanager.Close(client);
                     }
                 }
                 finally
                 {
                     replaymanager.UnInitialize();
                 }
             }
         }
     }
     catch (Exception e)
     {
         _log.WriteEntry(string.Format("Error on Reset Service method : {0}.", e.Message), EventLogEntryType.Error, 1011);
     }
 }