Ejemplo n.º 1
0
        // used for testing to (carefully!) allow two clients in the same process
        internal void StartInternal()
        {
            transport.Start();
            TraceLogger.MyIPEndPoint = transport.MyAddress.Endpoint; // transport.MyAddress is only set after transport is Started.
            CurrentActivationAddress = ActivationAddress.NewActivationAddress(transport.MyAddress, clientId);

            ClientStatistics = new ClientStatisticsManager(config);
            ClientStatistics.Start(config, statisticsProviderManager, transport, clientId)
                .WaitWithThrow(initTimeout);

            listeningCts = new CancellationTokenSource();
            var ct = listeningCts.Token;
            listenForMessages = true;

            // Keeping this thread handling it very simple for now. Just queue task on thread pool.
            Task.Factory.StartNew(() => 
                {
                    try
                    {
                        RunClientMessagePump(ct);
                    }
                    catch(Exception exc)
                    {
                        logger.Error(ErrorCode.Runtime_Error_100326, "RunClientMessagePump has thrown exception", exc);
                    }
                }
            );
            grainInterfaceMap = transport.GetTypeCodeMap(grainFactory).Result;
            StreamingInitialize();
        }
Ejemplo n.º 2
0
        public void Dispose()
        {
            if (listeningCts != null)
            {
                listeningCts.Dispose();
                listeningCts = null;

                this.assemblyProcessor.Dispose();
            }

            transport.Dispose();
            if (ClientStatistics != null)
            {
                ClientStatistics.Dispose();
                ClientStatistics = null;
            }
            GC.SuppressFinalize(this);
        }