protected SimpleBucket<T> createBucket(int bucketSize, boolean unbounded) { U.must(unbounded, "Only unbounded buckets are supported!"); return new SimpleList<>(bucketSize); }
public RapidoidWorker(String name, final RapidoidHelper helper, NetworkingParams net, SSLContext sslContext) { super(name); this.bufSize = net.bufSizeKB() * 1024; this.noDelay = net.noDelay(); this.bufs = new BufGroup(bufSize, net.syncBufs()); this.serverProtocol = net.protocol(); this.helper = helper; this.sslContext = sslContext; this.maxPipeline = net.maxPipeline(); final int queueSize = ConfigUtil.micro() ? 1000 : 1000000; final int growFactor = ConfigUtil.micro() ? 2 : 10; this.connected = new ArrayBlockingQueue<>(queueSize); this.done = new SimpleList<>(queueSize / 10, growFactor); connections = Pools.create("connections", () -> newConnection(false), 100000); if (idleConnectionsCrawler != null) { idleConnectionsCrawler.register(allConnections); } }
public ExtendedWorker(String name, RapidoidHelper helper, NetworkingParams net, SSLContext sslContext) { super(name); this.bufSize = net.bufSizeKB() * 1024; this.noDelay = net.noDelay(); this.bufs = new BufGroup(bufSize, net.syncBufs()); this.bufSizeLimit = 1024L * Conf.NET.entry("bufSizeLimit").or(1024); // in KB this.serverProtocol = net.protocol(); this.helper = helper; this.sslContext = sslContext; this.maxPipeline = net.maxPipeline(); final int queueSize = ConfigUtil.micro() ? 1000 : 1000000; final int growFactor = ConfigUtil.micro() ? 2 : 10; this.restarting = new ArrayBlockingQueue<>(queueSize); this.connecting = new ArrayBlockingQueue<>(queueSize); this.connected = new ArrayBlockingQueue<>(queueSize); this.done = new SimpleList<>(queueSize / 10, growFactor); this.dataIn = Insights.stats(name + ":datain"); this.dataOut = Insights.stats(name + ":dataout"); connections = Pools.create("connections", () -> newConnection(false), 100000); if (idleConnectionsCrawler != null) { idleConnectionsCrawler.register(allConnections); } }
protected SimpleList<T> newList(int initialBucketSize) { return new SimpleList<T>(initialBucketSize); }
public RapidoidWorker(String name, final BufGroup bufs, final Protocol protocol, final RapidoidHelper helper, int bufSizeKB, boolean noNelay) { super(name); this.bufs = bufs; this.serverProtocol = protocol; this.helper = helper; this.maxPipelineSize = Conf.option("pipeline-max", 1000000L); this.selectorTimeout = Conf.option("selector-timeout", 5); this.bufSizeLimit = Conf.option("buffer-limit", 1024L * 1024); // 1 MB final int queueSize = Conf.micro() ? 1000 : 1000000; final int growFactor = Conf.micro() ? 2 : 10; this.restarting = new ArrayBlockingQueue<RapidoidConnection>(queueSize); this.connecting = new ArrayBlockingQueue<ConnectionTarget>(queueSize); this.connected = new ArrayBlockingQueue<RapidoidChannel>(queueSize); this.waitingToWrite = new SimpleList<RapidoidConnection>(queueSize / 10, growFactor); this.dataIn = Insights.stats(name + ":datain"); this.dataOut = Insights.stats(name + ":dataout"); connections = Pools.create("connections", new Callable<RapidoidConnection>() { @Override public RapidoidConnection call() throws Exception { return newConnection(); } }, 100000); this.bufSize = bufSizeKB * 1024; this.noDelay = noNelay; }