Example #1
0
 private void HandleAccpetNewEvent(IReactor reactor)
 {
     if (this.OnAcceptNew != null)
     {
         this.OnAcceptNew(reactor);
     }
 }
Example #2
0
        public IDisposable Chain <T>(IReactor <T> another) where T : IRxn
        {
            var resources = new CompositeDisposable();

            Input.Subscribe(e => another.Input.OnNext((T)e), e => ReportExceptions.OnNext(new LogMessage <Exception>()
            {
                Reporter = another.ReporterName, Level = LogLevel.Error, Message = e
            })).DisposedBy(resources);
            another.Output.Subscribe(r => Output.OnNext(r), e => ReportExceptions.OnNext(new LogMessage <Exception>()
            {
                Reporter = another.ReporterName, Level = LogLevel.Error, Message = e
            })).DisposedBy(resources);
            another.Errors.Subscribe(ReportExceptions).DisposedBy(_resources);//only report errors so we can see error state

            var health = AttachHealthMonitorIf(another);

            _molecules.Add(another);
            OnInformation("Chained to '{0}'", another.Name);

            return(new CompositeDisposable(resources, new DisposableAction(() =>
            {
                if (health != null)
                {
                    health.Dispose();
                }

                OnInformation("Unchained '{0}'", another.Name);
                _molecules.Remove(another);
            }))
                   .DisposedBy(_resources));
        }
Example #3
0
 internal StreamConnection(IReactor dispatcher, IProtocol protocol, TcpClient tcpClient, int bufferSize)
     : base(dispatcher, protocol)
 {
     _tcpClient      = tcpClient;
     _readBuffer     = new Byte[bufferSize];
     _remoteEndPoint = _tcpClient.Client.RemoteEndPoint as IPEndPoint;
 }
        public string ModuleCommand(IList <string> arguments)
        {
            int    reactorId           = int.Parse(arguments[0]);
            string moduleType          = arguments[1];
            int    additionalParameter = int.Parse(arguments[2]);

            IModule module = moduleFactory.CreateModule(moduleType, currentId++, additionalParameter);

            this.modules.Add(module.Id, module);
            this.identifiableObjects.Add(module.Id, module);
            IReactor reactor = this.reactors[reactorId];

            if (module is IEnergyModule energyModule)
            {
                reactor.AddEnergyModule(energyModule);
            }
            else if (module is IAbsorbingModule absorbingModule)
            {
                reactor.AddAbsorbingModule(absorbingModule);
            }

            string result = string.Format(Constants.ModuleCreateMessage, moduleType, module.Id, reactorId);

            return(result);
        }
Example #5
0
        static void Main(string[] args)
        {
            Port = args.Length < 1 ? DEFAULT_PORT : Int32.Parse(args[0]);
            var ip = IPAddress.Any;

            Console.WriteLine("Starting echo server...");
            Console.WriteLine("Will begin listening for requests on {0}:{1}", ip, Port);
            var bootstrapper =
                new ServerBootstrap()
                .WorkerThreads(2)
                .SetTransport(TransportType.Udp)
                .Build();
            IReactor reactor = bootstrapper.NewReactor(NodeBuilder.BuildNode().Host(ip).WithPort(Port));

            reactor.OnConnection += (node, connection) =>
            {
                ServerPrint(node,
                            string.Format("Accepting connection from... {0}:{1}", node.Host, node.Port));
                connection.BeginReceive(Receive);
            };
            reactor.OnDisconnection += (reason, address) => ServerPrint(address.RemoteHost,
                                                                        string.Format("Closed connection to... {0}:{1} [Reason:{2}]", address.RemoteHost.Host, address.RemoteHost.Port, reason.Type));

            reactor.Start();
            Console.ReadKey();
        }
Example #6
0
 internal StreamConnection(IReactor dispatcher, IProtocol protocol, TcpClient tcpClient, int bufferSize)
     : base(dispatcher, protocol)
 {
     _tcpClient = tcpClient;
     _readBuffer = new Byte[bufferSize];
     _remoteEndPoint = _tcpClient.Client.RemoteEndPoint as IPEndPoint;
 }
Example #7
0
 public async Task DispatchEventStreamAsync(IReactor reactor, IEventStream stream)
 {
     foreach (EventMessage eventMessage in stream.CommittedEvents)
     {
         await DispatchPayloadAsync(reactor, eventMessage.Body);
     }
 }
Example #8
0
 public static Property <T> Create <T>(this IReactor reactor, string name, T defaultValue = default(T))
 {
     return(new Property <T>(reactor, name)
     {
         Value = defaultValue
     });
 }
        public ReactorAcceptorTest(IPAddress acceptorAddress, int acceptorPort,
                                   int reactorTimerMicroSeconds, int pendingConnections, bool keepAlive, bool isStream)
        {
            reactor        = new ReactorSocketImpl();
            reactorTimeout = reactorTimerMicroSeconds;
            connectionList = new List <IServiceHandler>();
            IPEndPoint endpoint = new IPEndPoint(acceptorAddress, acceptorPort);

            if (keepAlive && !isStream)
            {
                acceptor = new Tcp_SocketAcceptor(endpoint, reactor, pendingConnections, true, 5000, false);
            }
            else if (!keepAlive && !isStream)
            {
                acceptor = new Tcp_SocketAcceptor(endpoint, reactor, pendingConnections, false, 0, false);
            }
            else if (isStream)
            {
                acceptor = new Tcp_SocketAcceptor(endpoint, reactor, pendingConnections, false, 0, true);
            }

            acceptor.AcceptNotification += AcceptNotification;
            ThreadStart threadStart = new ThreadStart(Run);

            reactorThread = new Thread(threadStart);
            running       = true;
            reactorThread.Start();
        }
Example #10
0
        /// <summary>
        /// Dispatches the eventstream to the reactor
        /// </summary>
        /// <param name="storeEvents"></param>
        /// <returns>int The last streamrevision that was dispatched</returns>
        public static async Task <int> DispatchEventStreamAsync(this IReactor reactor, IStoreEvents storeEvents, ConventionalReactionDispatcher dispatcher, Guid aggregateId, int streamRevision = 1)
        {
            var stream = storeEvents.OpenStream(aggregateId, streamRevision);
            await dispatcher.DispatchEventStreamAsync(reactor, stream);

            return(stream.StreamRevision);
        }
Example #11
0
        public void TC005_PublishWithoudPayload()
        {
            bool           errorThrown = false;
            AutoResetEvent resetEvent  = new AutoResetEvent(false);

            using (IReactor natsClient = ReactorFactory.GetReactor(typeof(Reactor)))
            {
                natsClient.OnError += new EventHandler <ReactorErrorEventArgs>(delegate(object sender, ReactorErrorEventArgs args)
                {
                    errorThrown = true;
                    resetEvent.Set();
                });

                natsClient.Start(natsEndpoint);

                natsClient.Publish("foo");
                natsClient.Publish("foo", null, "hello");
                natsClient.Publish("foo", null, "hello", "reply");

                resetEvent.WaitOne(5000);

                natsClient.Close();
            }
            Assert.IsFalse(errorThrown);
        }
Example #12
0
        public void TC014_PublishCallback()
        {
            bool errorThrown = false;
            bool done        = false;

            AutoResetEvent resetEvent = new AutoResetEvent(false);

            using (IReactor natsClient = ReactorFactory.GetReactor(typeof(Reactor)))
            {
                natsClient.OnError += new EventHandler <ReactorErrorEventArgs>(delegate(object sender, ReactorErrorEventArgs args)
                {
                    errorThrown = true;
                    resetEvent.Set();
                });

                natsClient.Start(natsEndpoint);


                natsClient.Publish("foo", delegate()
                {
                    done = true;
                    resetEvent.Set();
                });

                resetEvent.WaitOne(5000);
                natsClient.Close();
            }
            Assert.IsFalse(errorThrown);
            Assert.IsTrue(done);
        }
Example #13
0
        public void TC023_ReciveGiantMessageForSubscription()
        {
            bool           errorThrown     = false;
            string         receivedMessage = "";
            AutoResetEvent resetEvent      = new AutoResetEvent(false);

            using (IReactor natsClient = ReactorFactory.GetReactor(typeof(Reactor)))
            {
                natsClient.OnError += new EventHandler <ReactorErrorEventArgs>(delegate(object sender, ReactorErrorEventArgs args)
                {
                    errorThrown = true;
                    resetEvent.Set();
                });

                natsClient.Start(natsEndpoint);

                natsClient.Subscribe("foo", delegate(string msg, string reply, string subject)
                {
                    receivedMessage = msg;
                    resetEvent.Set();
                });

                ASCIIEncoding ascii = new ASCIIEncoding();

                natsClient.Publish("foo", null, ascii.GetString(new byte[90000]));
                resetEvent.WaitOne(10000);
                natsClient.Close();
            }
            Assert.IsFalse(errorThrown);
            Assert.AreEqual(receivedMessage.Length, 90000);
        }
Example #14
0
        public void TC006_PublishNil()
        {
            bool           errorThrown = false;
            AutoResetEvent resetEvent  = new AutoResetEvent(false);

            using (IReactor natsClient = ReactorFactory.GetReactor(typeof(Reactor)))
            {
                natsClient.OnError += new EventHandler <ReactorErrorEventArgs>(delegate(object sender, ReactorErrorEventArgs args)
                {
                    errorThrown = true;
                    resetEvent.Set();
                });

                natsClient.Start(natsEndpoint);

                // todo: vladi: check to see if nil in Ruby evaluates to boolean true
                natsClient.Publish(null);
                natsClient.Publish(null, null, "hello");

                resetEvent.WaitOne(5000);

                natsClient.Close();
            }
            Assert.IsFalse(errorThrown);
        }
Example #15
0
        public void TC011_ReciveMessageIfWildcardSubscription()
        {
            string         errorThrown     = null;
            string         receivedMessage = "";
            AutoResetEvent resetEvent      = new AutoResetEvent(false);

            using (IReactor natsClient = ReactorFactory.GetReactor(typeof(Reactor)))
            {
                natsClient.OnError += new EventHandler <ReactorErrorEventArgs>(delegate(object sender, ReactorErrorEventArgs args)
                {
                    errorThrown = args.Message == null ? String.Empty : args.Message;
                    resetEvent.Set();
                });

                natsClient.Start(natsEndpoint);

                // todo: vladi: if not testing agains an empty server, this subscription may fail
                natsClient.Subscribe("*", delegate(string msg, string reply, string subject)
                {
                    receivedMessage = msg;
                    resetEvent.Set();
                });

                natsClient.Publish("foo", null, "xxx");
                resetEvent.WaitOne(5000);
                natsClient.Close();
            }
            Assert.IsTrue(errorThrown == null, errorThrown);
            Assert.AreEqual(receivedMessage, "xxx");
        }
Example #16
0
        public void TC010_ReciveEmptyMessage()
        {
            bool           errorThrown     = false;
            string         receivedMessage = "xxx";
            AutoResetEvent resetEvent      = new AutoResetEvent(false);

            using (IReactor natsClient = ReactorFactory.GetReactor(typeof(Reactor)))
            {
                natsClient.OnError += new EventHandler <ReactorErrorEventArgs>(delegate(object sender, ReactorErrorEventArgs args)
                {
                    errorThrown = true;
                    resetEvent.Set();
                });

                natsClient.Start(natsEndpoint);

                natsClient.Subscribe("foo", delegate(string msg, string reply, string subject)
                {
                    receivedMessage = msg;
                    resetEvent.Set();
                });

                natsClient.Publish("foo", null, "");
                resetEvent.WaitOne(5000);
                natsClient.Close();
            }
            Assert.IsFalse(errorThrown);
            Assert.AreEqual(receivedMessage, "");
        }
Example #17
0
        internal static Property <T> Create <T>(this IReactor reactor, string name, Func <T> valueFunc, params IProperty[] fromProperties)
        {
            var property = reactor.Create <T>(name, valueFunc());

            reactor.WhenPropertiesChange(fromProperties).Subscribe(coll => property.Value = valueFunc());
            return(property);
        }
        public string ReactorCommand(IList <string> arguments)
        {
            string reactorType         = arguments[0];
            int    additionalParameter = int.Parse(arguments[1]);
            int    moduleCapacity      = int.Parse(arguments[2]);

            IContainer container = new ModuleContainer(moduleCapacity);

            IReactor reactor = null;

            switch (reactorType)
            {
            case "Cryo":
                //reactor = new CryoReactor(this.currentId, container, additionalParameter);
                reactor = reactorFactory.CreateReactor(reactorType, this.currentId, container, additionalParameter);
                break;

            case "Heat":
                //reactor = new HeatReactor(this.currentId, container, additionalParameter);
                reactor = reactorFactory.CreateReactor(reactorType, this.currentId, container, additionalParameter);
                break;
            }

            this.currentId++;

            this.reactors.Add(reactor.Id, reactor);
            this.identifiableObjects.Add(reactor.Id, reactor);

            string result = string.Format(Constants.ReactorCreateMessage, reactorType, reactor.Id);

            return(result);
        }
Example #19
0
            public Server(string address, int port, IClientListener <Request, Response> listener, ISerializeProcessor sp, bool isIPAddressAny)
            {
                this._address       = address;
                this._port          = port;
                this._lisenter      = listener;
                this.SP             = sp;
                this.isAnyIPAddress = isIPAddressAny || string.IsNullOrEmpty(_address);

                var excutor = new TryCatchExecutor((e) =>
                {
                    //Console.Write(e);
                });
                var bootStrapper = new ServerBootstrap()
                                   .Executor(excutor)
                                   .SetTransport(System.Net.TransportType.Tcp)
                                   .Build();

                _server = bootStrapper.NewReactor(
                    NodeBuilder.BuildNode()
                    .Host(isIPAddressAny? IPAddress.Any:IPAddress.Parse(_address))
                    .WithPort(port)
                    );

                _server.OnConnection    += _server_OnConnection;;
                _server.OnDisconnection += TempServer_OnDisconnection;
            }
 public AbstractSocketAcceptor(EndPoint localEndPoint,
                               IReactor reactor,
                               int pendingConnections)
 {
     this.reactor = reactor;
     Open(localEndPoint, pendingConnections);
 }
Example #21
0
        public static IObservable <T> WhenPropertyChanges <T>(this IReactor reactor, IProperty property)
        {
            var stream = Observable.FromEvent <IProperty>(
                h => reactor.RxPropertyChanged += h,
                h => reactor.RxPropertyChanged -= h);

            return(stream.Where(p => p == property).Select(p => (T)p.Value));
        }
Example #22
0
 public void TC001_StartStopClient()
 {
     using (IReactor natsClient = ReactorFactory.GetReactor(typeof(Reactor)))
     {
         natsClient.Start(natsEndpoint);
         natsClient.Close();
     }
 }
Example #23
0
 public void Stop()
 {
     if (this._reactor != null)
     {
         this._reactor.Stop();
         this._reactor = null;
     }
 }
Example #24
0
 public Tcp_SocketAcceptor(EndPoint localEndPoint, IReactor reactor, int pendingConnections,
                           bool keepServiceOpen, int keepAliveTimerVal, bool makeStream)
     : base(localEndPoint, reactor, pendingConnections)
 {
     serviceKeepAlive         = keepServiceOpen;
     serviceKeepAliveTimerVal = keepAliveTimerVal;
     isConnectionStream       = makeStream;
 }
Example #25
0
        internal static LazyProperty <T> CreateLazy <T>(this IReactor reactor, string name, IObservable <Unit> changeStream, Func <T> valueGetter)
        {
            var property = new LazyProperty <T>(reactor, name, valueGetter);

            changeStream.Subscribe(unit => property.Invalidate());

            return(property);
        }
Example #26
0
 public void OnAccept(IReactor reactor)
 {
     Logger.LogInfo("Accepted new client", new object[0]);
     if (this.OnAcceptNew != null)
     {
         this.OnAcceptNew(reactor);
     }
 }
Example #27
0
        public static IObservable <object> WhenPropertiesChange(this IReactor reactor, params IProperty[] properties)
        {
            var stream = Observable.FromEvent <IProperty>(
                h => reactor.RxPropertyChanged += h,
                h => reactor.RxPropertyChanged -= h);

            return(stream.Where(p => Array.IndexOf(properties, p) >= 0));
        }
Example #28
0
        public void StartReaction(IBall original)
        {
            var config      = Di.Get <IGameConfig>();
            var all         = new List <IBall>(GameController.BallCollection.Where(x => x.MaterialName == original.MaterialName));
            var consumables = new List <IBall>();
            var consumed    = new List <IBall>();

            consumables.Add(original);
            all.Remove(original);

            while (consumables.Count > 0)
            {
                var tester = consumables[0];
                consumables.RemoveAt(0);
                consumed.Add(tester);
                for (int i = all.Count - 1; i > -1; i--)
                {
                    var b        = all[i];
                    var distance = Vector3.Distance(tester.TransformPosition, b.TransformPosition);
                    if (distance > config.BallTouchRange)
                    {
                        continue;
                    }

                    consumables.Add(b);
                    all.Remove(b);
                }
            }

            var      score         = 0f;
            var      triggerIn     = 0f;
            var      reactorChoice = config.GetReactor();
            IReactor reactor       = null;

            foreach (var b in consumed)
            {
                if (reactorChoice == ReactorTypes.Fade)
                {
                    reactor = b.GetComponent <IFadeReactor>();
                }
                if (reactorChoice == ReactorTypes.Shrink)
                {
                    reactor = b.GetComponent <IShrinkReactor>();
                }
                if (reactorChoice == ReactorTypes.Slip)
                {
                    reactor = b.GetComponent <ISlipReactor>();
                }

                reactor.ActivateDestructionIn(triggerIn);
                triggerIn += config.TimeBetweenReactions;

                score += config.ScorePerBall;
                score *= config.CountMultiplier;
            }

            Di.Get <IScore>().TotalScore += (int)score;
        }
Example #29
0
        public static LazyProperty <T> CreateLazy <T>(this IReactor reactor, string name, Expression <Func <T> > valueExpression)
        {
            Func <T> compiled = valueExpression.Compile();

            UsedPropertyChain[] properties   = ExpressionHelper.GetUsedPropertiesAndAttachListeners(valueExpression);
            IObservable <Unit>  changeStream = React.WhenAnyPropertyChanges(properties);

            return(CreateLazy <T>(reactor, name, changeStream, compiled));
        }
Example #30
0
        private void Acceptor_OnAcceptNew(IReactor reactor)
        {
            ClientSession session = this.CreateClientSession(this._sessionBase, reactor);

            session.OnReceive               += new SessionReceivedDelegate(this.HandlePackages);
            session.OnSessionDisconnected   += new SessionDisconnectedDelegate(this.ClientDisconnected);
            this._clients[this._sessionBase] = session;
            Interlocked.Increment(ref this._sessionBase);
        }
Example #31
0
        public static IReactor GetDefaultReactor()
        {
            if (_defaultReactor == null)
            {
                _defaultReactor = new Reactor("DefaultReactor");
            }

            return(_defaultReactor);
        }
Example #32
0
        void IPeerConnector.Bind(IReactor dispatcher, IProtocolFactory factory, IPEndPoint localEP, IPEndPoint remoteEP, int bufferSize)
        {
            _factory = factory;
            _dispatcher = dispatcher;
            _bufferSize = bufferSize;

            var tcpClient = new TcpClient(localEP);
            var ar = tcpClient.BeginConnect(remoteEP.Address, remoteEP.Port, null, tcpClient);
            _dispatcher.AddResult(ar, (iar, state) => { this.PeerConnectCallback(iar); }, tcpClient);
        }
Example #33
0
        void IConnector.Bind(IReactor dispatcher, IProtocolFactory factory, IPEndPoint localEP, int bufferSize)
        {
            _factory = factory;
            _dispatcher = dispatcher;
            _bufferSize = bufferSize;

            _tcpListener = new TcpListener(localEP);
            _tcpListener.Start();

            this.StartAccept();
        }
Example #34
0
        void IConnector.Bind(IReactor dispatcher, IProtocolFactory factory, IPEndPoint localEP, int bufferSize)
        {
            _udpClient = new UdpClient(localEP);
            _udpClient.Client.ReceiveBufferSize = bufferSize;

            var protocol = factory.Create();

            var connection = new DatagramConnection(dispatcher, protocol, _udpClient);
            connection.Start(true);

            protocol.Bind(connection);
            protocol.Connected();
        }
Example #35
0
 public void Initialize(IReactor reactor, IDaemon daemon)
 {
     reactor.Daemon = daemon;
     daemon.Schedule(reactor.Initialize);
 }
Example #36
0
 internal DatagramConnection(IReactor dispatcher, IProtocol protocol, UdpClient udpClient)
     : base(dispatcher, protocol)
 {
     _udpClient = udpClient;
 }
        /// <summary>
        /// Starts the service using the specified options.
        /// </summary>
        /// <param name="options">The configuration options.</param>
        public virtual void Start(Options options)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            this.localIP = NetworkInterface.GetLocalIPAddress();
            Logger.Info(Strings.InitializingLogMessage, this.ServiceDescription());
            this.OrphanInstancesHash = new Dictionary<string, object>();
            this.OrphanBindingHash = new Dictionary<string, object>();

            this.nodeNats = ReactorFactory.GetReactor(typeof(Reactor));
            this.nodeNats.OnError += new EventHandler<ReactorErrorEventArgs>(this.NatsErrorHandler);
            this.NodeNats.Start(options.Uri);

            this.OnConnectNode();

            this.vcapComponent = new VCAPComponent();

            this.vcapComponent.Register(
                new Dictionary<string, object>
                {
                    { "nats", this.NodeNats },
                    { "type", this.ServiceDescription() },
                    { "host", this.localIP },
                    { "index", options.Index },
                    { "config", options },
                    { "statusPort", options.StatusPort }
                });

            int zInterval = options.ZInterval;

            // give service a chance to wake up
            TimerHelper.DelayedCall(
                5000,
                delegate
                {
                    this.UpdateVarz();
                });

            TimerHelper.RecurringCall(
                zInterval,
                delegate
                {
                    this.UpdateVarz();
                });

            // give service a chance to wake up
            TimerHelper.DelayedCall(
                5000,
                delegate
                {
                    this.UpdateHealthz();
                });

            TimerHelper.RecurringCall(
                zInterval,
                delegate
                {
                    this.UpdateHealthz();
                });
        }
Example #38
0
 protected Connection(IReactor reactor, Protocol protocol)
 {
     _reactor = reactor;
     _protocol = protocol;
 }
Example #39
0
 public void ConnectReactor(IReactor reactor)
 {
     this.reactor = reactor;
 }
 internal StreamConnection(IReactor reactor, Protocol protocol)
     : base(reactor, protocol)
 {
 }
        public void Close(IServiceHost host)
        {
            _controlConnector.Close();

            _reactor = null;
        }
Example #42
0
 internal static void BindTcp(IReactor reactor, IProtocolFactory protocolFactory, IPEndPoint localEP, int bufferSize = 8192)
 {
     IConnector connector = new StreamConnector();
     connector.Bind(reactor, protocolFactory, localEP, bufferSize);
 }
Example #43
0
 internal static void ConnectUdp(IReactor reactor, IProtocolFactory protocolFactory, IPEndPoint localEP, IPEndPoint remoteEP, int bufferSize = 524288)
 {
     IPeerConnector connector = new DatagramPeerConnector();
     connector.Bind(reactor, protocolFactory, localEP, remoteEP, bufferSize);
 }
 public ServiceHostImplementation(IReactor reactor, Dictionary<string, object> environment, IList<IService> servicesListOrNull)
 {
     _reactor = reactor;
     _environment = environment;
     _servicesListOrNull = servicesListOrNull;
 }
Example #45
0
 private Context()
 {
     this.reactor = new Reactor();
     this.Start();
 }
Example #46
0
 private void Run()
 {
     var bootstrapper =
         new ServerBootstrap()
             .WorkerThreads(4)
             .SetTransport(TransportType.Udp)
             .Build();
     _reactor = bootstrapper.NewReactor(
         NodeBuilder.BuildNode()
             .Host(HostIp)
             .WithPort(HostPort));
     _reactor.OnConnection += (node, connection) =>
     {
         //ServerPrint(node,
         //    string.Format("Accepting connection from... {0}:{1}", node.Host, node.Port));
         connection.BeginReceive(UdpPackerReceiveCallback);
     };
     //reactor.OnDisconnection += (reason, address) => ServerPrint(address.RemoteHost,
     //    string.Format("Closed connection to... {0}:{1} [Reason:{2}]", address.RemoteHost.Host, address.RemoteHost.Port, reason.Type));
     _reactor.Start();
 }
        public void Open(IServiceHost host)
        {
            _reactor = host.Reactor;

            _controlConnector = host.Reactor.ListenStream(new RemoteCaptureProtocolFactory(this), _listenPort);
        }
        /// <summary>
        /// Releases unmanaged and - optionally - managed resources
        /// </summary>
        /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (this.nodeNats != null)
                {
                    this.nodeNats.Dispose();
                    this.nodeNats = null;
                }

                if (this.vcapComponent != null)
                {
                    this.vcapComponent.Dispose();
                    this.vcapComponent = null;
                }
            }
        }