Package io.undertow.client

Examples of io.undertow.client.ClientConnection


        return TARGET;
    }

    @Override
    public void getConnection(ProxyTarget target, HttpServerExchange exchange, ProxyCallback<ProxyConnection> callback, long timeout, TimeUnit timeUnit) {
        ClientConnection existing = exchange.getConnection().getAttachment(clientAttachmentKey);
        if (existing != null) {
            if (existing.isOpen()) {
                //this connection already has a client, re-use it
                callback.completed(exchange, new ProxyConnection(existing, uri.getPath() == null ? "/" : uri.getPath()));
                return;
            } else {
                exchange.getConnection().removeAttachment(clientAttachmentKey);
View Full Code Here


    private void returnConnection(final ClientConnection connection) {
        HostThreadData hostData = getData();
        if (closed) {
            //the host has been closed
            IoUtils.safeClose(connection);
            ClientConnection con = hostData.availableConnections.poll();
            while (con != null) {
                IoUtils.safeClose(con);
                con = hostData.availableConnections.poll();
            }
            redistributeQueued(hostData);
View Full Code Here

    /**
     * @param exclusive - Is connection for the exclusive use of one client?
     */
    public void connect(ProxyClient.ProxyTarget proxyTarget, HttpServerExchange exchange, ProxyCallback<ProxyConnection> callback, final long timeout, final TimeUnit timeUnit, boolean exclusive) {
        HostThreadData data = getData();
        ClientConnection conn = data.availableConnections.poll();
        while (conn != null && !conn.isOpen()) {
            conn = data.availableConnections.poll();
        }
        if (conn != null) {
            if (exclusive) {
                data.connections--;
View Full Code Here

                    UndertowLogger.REQUEST_LOGGER.timingOutRequest(exchange.getRequestURI());

                    ProxyConnection connectionAttachment = exchange.getAttachment(CONNECTION);
                    if (connectionAttachment != null) {
                        //we rely on the close listener to end the exchange
                        ClientConnection clientConnection = connectionAttachment.getConnection();
                        IoUtils.safeClose(clientConnection);
                    } else {
                        exchange.setResponseCode(503);
                        exchange.endExchange();
                    }
View Full Code Here

                            connection.putAttachment(exclusiveConnectionKey, newHolder);
                            connection.addCloseListener(new ServerConnection.CloseListener() {

                                @Override
                                public void closed(ServerConnection connection) {
                                    ClientConnection clientConnection = newHolder.connection.getConnection();
                                    if (clientConnection.isOpen()) {
                                        safeClose(clientConnection);
                                    }
                                }
                            });
                        }
View Full Code Here

                    UndertowLogger.REQUEST_LOGGER.timingOutRequest(exchange.getRequestURI());

                    ProxyConnection connectionAttachment = exchange.getAttachment(CONNECTION);
                    if (connectionAttachment != null) {
                        //we rely on the close listener to end the exchange
                        ClientConnection clientConnection = connectionAttachment.getConnection();
                        IoUtils.safeClose(clientConnection);
                    } else {
                        exchange.setResponseCode(503);
                        exchange.endExchange();
                    }
View Full Code Here

                    UndertowLogger.REQUEST_LOGGER.timingOutRequest(exchange.getRequestURI());

                    ProxyConnection connectionAttachment = exchange.getAttachment(CONNECTION);
                    if (connectionAttachment != null) {
                        //we rely on the close listener to end the exchange
                        ClientConnection clientConnection = connectionAttachment.getConnection();
                        IoUtils.safeClose(clientConnection);
                    } else {
                        exchange.setResponseCode(503);
                        exchange.endExchange();
                    }
View Full Code Here

                            connection.putAttachment(exclusiveConnectionKey, newHolder);
                            connection.addCloseListener(new ServerConnection.CloseListener() {

                                @Override
                                public void closed(ServerConnection connection) {
                                    ClientConnection clientConnection = newHolder.connection.getConnection();
                                    if (clientConnection.isOpen()) {
                                        safeClose(clientConnection);
                                    }
                                }
                            });
                        }
View Full Code Here

    private void returnConnection(final ClientConnection connection) {
        HostThreadData hostData = getData();
        if (closed) {
            //the host has been closed
            IoUtils.safeClose(connection);
            ClientConnection con = hostData.availableConnections.poll();
            while (con != null) {
                IoUtils.safeClose(con);
                con = hostData.availableConnections.poll();
            }
            redistributeQueued(hostData);
View Full Code Here

    /**
     * @param exclusive - Is connection for the exclusive use of one client?
     */
    public void connect(ProxyClient.ProxyTarget proxyTarget, HttpServerExchange exchange, ProxyCallback<ProxyConnection> callback, final long timeout, final TimeUnit timeUnit, boolean exclusive) {
        HostThreadData data = getData();
        ClientConnection conn = data.availableConnections.poll();
        while (conn != null && !conn.isOpen()) {
            conn = data.availableConnections.poll();
        }
        if (conn != null) {
            if (exclusive) {
                data.connections--;
View Full Code Here

TOP

Related Classes of io.undertow.client.ClientConnection

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.