Ejemplo n.º 1
0
        protected override IAsyncResult OnBeginCreateInstance(SingletonDictionaryManager <string, IRequestSessionChannel> .SingletonContext singletonContext, string key, object loadingContext, TimeSpan timeout, AsyncCallback callback, object state)
        {
            Uri             uri             = new Uri(key);
            EndpointAddress endpointAddress = new EndpointAddress(uri, SbmpProtocolDefaults.GetEndpointIdentity(uri), new AddressHeader[0]);
            IChannelFactory <IRequestSessionChannel> channelFactory = this.defaultChannelFactory;

            if (!this.clientMode && loadingContext != null && loadingContext is bool && (bool)loadingContext)
            {
                channelFactory = this.securedChannelFactory;
            }
            IRequestSessionChannel requestSessionChannel = channelFactory.CreateChannel(endpointAddress);

            requestSessionChannel.SafeAddFaulted((object s, EventArgs e) => {
                this.RaiseNotifyCleanup(uri);
                try
                {
                    base.BeginUnloadInstance(key, null, true, TimeSpan.FromSeconds(10), new AsyncCallback(ContainerChannelManager.UnloadCallback), this);
                }
                catch (Exception exception1)
                {
                    Exception exception = exception1;
                    if (Fx.IsFatal(exception))
                    {
                        throw;
                    }
                    MessagingClientEtwProvider.TraceClient(() => MessagingClientEtwProvider.Provider.EventWriteExceptionAsWarning(exception.ToString()));
                }
            });
            return(new CompletedAsyncResult <IRequestSessionChannel>(requestSessionChannel, callback, state));
        }
Ejemplo n.º 2
0
 protected override void OnAbortInstance(SingletonDictionaryManager <string, IRequestSessionChannel> .SingletonContext singletonContext, string key, IRequestSessionChannel instance, object unloadingContext)
 {
     instance.Abort();
 }
Ejemplo n.º 3
0
 protected override void OnOpenInstance(SingletonDictionaryManager <string, IRequestSessionChannel> .SingletonContext singletonContext, string key, IRequestSessionChannel instance, TimeSpan timeout)
 {
     (new ContainerChannelManager.OpenInstanceAsyncResult(key, instance, timeout, null, null)).RunSynchronously();
 }
Ejemplo n.º 4
0
        protected override IRequestSessionChannel OnCreateInstance(SingletonDictionaryManager <string, IRequestSessionChannel> .SingletonContext singletonContext, string key, object loadingContext, TimeSpan timeout)
        {
            IAsyncResult asyncResult = this.OnBeginCreateInstance(singletonContext, key, loadingContext, timeout, null, null);

            return(this.OnEndCreateInstance(asyncResult));
        }
Ejemplo n.º 5
0
 protected override IAsyncResult OnBeginOpenInstance(SingletonDictionaryManager <string, IRequestSessionChannel> .SingletonContext singletonContext, string key, IRequestSessionChannel instance, TimeSpan timeout, AsyncCallback callback, object state)
 {
     return((new ContainerChannelManager.OpenInstanceAsyncResult(key, instance, timeout, callback, state)).Start());
 }