public ThriftServerDef( INiftyProcessorFactory processorFactory, TProtocolFactory protocolFactory, String name = null, String host = null, int serverPort = 5858, long maxFrameSize = DefaultMaxFrameSize, int queuedResponseLimit = 16, int maxConnections = int.MaxValue, IThriftFrameCodecFactory thriftFrameCodecFactory = null, TimeSpan?clientIdleTimeout = null, TimeSpan?taskTimeout = null, TimeSpan?queueTimeout = null, SslConfig sslConfig = null ) : this(processorFactory, TDuplexProtocolFactory.FromSingleFactory(protocolFactory), name, host, serverPort, maxFrameSize, queuedResponseLimit, maxConnections, thriftFrameCodecFactory, clientIdleTimeout, taskTimeout, queueTimeout, sslConfig) { }
public ThriftServerDef( INiftyProcessorFactory processorFactory, TDuplexProtocolFactory protocolFactory, String name = null, String host = null, int serverPort = 5858, long maxFrameSize = DefaultMaxFrameSize, int queuedResponseLimit = 16, int maxConnections = int.MaxValue, IThriftFrameCodecFactory thriftFrameCodecFactory = null, TimeSpan?clientIdleTimeout = null, TimeSpan?taskTimeout = null, TimeSpan?queueTimeout = null, SslConfig sslConfig = null ) { Guard.ArgumentNotNull(protocolFactory, nameof(protocolFactory)); this.Name = String.IsNullOrWhiteSpace(name) ? ($"nifty-{Interlocked.Increment(ref _globalId)}") : name; this.Host = host; this.ServerPort = serverPort; this.MaxFrameSize = maxFrameSize; this.MaxConnections = maxConnections; this.QueuedResponseLimit = queuedResponseLimit; this.ProcessorFactory = processorFactory; this.DuplexProtocolFactory = protocolFactory; this.ClientIdleTimeout = clientIdleTimeout ?? TimeSpan.Zero; this.TaskTimeout = taskTimeout ?? TimeSpan.Zero; this.QueueTimeout = queueTimeout ?? TimeSpan.Zero; this.ThriftFrameCodecFactory = thriftFrameCodecFactory ?? new DefaultThriftFrameCodecFactory(); //this.Executor = executor ?? new DotNetty.Common.Concurrency.SingleThreadEventExecutor; //this.SecurityFactory = securityFactory; this.SslConfig = sslConfig; }
protected AbstractClientChannel(IChannel nettyChannel, ITimer timer, TDuplexProtocolFactory protocolFactory, ILoggerFactory loggerFactory = null) { this._requestMap = new Dictionary <int, Request>(); this.NettyChannel = nettyChannel; this._timer = timer; this.ProtocolFactory = protocolFactory; this._logger = loggerFactory?.CreateLogger(this.GetType()) ?? NullLogger.Instance; this._readerWriterLock = new ReaderWriterLockSlim(LockRecursionPolicy.NoRecursion); }
static ThriftServer() { var factoryBuilder = ImmutableDictionary.CreateBuilder <String, TDuplexProtocolFactory>(); factoryBuilder.Add("binary", TDuplexProtocolFactory.FromSingleFactory(new TBinaryProtocol.Factory())); factoryBuilder.Add("compact", TDuplexProtocolFactory.FromSingleFactory(new TCompactProtocol.Factory())); DefaultProtocolFactories = factoryBuilder.ToImmutableDictionary(); var codecBuilder = ImmutableDictionary.CreateBuilder <String, IThriftFrameCodecFactory>(); codecBuilder.Add("buffered", new DefaultThriftFrameCodecFactory()); codecBuilder.Add("framed", new DefaultThriftFrameCodecFactory()); DefaultFrameCodecFactories = codecBuilder.ToImmutableDictionary(); }
public NiftyDispatcher(ThriftServerDef serverDef, ITimer timer, int?ioThreadCount, ILoggerFactory loggerFactory = null) { Guard.ArgumentNotNull(timer, nameof(timer)); this._taskTimeoutTimer = timer; _logger = loggerFactory?.CreateLogger(this.GetType()) ?? NullLogger.Instance; this._processorFactory = serverDef.ProcessorFactory; //this.exe = serverDef.Executor; this._taskTimeoutMillis = (long)serverDef.TaskTimeout.TotalMilliseconds; this._queueTimeoutMillis = (long)serverDef.QueueTimeout.TotalMilliseconds; this._queuedResponseLimit = serverDef.QueuedResponseLimit; this._duplexProtocolFactory = serverDef.DuplexProtocolFactory; if (ioThreadCount.HasValue && ioThreadCount.Value > 0) { LimitedConcurrencyLevelTaskScheduler limitedScheduler = new LimitedConcurrencyLevelTaskScheduler(ioThreadCount.Value); _factory = new TaskFactory(limitedScheduler); } else { _factory = Task.Factory; } }
protected static TDuplexProtocolFactory GetDefaultProtocolFactory() { return(TDuplexProtocolFactory.FromSingleFactory(new TBinaryProtocol.Factory())); }
public AbstractClientConnector(EndPoint address, TDuplexProtocolFactory protocolFactory) { this.ServerAddress = address; this.ProtocolFactory = protocolFactory; }
public UnframedClientChannel(IChannel nettyChannel, ITimer timer, TDuplexProtocolFactory protocolFactory, ILoggerFactory loggerFactory = null) : base(nettyChannel, timer, protocolFactory, loggerFactory) { }
public UnframedClientConnector(EndPoint address, TDuplexProtocolFactory protocolFactory) : base(address, protocolFactory) { }
public FramedClientConnector(EndPoint address, TDuplexProtocolFactory protocolFactory, ILoggerFactory loggerFactory = null) : base(address, protocolFactory) { Guard.ArgumentNotNull(address, nameof(address)); _loggerFactory = loggerFactory; _logger = loggerFactory?.CreateLogger(this.GetType()) ?? NullLogger.Instance; }
public FramedClientConnector(EndPoint address, TProtocolFactory tFactory, ILoggerFactory loggerFactory = null) : this(address, TDuplexProtocolFactory.FromSingleFactory(tFactory), loggerFactory) { }
public FramedClientConnector(string hostName, int port, TDuplexProtocolFactory factory, ILoggerFactory loggerFactory = null) : this(GetEndPoint(hostName, port), factory, loggerFactory) { }