Exemplo n.º 1
0
        protected RpcTcpClientBase(
            string hostName,
            int port,
            IObjectsPoolsRegistrar poolsRegistrar,
            IDateTimeProvider dateTimeProvider,
            ISerializerFactory serializerFactory,
            ILogger logger,
            ClientParameters parameters)
        {
            HostName = hostName;
            _port    = port;
            if (parameters == null)
            {
                _connectionsPool = new ObjectsPool <TcpClientHolder>(
                    new PooledItemManager <TcpClientHolder>(CreateTcpClient, CloseTcpClient),
                    poolsRegistrar,
                    dateTimeProvider,
                    logger);
            }
            else
            {
                _connectionsPool = new ObjectsPool <TcpClientHolder>(
                    new PooledItemManager <TcpClientHolder>(CreateTcpClient, CloseTcpClient),
                    poolsRegistrar,
                    dateTimeProvider,
                    logger,
                    parameters.ConnectionPoolSize);
            }

            _logger = logger;
            _serviceCallResultSerializer = serializerFactory.CreateSerializer <ServiceCallResult>();
        }
Exemplo n.º 2
0
 public RpcTcpServer(
     TService serviceInstance,
     TimeSpan serviceShutdownTimeout,
     ServerSslSettings sslSettings,
     ISerializerFactory serializerFactory,
     ILogger logger)
 {
     _serviceDispatcher      = new ServiceDispatcher <TService>(serializerFactory, logger);
     _serviceInstance        = serviceInstance;
     _serviceShutdownTimeout = serviceShutdownTimeout;
     _sslSettings            = sslSettings;
     _logger                      = logger;
     _messageSerializer           = serializerFactory.CreateSerializer <RpcMessage>();
     _serviceCallResultSerializer = serializerFactory.CreateSerializer <ServiceCallResult>();
     _listenerWaitHandle          = new AutoResetEvent(false);
     _tcpListener                 = new TcpListener(IPAddress.Any, _serviceDispatcher.ServicePort);
 }
Exemplo n.º 3
0
        protected RpcTcpClientBase(
            string hostName,
            int port,
            ISerializerFactory serializerFactory,
            ILogger logger)
        {
            _hostName = hostName;
            _port     = port;
            _logger   = logger;
            _serviceCallResultSerializer = serializerFactory.CreateSerializer <ServiceCallResult>();

            _tcpClient = new TcpClient();
        }
 private ISerializer <TObject, TFormat> GetSerializer <TObject>() where TObject : IObject
 {
     return(_serializerFactory.CreateSerializer <TObject, TFormat>());
 }