Beispiel #1
0
        /// <summary>
        /// Dada a view actual, quem vai ser o serializador desta queue?
        /// </summary>
        /// <param name="queueNumber"></param>
        /// <param name="manager"></param>
        /// <returns></returns>
        public int GetPartSerializer(int queueNumber, MetaViewManager manager)
        {
            List <int> onlineServers = manager.GetOnlineServers( );
            int        numberQueuesThatEachServersResponsible = NUMBER_OF_SPACE_SPLIT / onlineServers.Count;

            for (int i = 0; i < onlineServers.Count; i++)
            {
                int max = (i + 1) * numberQueuesThatEachServersResponsible;
                if (queueNumber < max)
                {
                    return(onlineServers[i]);
                }
            }
            throw new Exception("Error getting the part responsible");
        }
Beispiel #2
0
        public static void Main(string[] args)
        {
            log4net.Config.XmlConfigurator.Configure( );

            log.Debug(DateTime.Now.Ticks + " Metadata init...");


            Console.WriteLine("Metadata Init....");

            //    if (!Debugger.IsAttached)
            //       Debugger.Launch();


            int i = 0;

            for (i = 0; i < (args.Length - 2); i++)
            {
                MetaserverId metaServer = new MetaserverId( );
                metaServer.Hostname = args[i++];
                metaServer.Port     = Convert.ToInt32(args[i]);
                metaServer.Id       = i / 2;
                MetadataServerList.Add(metaServer.Id, metaServer);
            }
            ThisMetaserverId = Convert.ToInt32(args[i++]);
            PortRecovery     = Convert.ToInt32(args[i]);;
            System.Console.WriteLine("System ID: " + ThisMetaserverId);
            Console.Title    = "Metaserver: " + ThisMetaserverId;
            ViewManager      = new MetaViewManager(ThisMetaserverId, MetadataServerList);
            NamespaceManager = new NamespaceManager( );


            System.Console.WriteLine("Metadata servers list loaded...");
            RemotingConfiguration.Configure("../../App.config", true);
            System.Console.WriteLine("Metadata Server init...");

            CreateEmergencyChannel( );
            //CreateMetaserverChannel( );

            System.Console.WriteLine("<enter> to exit...");
            System.Console.ReadLine( );
        }
Beispiel #3
0
 /// <summary>
 /// Start bully algorithm
 /// </summary>
 public ViewReady(MetaViewManager manager)
     : base(manager, ServerStatus.Ready)
 {
 }
Beispiel #4
0
 /// <summary>
 /// Start bully algorithm
 /// </summary>
 public ViewPause(MetaViewManager manager)
     : base(manager, ServerStatus.Pause)
 {
 }