Package org.apache.http.conn.params

Examples of org.apache.http.conn.params.ConnPerRoute


     */
    @Deprecated
    public RouteSpecificPool(HttpRoute route, int maxEntries) {
        this.route = route;
        this.maxEntries = maxEntries;
        this.connPerRoute = new ConnPerRoute() {
            public int getMaxForRoute(HttpRoute route) {
                return RouteSpecificPool.this.maxEntries;
            }
        };
        this.freeEntries = new LinkedList<BasicPoolEntry>();
View Full Code Here


    }

    static void oldPool(int c, long reps) throws Exception {
        ClientConnectionOperator operator = new DefaultClientConnectionOperator(
                SchemeRegistryFactory.createDefault());
        ConnPerRoute connPerRoute = new ConnPerRouteBean(c);
        ConnPoolByRoute pool = new ConnPoolByRoute(operator, connPerRoute, c * 10);

        WorkerThread2[] workers = new WorkerThread2[c];
        for (int i = 0; i < workers.length; i++) {
            workers[i] = new WorkerThread2(pool, reps);
View Full Code Here

        Assert.assertEquals("wrong condition", cnd, wt.getCondition());
        Assert.assertNull  ("pool from nowhere", wt.getPool());
        Assert.assertNull  ("thread from nowhere", wt.getThread());

        HttpRoute route = new HttpRoute(TARGET);
        ConnPerRoute connPerRoute = new ConnPerRouteBean(10);
        RouteSpecificPool rospl = new RouteSpecificPool(route, connPerRoute);
        wt = new WaitingThread(cnd, rospl);
        Assert.assertEquals("wrong condition", cnd, wt.getCondition());
        Assert.assertEquals("wrong pool", rospl, wt.getPool());
        Assert.assertNull  ("thread from nowhere", wt.getThread());
View Full Code Here

        Assert.assertEquals("wrong condition", cnd, wt.getCondition());
        Assert.assertNull  ("pool from nowhere", wt.getPool());
        Assert.assertNull  ("thread from nowhere", wt.getThread());

        HttpRoute route = new HttpRoute(TARGET);
        ConnPerRoute connPerRoute = new ConnPerRouteBean(10);
        RouteSpecificPool rospl = new RouteSpecificPool(route, connPerRoute);
        wt = new WaitingThread(cnd, rospl);
        Assert.assertEquals("wrong condition", cnd, wt.getCondition());
        Assert.assertEquals("wrong pool", rospl, wt.getPool());
        Assert.assertNull  ("thread from nowhere", wt.getThread());
View Full Code Here

     */
    @Deprecated
    public RouteSpecificPool(HttpRoute route, int maxEntries) {
        this.route = route;
        this.maxEntries = maxEntries;
        this.connPerRoute = new ConnPerRoute() {
            public int getMaxForRoute(HttpRoute route) {
                return RouteSpecificPool.this.maxEntries;
            }
        };
        this.freeEntries = new LinkedList<BasicPoolEntry>();
View Full Code Here

     * @param route     the route
     *
     * @return  the new pool
     */
    protected RouteSpecificPool newRouteSpecificPool(HttpRoute route) {
        ConnPerRoute connPerRoute = ConnManagerParams.getMaxConnectionsPerRoute(params);
        return new RouteSpecificPool(route, connPerRoute.getMaxForRoute(route));
    }
View Full Code Here

      if (utils.getMaxConnections() > 0)
         ConnManagerParams.setMaxTotalConnections(params, utils.getMaxConnections());

      if (utils.getMaxConnectionsPerHost() > 0) {
         ConnPerRoute connectionsPerRoute = new ConnPerRouteBean(utils.getMaxConnectionsPerHost());
         ConnManagerParams.setMaxConnectionsPerRoute(params, connectionsPerRoute);
      }
      HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
      return params;
   }
View Full Code Here

  public synchronized HttpClient getHttpClient() {
    if (client == null) {
      // Set up default connection params. There are two routes to
      // Dropbox - api server and content server.
      HttpParams connParams = new BasicHttpParams();
      ConnManagerParams.setMaxConnectionsPerRoute(connParams, new ConnPerRoute() {
        public int getMaxForRoute(HttpRoute route) {
          return 10;
        }
      });
      ConnManagerParams.setMaxTotalConnections(connParams, 20);
View Full Code Here

      if (utils.getMaxConnections() > 0)
         ConnManagerParams.setMaxTotalConnections(params, utils.getMaxConnections());

      if (utils.getMaxConnectionsPerHost() > 0) {
         ConnPerRoute connectionsPerRoute = new ConnPerRouteBean(utils.getMaxConnectionsPerHost());
         ConnManagerParams.setMaxConnectionsPerRoute(params, connectionsPerRoute);
      }
      HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
      return params;
   }
View Full Code Here

        }

        private HttpParams getHttpParams() {
            HttpParams params = new BasicHttpParams();
            ConnManagerParams.setMaxTotalConnections(params, maxConnection);
            ConnManagerParams.setMaxConnectionsPerRoute(params, new ConnPerRoute() {

                @Override
                public int getMaxForRoute(HttpRoute httpRoute) {
                    return maxConnectionPerRoute;
                }
View Full Code Here

TOP

Related Classes of org.apache.http.conn.params.ConnPerRoute

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.