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); }
private void AddClientConfigAddedListeners(ICollection <IEventListener> configuredListeners) { ListenerService.RegisterConfigListeners <IDistributedObjectListener>(configuredListeners, ProxyManager.AddDistributedObjectListener); ListenerService.RegisterConfigListeners <IPartitionLostListener>(configuredListeners, PartitionService.AddPartitionLostListener); }
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); } }
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); } }
/// <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(); }
public void Start(ICollection <IEventListener> configuredListeners) { ListenerService.RegisterConfigListeners <ILifecycleListener>(configuredListeners, AddLifecycleListener); FireLifecycleEvent(LifecycleEvent.LifecycleState.Starting); _active.Set(true); FireLifecycleEvent(LifecycleEvent.LifecycleState.Starting); }
public SingleListenerTest() { AudioContext.InitializeForTest(); svcMock = new Mock <ListenerService>() { CallBase = false }; ListenerService.SetTestInstance(svcMock.Object); }
public FileListener(string fileName, string format = null) { if (!String.IsNullOrEmpty(format)) { _format = format; } _fileName = ListenerService.FormatFileName(fileName); ID = Guid.NewGuid(); }
public void LogAction(LogMessage message) { if (message.Importance >= MinimumImportance) { string formattedMessage = ListenerService.FormatMessage(_format, message); lock (PadLock) { Buffer.AppendLine(formattedMessage); } } }
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(); }
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(); }
public void LogAction(LogMessage message) { if (!IsRunning) { return; } if (message.Importance >= MinimumImportance) { string formattedMessage = ListenerService.FormatMessage(_messageFormat, message); Console.WriteLine(formattedMessage); } }
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(); }
//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); } }
/// <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(); }
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(); }
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)); }
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(); } }
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()); }
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); }
public bool StartServer() { ListenerService service = new ListenerService(); return service.StartServer(); }
/// <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) { } }
public void StartClient() { client = new ListenerService(container, false); client.Start(model.LocalNode.Port); connectionController.Start(); }