Пример #1
0
        Dictionary<string, int> _numberOfClientsUsingExistingFile; /*Nao esta a ser usado*/

        #endregion Fields

        #region Constructors

        public MetadataServerRemoting(string metadataServerName, int metadataServerPort)
        {
            //Inicializations
            _metadataServerName = metadataServerName;
            _metadataServerPort = metadataServerPort;

            _isInFailMode = false;

            _metadataMasterActualProxy = null;

            _metadataServersProxys = new Dictionary<string, MetadataServerInterface>();

            _dataServersURLS = new Dictionary<string, string>();
            _dataServersProxys = new Dictionary<string, DataServerInterface>();

            _filesMetadata = new Dictionary<string, FileMetadata>();

            _dataServersNumberOfFiles = new Dictionary<string, int>();
            _dataServersAssociatedFilenames = new Dictionary<string, string>();
            _localFilesDataServers = new Dictionary<string, List<string>>();

            _filesWithMissingDataServers = new Dictionary<string, int>();

            _fileUniqueName = "LOCAL-DATASERVER-FILENAME-";
            _fileUniqueID = 1;
        }
Пример #2
0
        public void configureMaster()
        {
            lock (this)
            {
                Tuple<string, MetadataServerInterface> aliveMetadataServerMaster = isAnyMasterAlive();

                //Someone is alive (the master)
                if (aliveMetadataServerMaster != null)
                {
                    _isMaster = false;

                    _metadataMasterActualProxy = aliveMetadataServerMaster.Item2;

                    _metadataMasterActualProxy.iWasBorn(_metadataServerName, _metadataServerPort);

                }
                else
                {
                    _isMaster = true;

                    _metadataMasterActualProxy = (MetadataServerInterface)Activator.GetObject(typeof(MetadataServerInterface),
                                                                                              "tcp://localhost:" + _metadataServerPort + "/" + _metadataServerName);

                    _metadataServersProxys.Add(_metadataServerName, _metadataMasterActualProxy);
                }
            }
        }