Ejemplo n.º 1
0
		public AnnouncementClient (AnnouncementEndpoint announcementEndpoint)
		{
			if (announcementEndpoint == null)
				throw new ArgumentNullException ("announcementEndpoint");
			MessageSequenceGenerator = new DiscoveryMessageSequenceGenerator ();
			client = Activator.CreateInstance (announcementEndpoint.DiscoveryVersion.AnnouncementClientType, new object [] {announcementEndpoint});
		}
Ejemplo n.º 2
0
 public AnnouncementClient(AnnouncementEndpoint announcementEndpoint)
 {
     if (announcementEndpoint == null)
     {
         throw new ArgumentNullException("announcementEndpoint");
     }
     MessageSequenceGenerator = new DiscoveryMessageSequenceGenerator();
     client = Activator.CreateInstance(announcementEndpoint.DiscoveryVersion.AnnouncementClientType, new object [] { announcementEndpoint });
 }
Ejemplo n.º 3
0
        MessageContractsCD1.ResolveResponse IDiscoveryProxyContractCD1.EndResolve(IAsyncResult result)
        {
            var ret = OnEndResolve(result);

            return(new MessageContractsCD1.ResolveResponse()
            {
                MessageSequence = new DiscoveryMessageSequenceCD1(DiscoveryMessageSequenceGenerator.Next()), Body = new EndpointDiscoveryMetadataCD1(ret)
            });
        }
Ejemplo n.º 4
0
        public DefaultDiscoveryService(
            DiscoveryServiceExtension discoveryServiceExtension,
            DiscoveryMessageSequenceGenerator discoveryMessageSequenceGenerator,
            int duplicateMessageHistoryLength)
            : base(discoveryMessageSequenceGenerator, duplicateMessageHistoryLength)

        {
            Fx.Assert(discoveryServiceExtension != null, "The discoveryServiceExtension must be non null.");
            this.publishedEndpoints = discoveryServiceExtension.PublishedEndpoints;
        }
        public DefaultDiscoveryService(
            DiscoveryServiceExtension discoveryServiceExtension,
            DiscoveryMessageSequenceGenerator discoveryMessageSequenceGenerator,
            int duplicateMessageHistoryLength)
            : base(discoveryMessageSequenceGenerator, duplicateMessageHistoryLength)

        {
            Fx.Assert(discoveryServiceExtension != null, "The discoveryServiceExtension must be non null.");
            this.publishedEndpoints = discoveryServiceExtension.PublishedEndpoints;
        }
            public CloseListener(Collection <AnnouncementEndpoint> announcementEndpoints, Collection <EndpointDiscoveryMetadata> publishedEndpoints, DiscoveryMessageSequenceGenerator discoveryMessageSequenceGenerator)
            {
                Fx.Assert(announcementEndpoints != null && announcementEndpoints.Count > 0, "The Announcement Endpoints collection must be non null and not empty.");
                Fx.Assert(publishedEndpoints != null, "The Published Endpoints collection must be non null.");
                Fx.Assert(discoveryMessageSequenceGenerator != null, "The discoveryMessageSequenceGenerator must be non null.");

                this.announcementEndpoints             = announcementEndpoints;
                this.publishedEndpoints                = publishedEndpoints;
                this.discoveryMessageSequenceGenerator = discoveryMessageSequenceGenerator;
                this.abortAnnouncement = false;
            }
        public AnnouncementDispatcherAsyncResult(
            Collection <AnnouncementEndpoint> endpoints,
            Collection <EndpointDiscoveryMetadata> metadatas,
            DiscoveryMessageSequenceGenerator discoveryMessageSequenceGenerator,
            bool online,
            AsyncCallback callback,
            object state
            )
            : base(callback, state)
        {
            if (metadatas.Count == 0)
            {
                Complete(true);
                return;
            }
            bool success = false;

            this.cancelled    = false;
            this.thisLock     = new object();
            this.innerResults = new AnnouncementSendsAsyncResult[endpoints.Count];
            this.onAnnouncementSendsCompletedCallback = Fx.ThunkCallback(new AsyncCallback(OnAnnouncementSendsCompleted));
            Collection <UniqueId> messageIds = AllocateMessageIds(metadatas.Count);

            try
            {
                Random random = new Random();
                for (int i = 0; i < this.innerResults.Length; i++)
                {
                    AnnouncementClient announcementClient = new AnnouncementClient(endpoints[i]);
                    announcementClient.MessageSequenceGenerator = discoveryMessageSequenceGenerator;
                    this.innerResults[i] =
                        new AnnouncementSendsAsyncResult(
                            announcementClient,
                            metadatas,
                            messageIds,
                            online,
                            endpoints[i].MaxAnnouncementDelay,
                            random,
                            this.onAnnouncementSendsCompletedCallback,
                            this);
                }
                success = true;
            }
            finally
            {
                if (!success)
                {
                    this.Cancel();
                }
            }
        }
        public AnnouncementDispatcherAsyncResult(
            Collection<AnnouncementEndpoint> endpoints,
            Collection<EndpointDiscoveryMetadata> metadatas,
            DiscoveryMessageSequenceGenerator discoveryMessageSequenceGenerator,
            bool online,
            AsyncCallback callback,
            object state
            )
            : base(callback, state)
        {
            if (metadatas.Count == 0)
            {
                Complete(true);
                return;
            }
            bool success = false;
            this.cancelled = false;
            this.thisLock = new object();
            this.innerResults = new AnnouncementSendsAsyncResult[endpoints.Count];
            this.onAnnouncementSendsCompletedCallback = Fx.ThunkCallback(new AsyncCallback(OnAnnouncementSendsCompleted));
            Collection<UniqueId> messageIds = AllocateMessageIds(metadatas.Count);

            try
            {
                Random random = new Random();
                for (int i = 0; i < this.innerResults.Length; i++)
                {
                    AnnouncementClient announcementClient = new AnnouncementClient(endpoints[i]);
                    announcementClient.MessageSequenceGenerator = discoveryMessageSequenceGenerator;
                    this.innerResults[i] = 
                        new AnnouncementSendsAsyncResult(
                        announcementClient, 
                        metadatas, 
                        messageIds, 
                        online, 
                        endpoints[i].MaxAnnouncementDelay, 
                        random, 
                        this.onAnnouncementSendsCompletedCallback, 
                        this);
                }
                success = true;
            }
            finally
            {
                if (!success)
                {
                    this.Cancel();
                }
            }
        }
        internal OnlineAnnouncementChannelDispatcher(ServiceHostBase serviceHostBase, Collection<AnnouncementEndpoint> announcementEndpoints, Collection<EndpointDiscoveryMetadata> publishedEndpoints, DiscoveryMessageSequenceGenerator discoveryMessageSequenceGenerator)
        {
            Fx.Assert(serviceHostBase != null, "The serviceHostBase must be non null.");
            Fx.Assert(announcementEndpoints != null && announcementEndpoints.Count > 0, "The Announcement Endpoints collection must be non null and not empty.");
            Fx.Assert(publishedEndpoints != null, "The Published Endpoints collection must be non null.");
            Fx.Assert(discoveryMessageSequenceGenerator != null, "The discoveryMessageSequenceGenerator must be non null.");

            this.serviceHostBase = serviceHostBase;
            this.announcementEndpoints = announcementEndpoints;
            this.publishedEndpoints = publishedEndpoints;
            this.discoveryMessageSequenceGenerator = discoveryMessageSequenceGenerator;
            this.thisLock = new object();
            InitChannelDispatchers(serviceHostBase);
        }
Ejemplo n.º 10
0
        internal OnlineAnnouncementChannelDispatcher(ServiceHostBase serviceHostBase, Collection <AnnouncementEndpoint> announcementEndpoints, Collection <EndpointDiscoveryMetadata> publishedEndpoints, DiscoveryMessageSequenceGenerator discoveryMessageSequenceGenerator)
        {
            Fx.Assert(serviceHostBase != null, "The serviceHostBase must be non null.");
            Fx.Assert(announcementEndpoints != null && announcementEndpoints.Count > 0, "The Announcement Endpoints collection must be non null and not empty.");
            Fx.Assert(publishedEndpoints != null, "The Published Endpoints collection must be non null.");
            Fx.Assert(discoveryMessageSequenceGenerator != null, "The discoveryMessageSequenceGenerator must be non null.");

            this.serviceHostBase                   = serviceHostBase;
            this.announcementEndpoints             = announcementEndpoints;
            this.publishedEndpoints                = publishedEndpoints;
            this.discoveryMessageSequenceGenerator = discoveryMessageSequenceGenerator;
            this.thisLock = new object();
            InitChannelDispatchers(serviceHostBase);
        }
Ejemplo n.º 11
0
 protected DiscoveryService(
     DiscoveryMessageSequenceGenerator discoveryMessageSequenceGenerator,
     int duplicateMessageHistoryLength)
 {
     if (discoveryMessageSequenceGenerator == null)
     {
         throw FxTrace.Exception.ArgumentNull("messageSequenceGenerator");
     }
     if (duplicateMessageHistoryLength < 0)
     {
         throw FxTrace.Exception.ArgumentOutOfRange(
             "duplicateMessageHistoryLength",
             duplicateMessageHistoryLength,
             SR.DiscoveryNegativeDuplicateMessageHistoryLength);
     }
     if (duplicateMessageHistoryLength > 0)
     {
         this.duplicateDetector = new DuplicateDetector<UniqueId>(duplicateMessageHistoryLength);
     }
     this.messageSequenceGenerator = discoveryMessageSequenceGenerator;
 }
Ejemplo n.º 12
0
 protected DiscoveryProxy(
     DiscoveryMessageSequenceGenerator messageSequenceGenerator,
     int duplicateMessageHistoryLength)
 {
     if (messageSequenceGenerator == null)
     {
         throw FxTrace.Exception.ArgumentNull("messageSequenceGenerator");
     }
     if (duplicateMessageHistoryLength < 0)
     {
         throw FxTrace.Exception.ArgumentOutOfRange(
                   "duplicateMessageHistoryLength",
                   duplicateMessageHistoryLength,
                   SR.DiscoveryNegativeDuplicateMessageHistoryLength);
     }
     if (duplicateMessageHistoryLength > 0)
     {
         this.duplicateDetector = new DuplicateDetector <UniqueId>(duplicateMessageHistoryLength);
     }
     this.messageSequenceGenerator = messageSequenceGenerator;
 }
Ejemplo n.º 13
0
		protected DiscoveryProxy (DiscoveryMessageSequenceGenerator messageSequenceGenerator, int duplicateMessageHistoryLength)
		{
		}
Ejemplo n.º 14
0
		protected DiscoveryProxy (DiscoveryMessageSequenceGenerator messageSequenceGenerator)
			: this (messageSequenceGenerator, 0)
		{
		}
Ejemplo n.º 15
0
 protected DiscoveryService(DiscoveryMessageSequenceGenerator discoveryMessageSequenceGenerator, int duplicateMessageHistoryLength)
 {
     DiscoveryMessageSequenceGenerator = discoveryMessageSequenceGenerator;
     DuplicateMessageHistoryLength     = duplicateMessageHistoryLength;
 }
Ejemplo n.º 16
0
 protected DiscoveryProxy(DiscoveryMessageSequenceGenerator messageSequenceGenerator)
     : this(messageSequenceGenerator, DiscoveryDefaults.DuplicateMessageHistoryLength)
 {
 }
        internal OfflineAnnouncementChannelDispatcher(ServiceHostBase serviceHostBase, Collection <AnnouncementEndpoint> announcementEndpoints, Collection <EndpointDiscoveryMetadata> publishedEndpoints, DiscoveryMessageSequenceGenerator discoveryMessageSequenceGenerator)
        {
            Fx.Assert(serviceHostBase != null, "The serviceHostBase must be non null.");

            this.serviceHostBase = serviceHostBase;
            this.closeListener   = new CloseListener(announcementEndpoints, publishedEndpoints, discoveryMessageSequenceGenerator);
        }
Ejemplo n.º 18
0
 protected DiscoveryProxy(DiscoveryMessageSequenceGenerator messageSequenceGenerator)
     : this(messageSequenceGenerator, DiscoveryDefaults.DuplicateMessageHistoryLength)
 {
 }
        IAsyncResult IDiscoveryTargetContractCD1.BeginOnlineAnnouncement(MessageContractsCD1.OnlineAnnouncement msg, AsyncCallback callback, object state)
        {
            var edm = msg.EndpointDiscoveryMetadata != null?msg.EndpointDiscoveryMetadata.ToEndpointDiscoveryMetadata() : null;

            return(OnBeginOnlineAnnouncement(DiscoveryMessageSequenceGenerator.Next(), edm, callback, state));
        }
 protected DiscoveryProxy(DiscoveryMessageSequenceGenerator messageSequenceGenerator, int duplicateMessageHistoryLength)
 {
 }
Ejemplo n.º 21
0
 protected DiscoveryService(DiscoveryMessageSequenceGenerator discoveryMessageSequenceGenerator)
     : this(discoveryMessageSequenceGenerator, DiscoveryDefaults.DuplicateMessageHistoryLength)
 {
 }
Ejemplo n.º 22
0
		protected DiscoveryService (DiscoveryMessageSequenceGenerator discoveryMessageSequenceGenerator)
		{
		}
Ejemplo n.º 23
0
		protected DiscoveryService (DiscoveryMessageSequenceGenerator discoveryMessageSequenceGenerator, int duplicateMessageHistoryLength)
		{
		}
 protected DiscoveryProxy(DiscoveryMessageSequenceGenerator messageSequenceGenerator)
     : this(messageSequenceGenerator, 0)
 {
 }
Ejemplo n.º 25
0
 protected DiscoveryService(DiscoveryMessageSequenceGenerator discoveryMessageSequenceGenerator)
     : this(discoveryMessageSequenceGenerator, DiscoveryDefaults.DuplicateMessageHistoryLength)
 {
 }
Ejemplo n.º 26
0
 protected DiscoveryService(DiscoveryMessageSequenceGenerator discoveryMessageSequenceGenerator)
     : this(discoveryMessageSequenceGenerator, 0)
 {
 }