Exemplo n.º 1
0
        public void CloseCachedChannels()
        {
            Queue <TChannel> obj = this.cachedChannels;

            lock (obj)
            {
                while (this.cachedChannels.Any <TChannel>())
                {
                    PsdzClientBase <TChannel> .CloseChannel(this.cachedChannels.Dequeue());
                }
            }
        }
Exemplo n.º 2
0
        protected TResult CallFunction <TResult>(Func <TChannel, TResult> func)
        {
            TChannel tchannel = default(TChannel);
            TResult  result;

            try
            {
                tchannel = this.GetChannel();
                result   = func(tchannel);
            }
            catch (FaultException <ArgumentException> faultException)
            {
                throw faultException.Detail;
            }
            catch (FaultException <FileNotFoundException> faultException2)
            {
                throw faultException2.Detail;
            }
            catch (FaultException <PsdzRuntimeException> faultException3)
            {
                throw faultException3.Detail;
            }
            catch (FaultException)
            {
                throw;
            }
            catch (CommunicationException)
            {
                throw;
            }
            catch (TimeoutException)
            {
                throw;
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (!this.EnqueueIfOpened(tchannel))
                {
                    PsdzClientBase <TChannel> .CloseChannel(tchannel);
                }
            }
            return(result);
        }
Exemplo n.º 3
0
        protected void CallMethod(Action <TChannel> func, bool cacheChannel = true)
        {
            TChannel tchannel = default(TChannel);

            try
            {
                tchannel = this.GetChannel();
                func(tchannel);
            }
            catch (FaultException <ArgumentException> faultException)
            {
                throw faultException.Detail;
            }
            catch (FaultException <FileNotFoundException> faultException2)
            {
                throw faultException2.Detail;
            }
            catch (FaultException <PsdzRuntimeException> faultException3)
            {
                throw faultException3.Detail;
            }
            catch (FaultException)
            {
                throw;
            }
            catch (CommunicationException)
            {
                throw;
            }
            catch (TimeoutException)
            {
                throw;
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (!cacheChannel || !this.EnqueueIfOpened(tchannel))
                {
                    PsdzClientBase <TChannel> .CloseChannel(tchannel);
                }
            }
        }