2016-10-20 4 views
0

Env : HttpClient 4.4.HttpClient 공유 연결 관리자

HttpClientBuilder 클래스에서 나는

if (!this.connManagerShared){ 

    // ...some code 

    if (this.evictExpiredConnections || this.evictIdleConnections) { 

      final IdleConnectionEvictor connectionEvictor = new IdleConnectionEvictor((HttpClientConnectionManager) connManagerCopy, 
        this.maxIdleTime > 0L ? this.maxIdleTime : 10L, this.maxIdleTimeUnit != null ? this.maxIdleTimeUnit : TimeUnit.SECONDS); 
      closeablesCopy1.add(new Closeable() 
      { 
       public void close() throws IOException 
       { 
        connectionEvictor.shutdown(); 
       } 
      }); 
      connectionEvictor.start(); 
    } 
    // ...some code 
} 

나는이 두 가지 조건의 상관 관계를 할 수없는 나는, 다음 코드를 볼 수 있습니다.

공유 연결 관리자를 사용하는 경우 IdleConnectionEvictor를 사용하지 않는 이유는 무엇입니까?

답변

0

단일 연결 풀을 공유하는 HttpClient의 여러 인스턴스를 만드는 경우 하나의 인스턴스가 IdleConnectionEvictor 일 수도 있습니다. 유휴 연결을 제거하기 위해 연결 풀 잠금에 대해 복수 012/경합이 일어나는 지점은 무엇입니까? 한 인스턴스가 완벽하게 충분하면 어떻게됩니까?