Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minEvictableIdleTimeMillis is useless with default timeBetweenEvictionRunsMillis #83

Open
ZiheLiu opened this issue Apr 25, 2022 · 0 comments

Comments

@ZiheLiu
Copy link

ZiheLiu commented Apr 25, 2022

As for the connection pool, the idle object after minEvictableIdleTimeMillis is evicted in Evictor thread.
Evictor thread is started only when timeBetweenEvictionRunsMillis > 0, and default timeBetweenEvictionRunsMillis is -1.

However, RpcClientOptions doesn't provide API to set timeBetweenEvictionRunsMillis. Could we provide RpcClientOptions::timeBetweenEvictionRunsMillis?

    public ChannelPool(RpcClient rpcClient, String host, int port) {
        this.clientConfig = rpcClient.getRpcClientOptions();
        objectFactory = new ChannelPoolObjectFactory(rpcClient, host, port);
        
        GenericObjectPoolConfig config = new GenericObjectPoolConfig();
        config.setJmxEnabled(clientConfig.isJmxEnabled());
        pool = new GenericObjectPool<Connection>(objectFactory, config);
        pool.setMaxIdle(clientConfig.getMaxIdleSize());
        pool.setMaxTotal(clientConfig.getThreadPoolSize());
        pool.setMaxWaitMillis(clientConfig.getMaxWait());
        pool.setMinIdle(clientConfig.getMinIdleSize());
        pool.setMinEvictableIdleTimeMillis(clientConfig.getMinEvictableIdleTime());
        pool.setTestOnBorrow(clientConfig.isTestOnBorrow());
        pool.setTestOnReturn(clientConfig.isTestOnReturn());
        pool.setLifo(clientConfig.isLifo());
        
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant