public urlendpoint Get(loadbalance request)
 {
     Isis.WriteLine("The Login Name is " + request.loginName);
     return(new urlendpoint {
         endpoints = getServerAddresses(request.loginName)
     });
 }
 public void addToFileServerList(Address fsaddress)
 {
     if (fileServerList.Exists(element => element == fsaddress))
     {
         Isis.WriteLine("The Address " + fsaddress.ToStringVerboseFormat() + "already exists ");
     }
     else
     {
         fileServerList.Add(fsaddress);
     }
 }
        protected void Application_Start(Object sender, EventArgs e)
        {
            Semaphore sem = new Semaphore(0, 1);
            Thread lbFileServerGroupThread = new Thread(delegate()
            {
                //Start the ISIS System
                IsisSystem.Start();

                string groupName        = "FS1";
                string logicalGroupName = "lbalancer-" + groupName;

                fileServerGroupList.TryAdd(logicalGroupName, new FileServerGroupObject());

                Group lbfsgroup = new Group(logicalGroupName);

                lbfsgroup.ViewHandlers += (ViewHandler) delegate(View v)
                {
                    Console.WriteLine("myGroup got a new view event: " + v);

                    Address [] addList = v.GetLiveMembers();
                    for (Int32 index = 0; index < addList.Length; index++)
                    {
                        Isis.WriteLine("The Add List Address " + addList[index].ToStringVerboseFormat());
                        fileServerGroupList[logicalGroupName].addToFileServerList(addList[index]);
                    }

                    Address [] removeList = v.GetFailedMembers();
                    for (Int32 index = 0; index < removeList.Length; index++)
                    {
                        fileServerGroupList[logicalGroupName].removeFromFileServerList(removeList[index]);
                    }
                };

                lbfsgroup.Join();
                sem.Release();
                IsisSystem.WaitForever();
            });

            lbFileServerGroupThread.Start();
            sem.WaitOne();
            Isis.WriteLine("Starting Web Service on the LoadBalancer");

            new AppHost().Init();
        }