sofa-bolt icon indicating copy to clipboard operation
sofa-bolt copied to clipboard

DefaultConnectionManager#getConnectionPoolAndCreateIfAbsent

Open midouwan opened this issue 4 years ago • 1 comments

在com.alipay.remoting.DefaultConnectionManager#getConnectionPoolAndCreateIfAbsent方法中:

RunStateRecordedFutureTask<ConnectionPool> initialTask; initialTask是FutureTask类型,为什么直接用run方法执行?

还有 initialTask = this.connTasks.get(poolKey); 如果非空直接跳到 pool = initialTask.get(); 不会一直阻塞吗?

midouwan avatar Mar 23 '22 13:03 midouwan

initialTask是FutureTask类型,直接run是和get 配合的,为了创建连接池的无锁设计

chuailiwu avatar Mar 31 '22 06:03 chuailiwu