Skip to content

minEvictableIdleTimeMillis is useless with default timeBetweenEvictionRunsMillis #83

@ZiheLiu

Description

@ZiheLiu

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());
        
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions