コード例 #1
0
 internal virtual void OnCoreTopologyChange(CoreTopology coreTopology)
 {
     Log.info("Notified of core topology change " + coreTopology);
     this._coreTopology      = coreTopology;
     this._localCoreTopology = coreTopology.FilterTopologyByDb(_localDBName);
     ListenerService.notifyListeners(coreTopology);
 }
コード例 #2
0
 private void AddClientConfigAddedListeners(ICollection <IEventListener> configuredListeners)
 {
     ListenerService.RegisterConfigListeners <IDistributedObjectListener>(configuredListeners,
                                                                          ProxyManager.AddDistributedObjectListener);
     ListenerService.RegisterConfigListeners <IPartitionLostListener>(configuredListeners,
                                                                      PartitionService.AddPartitionLostListener);
 }
コード例 #3
0
 private void Start()
 {
     try
     {
         var configuredListeners = InstantiateConfiguredListenerObjects();
         LifecycleService.Start(configuredListeners);
         InvocationService.Start();
         ClusterService.Start(configuredListeners);
         ConnectionManager.Start();
         ClusterService.WaitInitialMemberListFetched();
         ConnectionManager.ConnectToAllClusterMembers();
         ListenerService.Start();
         ProxyManager.Init(ClientConfig);
         LoadBalancer.Init(((IHazelcastInstance)this).Cluster, ClientConfig);
         // Statistics.Start();
         AddClientConfigAddedListeners(configuredListeners);
     }
     catch (Exception e)
     {
         try
         {
             LifecycleService.Terminate();
         }
         catch (Exception)
         {
             //ignore
         }
         throw ExceptionUtil.Rethrow(e);
     }
 }
コード例 #4
0
ファイル: Client.cs プロジェクト: iKoltcov/AzureServer
        static async Task Main(string[] args)
        {
            var builder = new ConfigurationBuilder()
                          .SetBasePath(Directory.GetCurrentDirectory())
                          .AddJsonFile("appsettings.json", false, true);
            var configuration = builder.Build();

            var serverUrlAddresses = JsonConvert.DeserializeObject <IEnumerable <ServerModel> >(configuration["ServersJson"]);

            IAzureHttpClient azureHttpClient = new AzureHttpClient();
            IListenerService listenerService = new ListenerService(azureHttpClient, serverUrlAddresses);

            Console.CancelKeyPress += (sender, eventArgs) => isStop = true;

            while (!isStop)
            {
                Console.Clear();
                foreach (var server in await listenerService.GetInstanceIdServers())
                {
                    Console.WriteLine($"{server.Name} - {server.Url}\tInstanceId: {server.InstanceId} [{server.Ping} ms.]");
                }
                Console.WriteLine("Press Ctrl+C or Ctrl+Break for exit");
                Thread.Sleep(1000);
            }
        }
コード例 #5
0
        /// <summary>
        /// ListenSCP
        /// </summary>
        private static void ListenSCP()
        {
            ListenerService _listenerService = new ListenerService();

            _listenerService.StartService("SCP", userName: "******", password: "", address: "192.168.100.3", path: "pms", port: 22);
            _listenerService.ListenService();
        }
コード例 #6
0
 public void Start(ICollection <IEventListener> configuredListeners)
 {
     ListenerService.RegisterConfigListeners <ILifecycleListener>(configuredListeners, AddLifecycleListener);
     FireLifecycleEvent(LifecycleEvent.LifecycleState.Starting);
     _active.Set(true);
     FireLifecycleEvent(LifecycleEvent.LifecycleState.Starting);
 }
コード例 #7
0
 public SingleListenerTest()
 {
     AudioContext.InitializeForTest();
     svcMock = new Mock <ListenerService>()
     {
         CallBase = false
     };
     ListenerService.SetTestInstance(svcMock.Object);
 }
コード例 #8
0
        public FileListener(string fileName, string format = null)
        {
            if (!String.IsNullOrEmpty(format))
            {
                _format = format;
            }

            _fileName = ListenerService.FormatFileName(fileName);
            ID        = Guid.NewGuid();
        }
コード例 #9
0
        public void LogAction(LogMessage message)
        {
            if (message.Importance >= MinimumImportance)
            {
                string formattedMessage = ListenerService.FormatMessage(_format, message);

                lock (PadLock)
                {
                    Buffer.AppendLine(formattedMessage);
                }
            }
        }
コード例 #10
0
        static void Main(string[] args)
        {
            //virtual rtu configures itself, then starts the tcp server on port 502 (modbus-tcp)
            //a scada client will connect over 502 uses the IP address or dns name of this virtual rtu

            //once a connection is made the v-rtu will read the RtuMap and determine if a matching UnitID
            //exists in the ModBusTcp header.

            Console.WriteLine("---------------------------------------------");
            Console.WriteLine("------------Starting Virtual RTU ----------");
            Console.WriteLine("---------------------------------------------");

            TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;

            su = new Startup();
            su.Configure();


            //IConfigurationBuilder builder = new ConfigurationBuilder();
            //Configure(builder);


            // create service collection
            var serviceCollection = new ServiceCollection();

            //ConfigureServices(serviceCollection);
            su.ConfigureServices(serviceCollection);

            // create service provider
            var serviceProvider = serviceCollection.BuildServiceProvider();

            // entry to run app
            listenerService          = serviceProvider.GetService <ListenerService>();
            listenerService.OnError += ListenerService_OnError;
            Task task = listenerService.RunAsync();

            Task.WhenAll(task);


            done = new ManualResetEventSlim(false);

            Console.CancelKeyPress += (sender, eventArgs) =>
            {
                done.Set();
                eventArgs.Cancel = true;
            };

            Console.WriteLine("Virtual RTU is listening...");
            done.Wait();
        }
コード例 #11
0
 internal void DoShutdown()
 {
     Clients.TryRemove(_instanceName, out _);
     DisposeAll(_onClientShutdownDisposables);
     // Statistics.Destroy();
     ExecutionService.Shutdown();
     ConnectionManager.Shutdown();
     ProxyManager.Destroy();
     InvocationService.Shutdown();
     NearCacheManager.Shutdown();
     ListenerService.Dispose();
     SerializationService.Destroy();
     CredentialsFactory.Dispose();
 }
コード例 #12
0
ファイル: ConsoleListener.cs プロジェクト: hdbyte/Logger
        public void LogAction(LogMessage message)
        {
            if (!IsRunning)
            {
                return;
            }

            if (message.Importance >= MinimumImportance)
            {
                string formattedMessage = ListenerService.FormatMessage(_messageFormat, message);

                Console.WriteLine(formattedMessage);
            }
        }
コード例 #13
0
ファイル: Program.cs プロジェクト: SethTales/FileYeti
        public static void Main()
        {
            var transferJobRepository = new TransferJobRepository();
            var storageRoot           = "C:/temp";
            var diskRepository        = new DiskRepository(storageRoot);

            Int32     port      = 13000;
            IPAddress localAddr = IPAddress.Any;
            var       server    = new TcpListener(localAddr, port);
            TcpClient client    = new TcpClient();

            var handlerFactory  = new HandlerFactory(transferJobRepository, diskRepository, server);
            var listenerService = new ListenerService(server, client, handlerFactory);

            listenerService.Listen();
        }
コード例 #14
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void refreshCoreTopology() throws InterruptedException
        private void RefreshCoreTopology()
        {
            WaitOnHazelcastInstanceCreation();

            CoreTopology       newCoreTopology = getCoreTopology(_hazelcastInstance, Config, Log);
            TopologyDifference difference      = _coreTopology.difference(newCoreTopology);

            _coreTopology      = newCoreTopology;
            _localCoreTopology = newCoreTopology.FilterTopologyByDb(_localDBName);

            if (difference.HasChanges())
            {
                Log.info("Core topology changed %s", difference);
                ListenerService.notifyListeners(_coreTopology);
            }
        }
コード例 #15
0
        /// <summary>
        /// ListenUDP
        /// </summary>
        private static void ListenUDP()
        {
            bool done = false;

            //Hardcoding Controllers
            ControllerService _controllerService = new ControllerService();

            _controllerService.Controllers = new List <string> {
                "Controller-1", "Controller-2"
            };

            //Listening UDP Server
            ListenerService _listenerService = new ListenerService();

            _listenerService.StartService("UDP", port: 8888);

            StringBuilder sb    = new StringBuilder();
            long          ticks = 10 * 1000;
            Stopwatch     sw    = new Stopwatch();

            sw.Start();

            while (!done)
            {
                string content = _listenerService.ListenService();
                sb.Append(content);

                if (sw.ElapsedMilliseconds >= ticks)
                {
                    foreach (string controller in _controllerService.Controllers)
                    {
                        if (!sb.ToString().Contains(controller))
                        {
                            Console.WriteLine(controller + " Dead\n");
                        }
                    }

                    sb.Clear();
                    sw.Restart();
                }

                Console.WriteLine(content);
            }

            sw.Stop();
            _listenerService.StopService();
        }
コード例 #16
0
        public ListenerTest()
        {
            _context = new NorthwindContext();
            var parser          = new Parser();
            var orderRepository = new OrderRepository(_context);
            var converter       = new Converter();
            var filter          = new ExpressionBuilder <Order>();

            _service = new ListenerService(parser, orderRepository, converter, filter);
            Thread listenerThread = new Thread(_service.Listen);

            listenerThread.Start();
            _client           = new HttpClient();
            _uriBuilder       = new UriBuilder("http://localhost:82");
            _uriBuilder.Query = "customerId=VINET";
            _converter        = new Converter();
        }
コード例 #17
0
        private Reko.Decompiler CreateRekoInstance(CefV8Context context)
        {
            var fsSvc    = new FileSystemServiceImpl();
            var listener = new ListenerService(context, eventListeners);
            var dfSvc    = new DecompiledFileService(fsSvc, listener);

            services.AddService(typeof(IFileSystemService), fsSvc);
            services.AddService(typeof(DecompilerEventListener), listener);
            var configSvc = RekoConfigurationService.Load(services, "reko/reko.config");

            services.AddService(typeof(IConfigurationService), configSvc);
            services.AddService(typeof(IDecompiledFileService), dfSvc);
            services.AddService(typeof(ITypeLibraryLoaderService), new TypeLibraryLoaderServiceImpl(services));
            services.AddService(typeof(IPluginLoaderService), new PluginLoaderService());
            var loader = new Reko.Loading.Loader(services);

            return(new Reko.Decompiler(loader, services));
        }
コード例 #18
0
        public void Run()
        {
            var receiverThread = new Thread(() => receiver.Start());

            receiverThread.Start();

            var processorThread = new Thread(() => processor.Start());

            processorThread.Start();

            for (var i = 0; i < 3; ++i)
            {
                Console.WriteLine("Starting listener: {0}", i);

                var listener       = new ListenerService(i);
                var listenerThread = new Thread(listener.Start);
                listenerThread.Start();
            }
        }
コード例 #19
0
 private HazelcastClient(Configuration config)
 {
     Configuration       = config;
     HazelcastProperties = new HazelcastProperties(config.Properties);
     if (config.InstanceName != null)
     {
         _instanceName = config.InstanceName;
     }
     else
     {
         _instanceName = "hz.client_" + _id;
     }
     LifecycleService = new LifecycleService(this);
     try
     {
         //TODO make partition strategy parametric
         var partitioningStrategy = new DefaultPartitioningStrategy();
         SerializationService = new SerializationServiceBuilder().SetConfig(config.SerializationConfig)
                                .SetPartitioningStrategy(partitioningStrategy)
                                .SetVersion(IO.Serialization.SerializationService.SerializerVersion).Build();
     }
     catch (Exception e)
     {
         throw ExceptionUtil.Rethrow(e);
     }
     ProxyManager = new ProxyManager(this);
     //TODO EXECUTION SERVICE
     ExecutionService         = new ExecutionService(_instanceName);
     LoadBalancer             = config.LoadBalancer ?? new RoundRobinLB();
     PartitionService         = new PartitionService(this);
     AddressProvider          = new AddressProvider(Configuration.NetworkConfig, HazelcastProperties);
     ConnectionManager        = new ConnectionManager(this);
     InvocationService        = new InvocationService(this);
     ListenerService          = new ListenerService(this);
     ClusterService           = new ClusterService(this);
     LockReferenceIdGenerator = new ClientLockReferenceIdGenerator();
     // Statistics = new Statistics(this);
     NearCacheManager   = new NearCacheManager(this);
     CredentialsFactory = config.SecurityConfig.AsCredentialsFactory() ??
                          new StaticCredentialsFactory(new UsernamePasswordCredentials());
 }
コード例 #20
0
 private HazelcastClient(ClientConfig config)
 {
     ClientConfig = config;
     if (config.InstanceName != null)
     {
         _instanceName = config.InstanceName;
     }
     else
     {
         _instanceName = "hz.client_" + _id;
     }
     LifecycleService = new LifecycleService(this);
     try
     {
         //TODO make partition strategy parametric
         var partitioningStrategy = new DefaultPartitioningStrategy();
         SerializationService = new SerializationServiceBuilder().SetConfig(config.GetSerializationConfig())
                                .SetPartitioningStrategy(partitioningStrategy)
                                .SetVersion(IO.Serialization.SerializationService.SerializerVersion).Build();
     }
     catch (Exception e)
     {
         throw ExceptionUtil.Rethrow(e);
     }
     ProxyManager = new ProxyManager(this);
     //TODO EXECUTION SERVICE
     ExecutionService         = new ExecutionService(_instanceName, config.GetExecutorPoolSize());
     LoadBalancer             = config.GetLoadBalancer() ?? new RoundRobinLB();
     PartitionService         = new PartitionService(this);
     AddressProvider          = new AddressProvider(ClientConfig);
     ConnectionManager        = new ConnectionManager(this);
     InvocationService        = new InvocationService(this);
     ListenerService          = new ListenerService(this);
     ClusterService           = new ClusterService(this);
     LockReferenceIdGenerator = new ClientLockReferenceIdGenerator();
     // Statistics = new Statistics(this);
     NearCacheManager   = new NearCacheManager(this);
     CredentialsFactory = InitCredentialsFactory(config);
 }
コード例 #21
0
ファイル: EFService.cs プロジェクト: san90279/UK_OAS
 public bool StartServer()
 {
     ListenerService service = new ListenerService();
     return service.StartServer();
 }
コード例 #22
0
        /// <summary>
        /// ListenUDP
        /// </summary>
        private void ListenUDP()
        {
            try
            {
                bool done = false;

                //Hardcoding Controllers
                ControllerService _controllerService = new ControllerService();
                _controllerService.Controllers = controllerList;

                //Listening UDP Server
                ListenerService _listenerService = new ListenerService();
                _listenerService.StartService("UDP", port: 8888);

                string    sb    = string.Empty;
                long      ticks = 10 * 1000;
                Stopwatch sw    = new Stopwatch();
                sw.Start();

                while (!done)
                {
                    string content = _listenerService.ListenService();
                    if (content.Contains("Exception"))
                    {
                        for (int i = 0; i < controllerList.Count; i++)
                        {
                            Publish(i, Brushes.Red);
                        }
                    }
                    else
                    {
                        if (content.LastIndexOf('-') == content.Length - 3)
                        {
                            string[] data = content.Split('-');
                            if (data.Length == 3)
                            {
                                //Level based statistics
                                UpdateLevelStatistics(Convert.ToInt32(data[0]), Convert.ToInt32(data[1]));
                            }
                            else
                            {
                                //Zone based statistics
                                UpdateZoneStatistics(Convert.ToInt32(data[0]), Convert.ToInt32(data[1]), Convert.ToInt32(data[2]));
                            }
                        }
                        else
                        {
                            sb += content;

                            if (sw.ElapsedMilliseconds >= ticks)
                            {
                                for (int i = 0; i < _controllerService.Controllers.Count; i++)
                                {
                                    if (!sb.ToString().Contains(_controllerService.Controllers[i]))
                                    {
                                        Publish(i, Brushes.Red);
                                    }
                                    else
                                    {
                                        Publish(i, Brushes.LightGreen);
                                    }
                                }

                                sb = string.Empty;
                                sw.Restart();
                            }
                        }
                    }
                }

                sw.Stop();
                _listenerService.StopService();
            }
            catch (Exception ex)
            {
            }
        }
コード例 #23
0
ファイル: ApplicationCore.cs プロジェクト: gmcclelland90/FAP
 public void StartClient()
 {
     client = new ListenerService(container, false);
     client.Start(model.LocalNode.Port);
     connectionController.Start();
 }