コード例 #1
0
ファイル: HostResolver.cs プロジェクト: mamasha/hydra
        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
ファイル: ResolvingThread.cs プロジェクト: mamasha/hydra
        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
ファイル: WcfDiscovery.cs プロジェクト: mamasha/hydra
        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
ファイル: HostResolver.cs プロジェクト: mamasha/hydra
        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));
        }