예제 #1
0
        private HostResolver(HostResolverConfiguration config)
        {
            _self = new Self();
            _manager = new Manager(_self);

            _self.config = config;

            _self.resolvingScope = make_resolving_scope(_self);
            trace("Resolving scope URI is '{0}'", _self.resolvingScope.ToString());

            _self.repo = new Repository();
            _self.thread = new ResolvingThread(_self, _manager);
            _self.wcf = new WcfDiscovery(_self, _manager);
        }
예제 #2
0
        public ResolvingThread(Self self, IManager engine)
        {
            _helloMsgGap = self.config.HelloMessageGap;
            _engine = engine;

            _todos = new BlockingCollection<Action>();
            _isStoppedEvent = new ManualResetEvent(false);

            _thr = new Thread(discovery_update_main)
                       {
                           Name = "l4p.VcallModel.ResolvingThread"
                       };

            _stopFlagIsOn = false;
            _groovyTimer = new Stopwatch();

            _counters = Context.Get<ICountersDb>().NewCounters();
        }
예제 #3
0
        public WcfDiscovery(Self self, IManager engine)
        {
            _self = self;
            _engine = engine;

            var listener = new AnnouncementService();

            listener.OnlineAnnouncementReceived +=
                (sender, args) => handle_hello_message(args.EndpointDiscoveryMetadata);

            _mutex = new Object();
            _serviceEndpoint = new UdpAnnouncementEndpoint();
            _announcementService = new ServiceHost(listener);
            _announcementService.AddServiceEndpoint(_serviceEndpoint);

            _announcementCleint = new AnnouncementClient(new UdpAnnouncementEndpoint());

            _counters = Context.Get<ICountersDb>().NewCounters();
        }
예제 #4
0
파일: Manager.cs 프로젝트: mamasha/hydra
 public Manager(Self self)
 {
     _self = self;
     _counters = Context.Get<ICountersDb>().NewCounters();
 }
예제 #5
0
        private static Uri make_resolving_scope(Self self)
        {
            string resolvingScope = String.Format(self.config.DiscoveryScopePattern, self.config.ResolvingKey.ToLowerInvariant());

            return Helpers.TryCatch(_log,
                () => new Uri(resolvingScope),
                ex => Helpers.ThrowNew<HostResolverException>(ex, _log, "resolvingKye '{0}' is invalid; resulting uri is '{1}'", self.config.ResolvingKey, resolvingScope));
        }