Exemple #1
0
        private ServiceHubRemoteHostClient(
            HostWorkspaceServices services,
            HubClient hubClient,
            HostGroup hostGroup,
            Stream stream)
            : base(services)
        {
            var optionService = services.GetRequiredService <IOptionService>();

            if (optionService.GetOption(RemoteHostOptions.EnableConnectionPool))
            {
                int maxPoolConnection = optionService.GetOption(RemoteHostOptions.MaxPoolConnection);

                _connectionPool = new ConnectionPool(
                    connectionFactory: (serviceName, cancellationToken) => CreateConnectionAsync(serviceName, callbackTarget: null, cancellationToken),
                    maxPoolConnection);
            }

            _hubClient = hubClient;
            _hostGroup = hostGroup;

            _endPoint = new RemoteEndPoint(stream, hubClient.Logger, incomingCallTarget: this);
            _endPoint.Disconnected += OnDisconnected;
            _endPoint.UnexpectedExceptionThrown += OnUnexpectedExceptionThrown;
            _endPoint.StartListening();
        }
 public JsonRpcConnection(
     Workspace workspace,
     TraceSource logger,
     object?callbackTarget,
     Stream serviceStream)
 {
     _workspace       = workspace;
     _serviceEndPoint = new RemoteEndPoint(serviceStream, logger, callbackTarget);
     _serviceEndPoint.UnexpectedExceptionThrown += UnexpectedExceptionThrown;
     _serviceEndPoint.StartListening();
 }
        public RemotableDataJsonRpc(Workspace workspace, TraceSource logger, Stream snapshotServiceStream)
        {
            _workspace            = workspace;
            _remotableDataService = workspace.Services.GetRequiredService <IRemotableDataService>();

            _shutdownCancellationSource = new CancellationTokenSource();

            _endPoint = new RemoteEndPoint(snapshotServiceStream, logger, incomingCallTarget: this);
            _endPoint.UnexpectedExceptionThrown += UnexpectedExceptionThrown;
            _endPoint.Disconnected += OnDisconnected;
            _endPoint.StartListening();
        }
Exemple #4
0
            public DataPoint(
                ReferenceCodeLensProvider owner,
                ICodeLensCallbackService callbackService,
                CodeLensDescriptor descriptor,
                Stream stream)
            {
                _owner           = owner;
                _callbackService = callbackService;

                Descriptor = descriptor;

                _endPoint = new RemoteEndPoint(stream, owner._client.Logger, new RoslynCallbackTarget(Invalidate));
                _endPoint.StartListening();
            }
        private InProcRemoteHostClient(
            HostWorkspaceServices services,
            InProcRemoteServices inprocServices,
            Stream stream)
        {
            _workspaceServices = services;
            _logger            = new TraceSource("Default");

            _inprocServices = inprocServices;

            _endPoint = new RemoteEndPoint(stream, _logger, incomingCallTarget: this);
            _endPoint.Disconnected += OnDisconnected;
            _endPoint.StartListening();
        }
Exemple #6
0
        private InProcRemoteHostClient(
            string clientId,
            Workspace workspace,
            InProcRemoteServices inprocServices,
            Stream stream)
            : base(workspace)
        {
            ClientId = clientId;

            _inprocServices = inprocServices;

            _endPoint = new RemoteEndPoint(stream, inprocServices.Logger, incomingCallTarget: this);
            _endPoint.Disconnected += OnDisconnected;
            _endPoint.StartListening();
        }
Exemple #7
0
        public JsonRpcConnection(
            Workspace workspace,
            TraceSource logger,
            object?callbackTarget,
            Stream serviceStream,
            ReferenceCountedDisposable <RemotableDataJsonRpc> dataRpc)
        {
            Contract.ThrowIfNull(dataRpc);

            _workspace       = workspace;
            _remoteDataRpc   = dataRpc;
            _serviceEndPoint = new RemoteEndPoint(serviceStream, logger, callbackTarget);
            _serviceEndPoint.UnexpectedExceptionThrown += UnexpectedExceptionThrown;
            _serviceEndPoint.StartListening();
        }
        private ServiceHubRemoteHostClient(
            Workspace workspace,
            TraceSource logger,
            ConnectionManager connectionManager,
            Stream stream)
            : base(workspace)
        {
            _shutdownCancellationTokenSource = new CancellationTokenSource();

            _connectionManager = connectionManager;

            _endPoint = new RemoteEndPoint(stream, logger, incomingCallTarget: this);
            _endPoint.Disconnected += OnDisconnected;
            _endPoint.UnexpectedExceptionThrown += OnUnexpectedExceptionThrown;
            _endPoint.StartListening();
        }
        public JsonRpcConnection(
            HostWorkspaceServices services,
            TraceSource logger,
            object?callbackTarget,
            Stream serviceStream,
            IPooledConnectionReclamation?poolReclamation)
        {
            _remotableDataService = services.GetRequiredService <IRemotableDataService>();
            _services             = services;

            _serviceEndPoint = new RemoteEndPoint(serviceStream, logger, callbackTarget);
            _serviceEndPoint.UnexpectedExceptionThrown += UnexpectedExceptionThrown;
            _serviceEndPoint.StartListening();

            _poolReclamation = poolReclamation;
#if DEBUG
            _creationCallStack = Environment.StackTrace;
#endif
        }
        private InProcRemoteHostClient(
            string clientId,
            Workspace workspace,
            InProcRemoteServices inprocServices,
            ReferenceCountedDisposable <RemotableDataJsonRpc> remotableDataRpc,
            Stream stream)
            : base(workspace)
        {
            Contract.ThrowIfNull(remotableDataRpc);

            ClientId = clientId;

            _inprocServices   = inprocServices;
            _remotableDataRpc = remotableDataRpc;

            _endPoint = new RemoteEndPoint(stream, inprocServices.Logger, incomingCallTarget: this);
            _endPoint.Disconnected += OnDisconnected;
            _endPoint.StartListening();
        }
Exemple #11
0
        private ServiceHubRemoteHostClient(
            HostWorkspaceServices services,
            HubClient hubClient,
            HostGroup hostGroup,
            Stream stream)
            : base(services)
        {
            _connectionPool = new ConnectionPool(
                connectionFactory: (serviceName, cancellationToken) => CreateConnectionAsync(serviceName, callbackTarget: null, cancellationToken),
                capacity: ConnectionPoolCapacity);

            _hubClient = hubClient;
            _hostGroup = hostGroup;

            _endPoint = new RemoteEndPoint(stream, hubClient.Logger, incomingCallTarget: this);
            _endPoint.Disconnected += OnDisconnected;
            _endPoint.UnexpectedExceptionThrown += OnUnexpectedExceptionThrown;
            _endPoint.StartListening();
        }
        private ServiceHubRemoteHostClient(
            HostWorkspaceServices services,
            HubClient hubClient,
            HostGroup hostGroup,
            Stream stream)
        {
            _connectionPools = new ConnectionPools(
                connectionFactory: (serviceName, pool, cancellationToken) => CreateConnectionImplAsync(serviceName, callbackTarget: null, pool, cancellationToken),
                capacity: ConnectionPoolCapacity);

            _services  = services;
            _hubClient = hubClient;
            _hostGroup = hostGroup;

            _endPoint = new RemoteEndPoint(stream, hubClient.Logger, incomingCallTarget: this);
            _endPoint.Disconnected += OnDisconnected;
            _endPoint.UnexpectedExceptionThrown += OnUnexpectedExceptionThrown;
            _endPoint.StartListening();

            _remotableDataService = services.GetRequiredService <IRemotableDataService>();
        }