コード例 #1
0
 /// <summary>
 /// 启动负载均衡服务
 /// </summary>
 /// <returns>是否成功</returns>
 public bool StartLoadBalancingServer()
 {
     attribute.IsLoadBalancing = false;
     checkTicks = new TimeSpan(0, 0, Math.Max(attribute.LoadBalancingCheckSeconds + 2, 2)).Ticks;
     Monitor.Enter(serverLock);
     try
     {
         if (server == null)
         {
             server = new commandServer(this);
             if (server.Start())
             {
                 return(true);
             }
             pub.Dispose(ref server);
         }
     }
     finally { Monitor.Exit(serverLock); }
     return(false);
 }
コード例 #2
0
 /// <summary>
 /// TCP忽略检测操作
 /// </summary>
 /// <param name="groupId"></param>
 public void IgnoreGroup(int groupId)
 {
     if (groupId == 0 && !IsTryIgnoreServer())
     {
         try
         {
             processCopyServer.Remove();
         }
         finally
         {
             commandServer server = GetServer();
             if (server != null)
             {
                 server.StopListen();
             }
             if (OnIgnoreGroup != null)
             {
                 OnIgnoreGroup();
             }
             fastCSharp.threading.threadPool.TinyPool.Start(exit);
         }
     }
 }