Examples of NHttpClientConnection


Examples of org.apache.http.nio.NHttpClientConnection

        }

        HostConnections pool = getConnectionPool(host, port);

        // trying to get an existing connection
        NHttpClientConnection connection = pool.getConnection();
        if (connection == null) {
            if (pool.canHaveMoreConnections()) {
                ioReactor.connect(new InetSocketAddress(host, port), null, pool, callback);
            } else {
                log.warn("Connection pool reached maximum allowed connections for: "
View Full Code Here

Examples of org.apache.http.nio.NHttpClientConnection

                queue.add(msgContext);
            } finally {
                lock.unlock();
            }

            NHttpClientConnection conn = targetConnections.getConnection(host, port);
            if (conn != null) {
                MessageContext messageContext = queue.poll();

                if (messageContext != null) {
                    tryNextMessage(messageContext, conn);
View Full Code Here

Examples of org.apache.http.nio.NHttpClientConnection

        } finally {
            lock.unlock();
        }

        while (queue.size() > 0) {
            NHttpClientConnection conn = targetConnections.getConnection(host, port);
            if (conn != null) {
                MessageContext messageContext = queue.poll();

                if (messageContext != null) {
                    tryNextMessage(messageContext, conn);
View Full Code Here

Examples of org.apache.http.nio.NHttpClientConnection

                        port = proxyPort;
                    }
                }
            }
           
            NHttpClientConnection conn = ConnectionPool.getConnection(host, port);

            // Ensure MessageContext has a ClientConnectionDebug attached before we start streaming
            ServerConnectionDebug scd = (ServerConnectionDebug)
                msgContext.getProperty(ServerHandler.SERVER_CONNECTION_DEBUG);
View Full Code Here

Examples of org.apache.http.nio.NHttpClientConnection

            }
            HttpHost httpHost = new HttpHost(url.getHost(), port, url.getProtocol());

            Axis2HttpRequest axis2Req = new Axis2HttpRequest(epr, httpHost, msgContext);

            NHttpClientConnection conn = ConnectionPool.getConnection(url.getHost(), port);

            if (conn == null) {
                ioReactor.connect(new InetSocketAddress(url.getHost(), port),
                    null, axis2Req, sessionRequestCallback);
                log.debug("A new connection established");
View Full Code Here

Examples of org.apache.http.nio.NHttpClientConnection

                log.debug("No connections available for reuse");
            }
            return null;

        } else {
            NHttpClientConnection conn = null;

            synchronized (connections) {
                while (!connections.isEmpty()) {
                    conn = (NHttpClientConnection) connections.remove(0);

                    if (conn.isOpen()) {
                        if (log.isDebugEnabled()) {
                            log.debug("A connection to host : " + host + " on port : " +
                                port + " is available in the pool, and will be reused");
                        }
                        return conn;
                    } else {
                        if (log.isDebugEnabled()) {
                            log.debug("closing stale connection");
                        }
                        try {
                            conn.close();
                        } catch (IOException ignore) {
                        }
                    }
                }
            }
View Full Code Here

Examples of org.apache.http.nio.NHttpClientConnection

                log.debug("No connections available for reuse");
            }
            return null;

        } else {
            NHttpClientConnection conn = null;

            synchronized (connections) {
                while (!connections.isEmpty()) {
                    conn = (NHttpClientConnection) connections.remove(0);

                    if (conn.isOpen()) {
                        if (log.isDebugEnabled()) {
                            log.debug("A connection to host : " + host + " on port : " +
                                port + " is available in the pool, and will be reused");
                        }
                        return conn;
                    } else {
                        if (log.isDebugEnabled()) {
                            log.debug("closing stale connection");
                        }
                        try {
                            conn.close();
                        } catch (IOException ignore) {
                        }
                    }
                }
            }
View Full Code Here

Examples of org.apache.http.nio.NHttpClientConnection

            }
            HttpHost httpHost = new HttpHost(url.getHost(), port, url.getProtocol());

            Axis2HttpRequest axis2Req = new Axis2HttpRequest(epr, httpHost, msgContext);

            NHttpClientConnection conn = ConnectionPool.getConnection(url.getHost(), port);

            if (conn == null) {
                ioReactor.connect(new InetSocketAddress(url.getHost(), port),
                    null, axis2Req, sessionRequestCallback);
                log.debug("A new connection established");
View Full Code Here

Examples of org.apache.http.nio.NHttpClientConnection

          "Interrupted while trying to get a connection.");
      connRequest.cancel();
      return false;
    }

    NHttpClientConnection conn = connRequest.getConnection();
    if (conn == null) {
      getLogger().debug("Failed to obtain connection on node " + this.addr);
      connRequest.cancel();
      return false;
    } else {
      if (!user.equals("default")) {
        try {
          op.addAuthHeader(HttpUtil.buildAuthHeader(user, pass));
        } catch (UnsupportedEncodingException ex) {
          getLogger().error("Could not create auth header for request, "
            + "could not encode credentials into base64. Canceling op."
            + op, ex);
          op.cancel();
          connRequest.cancel();
        }
      }
      HttpContext context = conn.getContext();
      RequestHandle handle = new RequestHandle(connMgr, conn);
      context.setAttribute("request-handle", handle);
      context.setAttribute("operation", op);
      conn.requestOutput();
    }

    return true;
  }
View Full Code Here

Examples of org.apache.http.nio.NHttpClientConnection

                log.debug("No connections available for reuse");
            }
            return null;

        } else {
            NHttpClientConnection conn = null;

            synchronized (connections) {
                while (!connections.isEmpty()) {
                    conn = (NHttpClientConnection) connections.remove(0);

                    if (conn.isOpen()) {
                        if (log.isDebugEnabled()) {
                            log.debug("A connection to host : " + host + " on port : " +
                                port + " is available in the pool, and will be reused");
                        }
                        return conn;
                    } else {
                        if (log.isDebugEnabled()) {
                            log.debug("closing stale connection");
                        }
                        try {
                            conn.close();
                        } catch (IOException ignore) {
                        }
                    }
                }
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.