private FloorStatus()
        {
            try
            {
                _updateFloorStatusOld = Extensions.GetAppSettingValueBool("UpdateFloorStatusOld", false);
                if (_updateFloorStatusOld)
                {
                    _oServer = IPCServer.GetInstance(ConfigManager.Read("RemotingServer"),
                    Convert.ToInt32(ConfigManager.Read("RemotingServerPort")));

                    int itmpInterval = Convert.ToInt32(ConfigManager.Read("RemotingServerInterval")) * 1000;

                    if (itmpInterval > 5000)
                    {
                        iInterval = itmpInterval;
                    }

                    mre_isStoped = new ManualResetEvent(false);
                    Thread th = new Thread(UpdateFloorStatus);
                    th.Start();
                }
                else
                {
                    _exec = ExecutorServiceFactory.CreateExecutorService();
                    CDOCentralServerHostApplication.Start(_exec);
                }
            }
            catch (Exception ex)
            {
                LogManager.WriteLog("FloorStatus : Unable to initialize the reference type." + ex.Message, LogManager.enumLogLevel.Error);
            }
        }
        /// <summary>
        /// Initializes the specified callback.
        /// </summary>
        /// <param name="callback">The callback.</param>
        /// <param name="finishedCallback">The finished callback.</param>
        /// <param name="abortCallback">The abort callback.</param>
        /// <param name="ownerForm">The owner form.</param>
        /// <param name="parentForm">The parent form.</param>
        public void Initialize(IExecutorService executorService,
            int minimum, int maximum,
            AsyncWaitCallback callback,
            AsyncWaitCallback finishedCallback,
            AsyncWaitCallback abortCallback,
            Form ownerForm,
            bool closeOnComplete)
        {
            pbarStatus.Style = ProgressBarStyle.Marquee;
            _elapsedTimer.StopAndStart();

            _executorService = executorService;
            _callback = callback;
            _finishedCallback = finishedCallback;
            _abortCallback = abortCallback;

            this.IsCancellable = (_executorService != null);
            if (_executorService != null)
            {
                IExecutorService2 executor2 = _executorService as IExecutorService2;
                if (executor2 != null)
                {
                    executor2.Reset();
                }
            }

            this.OwnerForm = ownerForm;
            this.UpdateStatusProgress(0, AsyncProgressMessages.GetMessage(-1));
            //Log.LogFormatMessage += new LogFormatMessageHandler(Log_LogFormatMessage);
            this.CloseOnComplete = closeOnComplete;
            this.InitializeProgress(minimum, maximum);
        }
 public ExCommsServerServiceHostFactory(IExecutorService executorService)
     : base(executorService, ExCommsServerConfigStoreFactory.Store, BMC.ExComms.Contracts.Proxies.ProxyHelper.BaseUrl,
         ExCommsServerConfigStoreFactory.Store.ExCommServerTcpPort,
         ExCommsServerConfigStoreFactory.Store.ExCommServerHttpPort,
         0)
 {
 }
 protected ExCommsServiceInfo(IExecutorService executorService,
     ExCommsHostingModuleType moduleType,
     IEnumerable<IExCommsServerHostFactoryActivator> activators)
     : base(executorService)
 {
     _factory = new ExCommsServerHostFactoryActivatorFactory(executorService, moduleType, activators);
 }
        internal static IExMonitorTransceiver RegisterAndGet(IExecutorService executorService, ExMonitorServerImpl monitorServer)
        {
            using (ILogMethod method = Log.LogMethod("", "Method"))
            {
                try
                {
                    if (_instance == null)
                    {
                        lock (_instanceLock)
                        {
                            if (_instance == null)
                            {
                                _instance = new MonitorTransceiver_InMemory(executorService, monitorServer);
                            }
                        }
                    }

                    return _instance;
                }
                catch (Exception ex)
                {
                    method.Exception(ex);
                }

                return _instance;
            }
        }
 internal AppNotifyServiceClientCallback(IExecutorService executorService, IAppNotifyServiceCallback callback)
     : base(executorService)
 {
     _callback = callback;
     _queue = new BlockingBoundQueueUser<AppNotifyData>(executorService, -1);
     Extensions.CreateThreadAndStart(new ThreadStart(this.OnReceiveMessages), "AppNotifyServiceClientCallback_OnReceiveMessages_");
 }
 internal ExchangeConfigStore()
 {
     _executor = ExecutorServiceFactory.CreateExecutorService();
     _cfgExchange = ConfigApplicationFactory.Get<IConfig_ExchangeServer>();
     ConfigStoreManager.PullValues(this);
     //ConfigStoreManager.Register(new System.Runtime.Remoting.ObjectHandle(this));
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="AxAsyncProgress"/> class.
        /// </summary>
        public AsyncDialogForm(string formCaption, IExecutorService executorService,
            int minimum, int maximum,
            AsyncWaitCallback callback,
            AsyncWaitCallback finishedCallback,
            AsyncWaitCallback abortCallback)
        {
            InitializeComponent();
            SetTagProperty();
            this.ResolveResources();
            _elapsedTimer = AsyncProgressTimerFactory.Create();
            _executorService = executorService;
            _actualCallback = new WaitCallback(this.ExecAsync);
            _updateStatus = new UpdateAsyncStatusHandler(this.UpdateStatus);
            _updateStatusProgress = new UpdateAsyncStatusProgressHandler(this.UpdateStatusProgress);
            _enableButton = new EnableButtonHandler(this.EnableOKButton);
            this.InitializeProgress(minimum, maximum);

            btnCancel.Enabled = (_executorService != null);
            if (_executorService != null)
            {
                IExecutorService2 executor2 = _executorService as IExecutorService2;
                if (executor2 != null)
                {
                    executor2.Reset();
                }
            }

            this.Text = formCaption;
            lblStatus.Text = formCaption;
            this.Initialize(callback, finishedCallback, abortCallback, this);
        }
        //private bool _isListening = true;

        /// <summary>
        /// Initializes a new instance of the <see cref="ThreadInvoker"/> class.
        /// </summary>
        /// <param name="ownerForm">The owner form.</param>
        public ThreadInvoker(Form ownerForm, IExecutorService executorService, int sleepInterval)
        {
            this.OwnerForm = ownerForm;
            this.ExecutorService = executorService;
            this.SleepInterval = sleepInterval;
            _actualCallback = new WaitCallback(this.ExecAsync);
            _updateStatus = new UpdateAsyncStatusObjectHandler(this.UpdateStatusObject);
        }
 private AppNotifyServiceFactory(IExecutorService executorService, string baseAddress, string path, Type[] knownTypes)
     : base(executorService)
 {
     _queue = new BlockingBoundQueueUser<AppNotifyData>(executorService, -1);
     Extensions.CreateThreadAndStart(new ThreadStart(this.OnBroadcastMessages), "AppNotifyServiceFactory_OnBroadcastMessages_");
     _mreShutdown.Set();
     this.Start(baseAddress, path);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="AsyncProgressForm"/> class.
 /// </summary>
 public AsyncDialogContinuousForm(string formCaption, IExecutorService executorService,
     AsyncWaitCallback callback,
     AsyncWaitCallback finishedCallback,
     AsyncWaitCallback abortCallback)
 {
     InitializeComponent();
     this.Text = formCaption;
     axAsyncProgress.Initialize(executorService, callback, finishedCallback, abortCallback, this, true);
 }
 public WpfAsyncProgress(string formCaption, IExecutorService executorService,
     int minimum, int maximum,
     AsyncWaitCallback callback,
     AsyncWaitCallback finishedCallback,
     AsyncWaitCallback abortCallback)
 {
     InitializeComponent();
     this.Title = formCaption;
     axAsyncProgress.Initialize(formCaption, executorService, minimum, maximum, callback, finishedCallback, abortCallback, this, true);
 }
        protected FFTransReceiver(FFTransceiverArgs arg, IExecutorService executorService)
            : base(executorService)
        {
            _arg = arg;
            this.Initialize();

            // receive from socket
            new Thread(new ThreadStart(OnListenReceiveFromSocket))
            {
                IsBackground = true,
            }.Start();
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="MessageQueueProcessor"/> class.
 /// </summary>
 /// <param name="executorService">The executor service.</param>
 /// <param name="servicePath">The service path.</param>
 /// <param name="isTransactional">if set to <c>true</c> [is transactional].</param>
 /// <param name="formatter">The formatter.</param>
 protected MessageQueueProcessor(IExecutorService executorService, string servicePath,
     bool isTransactional, IMessageFormatter formatter,
     int queueTimeout,
     IDictionary<string, IMessageFormatter> messageFormatters)
     : base(executorService)
 {
     _servicePath = servicePath;
     _isTransactional = isTransactional;
     _formatter = formatter;
     _messageFormatters = messageFormatters;
     _queueTimeout = (queueTimeout < 10 ? 10 : queueTimeout);
     this.Initialize();
 }
 internal CDOCentralServerImpl(IExecutorService executor)
     : base(executor)
 {
     _serviceStatuses = new SortedDictionary<string, ServiceStatusDto>(StringComparer.InvariantCultureIgnoreCase)
     {
         { "Stopped", ServiceStatusDto.Stopped },
         { "StartPending", ServiceStatusDto.StartPending },
         { "StopPending", ServiceStatusDto.StopPending },
         { "Running", ServiceStatusDto.Running },
         { "ContinuePending", ServiceStatusDto.ContinuePending },
         { "PausePending", ServiceStatusDto.PausePending },
         { "Paused", ServiceStatusDto.Paused },
     };
 }
 public SocketTransceiver(IExecutorService executorService, string ipAddress, int portNo)
 {
     IUdpSocketTransceiver socket = UdpSocketTransceiverFactory.Create(executorService, new UdpSocketTransceiverParameter()
     {
         IPAddress = ipAddress,
         ListenWaitTime = 100,
         PortNo = portNo,
         UseInternalQueue = false,
     });
     _sockReceiver = socket;
     _sockTransmitter = socket;
     _sockReceiver.DataReceived += new UdpSocketReceivedDataHandler(OnReceiveUdpEntityFromSocket);
     Current = this;
 }
        public object CreateSingletonInstance(IExecutorService executorService)
        {
            if (_singletonInstance == null)
            {
                lock (_singletonInstanceLock)
                {
                    if (_singletonInstance == null)
                    {
                        _singletonInstance = this.OnCreateSingletonInstance(executorService);
                    }
                }
            }

            return _singletonInstance;
        }
        public ServiceMainForm(IExecutorService executorService, IServiceHost serviceHost)
        {
            InitializeComponent();
            SetTagProperty();
            this.ResolveResources();

            _normalFont = this.Font;
            _boldFont = new Font(this.Font, FontStyle.Bold);

            _queue = ProducerConsumerQueueFactory.Create<LogItem>(executorService, -1);
            _queue.Dequeue += OnQueue_Dequeue;

            Log.GlobalWriteToExternalLog += new WriteToExternalLogHandler(Log_WriteToExternalLog);
            _setStatus = new SetStatusHandler(this.SetStatus);

            _serviceHost = serviceHost;
        }
        internal static IFFExecutor RegisterAndGet(IExecutorService executorService)
        {
            using (ILogMethod method = Log.LogMethod("FFExecutorFactory", "Method"))
            {
                try
                {
                    _executorHelper = new SingletonThreadHelper<IFFExecutor>(
                                       new Lazy<IFFExecutor>(() => new FFExecutor_InMemory(executorService)));
                }
                catch (Exception ex)
                {
                    method.Exception(ex);
                }

                return Instance;
            }
        }
        /// <summary>
        /// Initializes the user control.
        /// </summary>
        /// <param name="callback">The callback.</param>
        /// <param name="finishedCallback">The finished callback.</param>
        /// <param name="abortCallback">The abort callback.</param>
        /// <param name="ownerWindow">The owner form.</param>
        /// <param name="parentForm">The parent form.</param>
        public void Initialize(string formCaption, IExecutorService executorService,
            int minimum, int maximum)
        {
            _executorService = executorService;
            this.InitializeProgress(minimum, maximum);
            lblStatus.Text = "Loading...";

            this.IsCancellable = (_executorService != null);
            if (_executorService != null)
            {
                IExecutorService2 executor2 = _executorService as IExecutorService2;
                if (executor2 != null)
                {
                    executor2.Reset();
                }
            }
        }
        public static IExCommsServiceInfo Run(IExecutorService executorService, string[] args)
        {
            using (ILogMethod method = Log.LogMethod("CommsServicesFactrory", "Run"))
            {
                IExCommsServiceInfo result = null;

                try
                {
                    var activators = MEFHelper.GetExportedValues<IExCommsServerHostFactoryActivator>();
                    string key = args.Length == 0 ? "/all" :
                                ((args[0] == "/debug") ? 
                                ((args.Length == 1) ? "/all" : args[1]) : args[0]);

                    if (_servicesInfo.ContainsKey(key))
                    {
                        result = _servicesInfo[key](executorService, activators);
                    }
                }
                catch (Exception ex)
                {
                    method.Exception(ex);
                }

                return result;
            }
        }
 public ExCommsServiceInfo_MonitorServer_Processor(IExecutorService executorService, ExCommsHostingModuleType moduleType, IEnumerable<IExCommsServerHostFactoryActivator> activators)
     : base(executorService, moduleType, activators)
 {
 }
 protected ListenerBase(IExecutorService executor)
 {
     this.Executor = executor;
 }
Exemple #24
0
 private AppNotifyServiceFactory(IExecutorService executorService, string baseAddress, string path)
     : this(executorService, baseAddress, path, null)
 {
 }
 public ExMonitorServerImpl(IExecutorService executorService)
     : base(executorService)
 {
     Current = this;
     this.Initialize();
 }
        protected override bool BindInternal()
        {
            if (_handler == null)
            {
                _executorService = ExecutorServiceFactory.CreateExecutorService();
                if (_hasThreads)
                {
                    _pool = ThreadPoolExecutorFactory.CreateThreadPool<ClientsInfo>(
                        new ThreadPoolExecutorArg()
                        {
                            ExecutorService = _executorService,
                            PoolType = (_totalThreads == -1 ? ThreadPoolType.NonBlockDynamic : ThreadPoolType.AsyncTaskQueue),
                            ThreadCount = _totalThreads,

                        });
                    _pool.ProcessItem += new ExecutorProcessItemHandler<ClientsInfo>(OnPool_ProcessItem);
                }

                _handler = new TcpListener(_localEndPoint as IPEndPoint);
                _socket = _handler.Server;
                _handler.Start();

                if (Extensions.UseTaskInsteadOfThread)
                    Extensions.CreateLongRunningTask(this.OnListen);
                else
                    Extensions.CreateThreadAndStart(new System.Threading.ThreadStart(this.OnListen));
            }
            return (_handler != null);
        }
        protected override bool StopInternal()
        {
            if (_executorService != null)
            {
                _executorService.AwaitTermination(new TimeSpan(0, 5, 0));
                _executorService = null;

                if (_hasThreads)
                {
                    _pool.Dispose();
                    _pool = null;
                }
            }
            return true;
        }
Exemple #28
0
 public static AppNotifyServiceFactory GetFactory(IExecutorService executorService, string baseAddress, string path, Type[] knownTypes)
 {
     return(new AppNotifyServiceFactory(executorService, baseAddress, path, knownTypes));
 }
 /**
  * @param client        the client
  * @param threadFactory thread factory to use or null for a default
  */
 public ConnectionStateManager(CuratorFramework client, int queueSize)
 {
     this.client = client;
     service = ThreadUtils.newSingleThreadExecutor(GetType().FullName);
     QUEUE_SIZE = queueSize <= 0 ? 25 : queueSize;
 }
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 /// <param name="mutexGuid">The mutex unique identifier.</param>
 /// <param name="args">The args.</param>
 protected ServiceEntryPoint(Guid mutexGuid, string[] args)
 {
     _mutexGuid = mutexGuid;
     _args = args;
     _executorService = ExecutorServiceFactory.CreateExecutorService();
 }
 protected ExCommsServerHostFactory(IExecutorService executorService, IExchangeConfigStore configStore, string basePath, int tcpPort, int httpPort, int webHttpPort)
     : base(executorService, basePath, tcpPort, httpPort, webHttpPort)
 {
     _configStore = configStore;
 }
 internal ThrottleFirstSubscriber(IFlowableSubscriber <T> actual, TimeSpan delay, IExecutorService executor)
 {
     this.actual   = actual;
     this.delay    = (long)delay.TotalMilliseconds;
     this.executor = executor;
 }
 public ExCommsServiceInfo_CommunicationServer(IExecutorService executorService, ExCommsHostingModuleType moduleType, IEnumerable<IExCommsServerHostFactoryActivator> activators)
     : base(executorService, moduleType, activators)
 {
 }
 public FlowableThrottleFirst(IFlowable <T> source, TimeSpan delay, IExecutorService executor) : base(source)
 {
     this.delay    = delay;
     this.executor = executor;
 }