public InstanceGroupConfig GetInstanceConfig(string groupName, TimeSpan?timeout = null)
        {
            WcfExceptionTranslator <IDxStoreManager> runner         = DxStoreManagerClient.Runner;
            CachedChannelFactory <IDxStoreManager>   channelFactory = this.ChannelFactory;
            TimeSpan?timeSpan = timeout;

            return(runner.Execute <InstanceGroupConfig>(channelFactory, (timeSpan != null) ? new TimeSpan?(timeSpan.GetValueOrDefault()) : this.OperationTimeout, (IDxStoreManager service) => service.GetInstanceConfig(groupName, false)));
        }
        public InstanceSnapshotInfo AcquireSnapshot(string fullKeyName = null, bool isCompress = true, TimeSpan?timeout = null)
        {
            WcfExceptionTranslator <IDxStoreInstance> runner         = DxStoreInstanceClient.Runner;
            CachedChannelFactory <IDxStoreInstance>   channelFactory = this.ChannelFactory;
            TimeSpan?timeSpan = timeout;

            return(runner.Execute <InstanceSnapshotInfo>(channelFactory, (timeSpan != null) ? new TimeSpan?(timeSpan.GetValueOrDefault()) : this.OperationTimeout, (IDxStoreInstance service) => service.AcquireSnapshot(fullKeyName, isCompress)));
        }
        public InstanceStatusInfo GetStatus(TimeSpan?timeout = null)
        {
            WcfExceptionTranslator <IDxStoreInstance> runner         = DxStoreInstanceClient.Runner;
            CachedChannelFactory <IDxStoreInstance>   channelFactory = this.ChannelFactory;
            TimeSpan?timeSpan = timeout;

            return(runner.Execute <InstanceStatusInfo>(channelFactory, (timeSpan != null) ? new TimeSpan?(timeSpan.GetValueOrDefault()) : this.OperationTimeout, (IDxStoreInstance service) => service.GetStatus()));
        }
        public DxStoreAccessReply.GetPropertyNames GetPropertyNames(DxStoreAccessRequest.GetPropertyNames request, TimeSpan?timeout = null)
        {
            WcfExceptionTranslator <IDxStoreAccess> runner         = WcfStoreAccessClient.Runner;
            CachedChannelFactory <IDxStoreAccess>   channelFactory = this.ChannelFactory;
            TimeSpan?timeSpan = timeout;

            return(runner.Execute <DxStoreAccessReply.GetPropertyNames>(channelFactory, (timeSpan != null) ? new TimeSpan?(timeSpan.GetValueOrDefault()) : this.OperationTimeout, (IDxStoreAccess service) => this.TraceRequests <DxStoreAccessRequest.GetPropertyNames, DxStoreAccessReply.GetPropertyNames>(request, new Func <DxStoreAccessRequest.GetPropertyNames, DxStoreAccessReply.GetPropertyNames>(service.GetPropertyNames))));
        }
        public void TriggerRefresh(string reason, bool isForceRefreshCache, TimeSpan?timeout = null)
        {
            WcfExceptionTranslator <IDxStoreManager> runner         = DxStoreManagerClient.Runner;
            CachedChannelFactory <IDxStoreManager>   channelFactory = this.ChannelFactory;
            TimeSpan?timeSpan = timeout;

            runner.Execute(channelFactory, (timeSpan != null) ? new TimeSpan?(timeSpan.GetValueOrDefault()) : this.OperationTimeout, delegate(IDxStoreManager service)
            {
                service.TriggerRefresh(reason, isForceRefreshCache);
            });
        }
        public void StopInstance(string groupName, bool isDisable = true, TimeSpan?timeout = null)
        {
            WcfExceptionTranslator <IDxStoreManager> runner         = DxStoreManagerClient.Runner;
            CachedChannelFactory <IDxStoreManager>   channelFactory = this.ChannelFactory;
            TimeSpan?timeSpan = timeout;

            runner.Execute(channelFactory, (timeSpan != null) ? new TimeSpan?(timeSpan.GetValueOrDefault()) : this.OperationTimeout, delegate(IDxStoreManager service)
            {
                service.StopInstance(groupName, true);
            });
        }
        public void TryBecomeLeader(TimeSpan?timeout = null)
        {
            WcfExceptionTranslator <IDxStoreInstance> runner         = DxStoreInstanceClient.Runner;
            CachedChannelFactory <IDxStoreInstance>   channelFactory = this.ChannelFactory;
            TimeSpan?timeSpan = timeout;

            runner.Execute(channelFactory, (timeSpan != null) ? new TimeSpan?(timeSpan.GetValueOrDefault()) : this.OperationTimeout, delegate(IDxStoreInstance service)
            {
                service.TryBecomeLeader();
            });
        }
        public void ApplySnapshot(InstanceSnapshotInfo snapshot, bool isForce = false, TimeSpan?timeout = null)
        {
            WcfExceptionTranslator <IDxStoreInstance> runner         = DxStoreInstanceClient.Runner;
            CachedChannelFactory <IDxStoreInstance>   channelFactory = this.ChannelFactory;
            TimeSpan?timeSpan = timeout;

            runner.Execute(channelFactory, (timeSpan != null) ? new TimeSpan?(timeSpan.GetValueOrDefault()) : this.OperationTimeout, delegate(IDxStoreInstance service)
            {
                service.ApplySnapshot(snapshot, isForce);
            });
        }
        public void Reconfigure(InstanceGroupMemberConfig[] members, TimeSpan?timeout = null)
        {
            WcfExceptionTranslator <IDxStoreInstance> runner         = DxStoreInstanceClient.Runner;
            CachedChannelFactory <IDxStoreInstance>   channelFactory = this.ChannelFactory;
            TimeSpan?timeSpan = timeout;

            runner.Execute(channelFactory, (timeSpan != null) ? new TimeSpan?(timeSpan.GetValueOrDefault()) : this.OperationTimeout, delegate(IDxStoreInstance service)
            {
                service.Reconfigure(members);
            });
        }
        public void NotifyInitiator(Guid commandId, string sender, int instanceNumber, bool isSucceeded, string errorMessage, TimeSpan?timeout = null)
        {
            WcfExceptionTranslator <IDxStoreInstance> runner         = DxStoreInstanceClient.Runner;
            CachedChannelFactory <IDxStoreInstance>   channelFactory = this.ChannelFactory;
            TimeSpan?timeSpan = timeout;

            runner.Execute(channelFactory, (timeSpan != null) ? new TimeSpan?(timeSpan.GetValueOrDefault()) : this.OperationTimeout, delegate(IDxStoreInstance service)
            {
                service.NotifyInitiator(commandId, sender, instanceNumber, isSucceeded, errorMessage);
            });
        }
Exemple #11
0
        public TReturnType Execute <TReturnType>(CachedChannelFactory <TService> factory, TimeSpan?timeout, Func <TService, TReturnType> action)
        {
            TReturnType result;

            try
            {
                result = WcfUtils.Run <TService, TReturnType>(factory, timeout, action);
            }
            catch (Exception ex)
            {
                Exception ex2 = WcfExceptionTranslator <TService> .TranslateException(ex, new Func <Exception, Exception>(this.GenerateTransientException), new Func <Exception, Exception>(this.GeneratePermanentException));

                if (ex2 != null)
                {
                    throw ex2;
                }
                throw;
            }
            return(result);
        }