• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java OperatedClientConnection类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.http.conn.OperatedClientConnection的典型用法代码示例。如果您正苦于以下问题:Java OperatedClientConnection类的具体用法?Java OperatedClientConnection怎么用?Java OperatedClientConnection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



OperatedClientConnection类属于org.apache.http.conn包,在下文中一共展示了OperatedClientConnection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: updateSecureConnection

import org.apache.http.conn.OperatedClientConnection; //导入依赖的package包/类
@Override
public void updateSecureConnection(
        final OperatedClientConnection conn,
        final HttpHost target,
        final HttpContext context,
        final HttpParams params) throws IOException {
    Args.notNull(conn, "Connection");
    Args.notNull(target, "Target host");
    Args.notNull(params, "Parameters");
    Asserts.check(conn.isOpen(), "Connection must be open");

    final SchemeRegistry registry = getSchemeRegistry(context);
    final Scheme schm = registry.getScheme(target.getSchemeName());
    Asserts.check(schm.getSchemeSocketFactory() instanceof SchemeLayeredSocketFactory,
        "Socket factory must implement SchemeLayeredSocketFactory");
    final SchemeLayeredSocketFactory lsf = (SchemeLayeredSocketFactory) schm.getSchemeSocketFactory();
    final Socket sock = lsf.createLayeredSocket(
            conn.getSocket(), target.getHostName(), schm.resolvePort(target.getPort()), params);
    prepareSocket(sock, context, params);
    conn.update(sock, target, lsf.isSecure(sock), params);
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:22,代码来源:DefaultClientConnectionOperator.java


示例2: getConnection

import org.apache.http.conn.OperatedClientConnection; //导入依赖的package包/类
ManagedClientConnection getConnection(final HttpRoute route, final Object state) {
    Args.notNull(route, "Route");
    synchronized (this) {
        assertNotShutdown();
        if (this.log.isDebugEnabled()) {
            this.log.debug("Get connection for route " + route);
        }
        Asserts.check(this.conn == null, MISUSE_MESSAGE);
        if (this.poolEntry != null && !this.poolEntry.getPlannedRoute().equals(route)) {
            this.poolEntry.close();
            this.poolEntry = null;
        }
        if (this.poolEntry == null) {
            final String id = Long.toString(COUNTER.getAndIncrement());
            final OperatedClientConnection opconn = this.connOperator.createConnection();
            this.poolEntry = new HttpPoolEntry(this.log, id, route, opconn, 0, TimeUnit.MILLISECONDS);
        }
        final long now = System.currentTimeMillis();
        if (this.poolEntry.isExpired(now)) {
            this.poolEntry.close();
            this.poolEntry.getTracker().reset();
        }
        this.conn = new ManagedClientConnectionImpl(this, this.connOperator, this.poolEntry);
        return this.conn;
    }
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:27,代码来源:BasicClientConnectionManager.java


示例3: abortConnection

import org.apache.http.conn.OperatedClientConnection; //导入依赖的package包/类
@Override
public void abortConnection() {
    synchronized (this) {
        if (this.poolEntry == null) {
            return;
        }
        this.reusable = false;
        final OperatedClientConnection conn = this.poolEntry.getConnection();
        try {
            conn.shutdown();
        } catch (final IOException ignore) {
        }
        this.manager.releaseConnection(this, this.duration, TimeUnit.MILLISECONDS);
        this.poolEntry = null;
    }
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:17,代码来源:ManagedClientConnectionImpl.java


示例4: updateSecureConnection

import org.apache.http.conn.OperatedClientConnection; //导入依赖的package包/类
public void updateSecureConnection(
        final OperatedClientConnection conn,
        final HttpHost target,
        final HttpContext context,
        final HttpParams params) throws IOException {
    if (conn == null) {
        throw new IllegalArgumentException("Connection may not be null");
    }
    if (target == null) {
        throw new IllegalArgumentException("Target host may not be null");
    }
    if (params == null) {
        throw new IllegalArgumentException("Parameters may not be null");
    }
    if (!conn.isOpen()) {
        throw new IllegalStateException("Connection must be open");
    }

    final Scheme schm = schemeRegistry.getScheme(target.getSchemeName());
    if (!(schm.getSchemeSocketFactory() instanceof SchemeLayeredSocketFactory)) {
        throw new IllegalArgumentException
            ("Target scheme (" + schm.getName() +
             ") must have layered socket factory.");
    }

    SchemeLayeredSocketFactory lsf = (SchemeLayeredSocketFactory) schm.getSchemeSocketFactory();
    Socket sock;
    try {
        sock = lsf.createLayeredSocket(
                conn.getSocket(), target.getHostName(), target.getPort(), params);
    } catch (ConnectException ex) {
        throw new HttpHostConnectException(target, ex);
    }
    prepareSocket(sock, context, params);
    conn.update(sock, target, lsf.isSecure(sock), params);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:37,代码来源:DefaultClientConnectionOperator.java


示例5: AbstractClientConnAdapter

import org.apache.http.conn.OperatedClientConnection; //导入依赖的package包/类
/**
 * Creates a new connection adapter.
 * The adapter is initially <i>not</i>
 * {@link #isMarkedReusable marked} as reusable.
 *
 * @param mgr       the connection manager, or <code>null</code>
 * @param conn      the connection to wrap, or <code>null</code>
 */
protected AbstractClientConnAdapter(ClientConnectionManager mgr,
                                    OperatedClientConnection conn) {
    super();
    connManager = mgr;
    wrappedConnection = conn;
    markedReusable = false;
    released = false;
    duration = Long.MAX_VALUE;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:AbstractClientConnAdapter.java


示例6: assertValid

import org.apache.http.conn.OperatedClientConnection; //导入依赖的package包/类
/**
 * Asserts that there is a valid wrapped connection to delegate to.
 *
 * @throws ConnectionShutdownException if there is no wrapped connection
 *                                  or connection has been aborted
 */
protected final void assertValid(
        final OperatedClientConnection wrappedConn) throws ConnectionShutdownException {
    if (isReleased() || wrappedConn == null) {
        throw new ConnectionShutdownException();
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:AbstractClientConnAdapter.java


示例7: isOpen

import org.apache.http.conn.OperatedClientConnection; //导入依赖的package包/类
public boolean isOpen() {
    OperatedClientConnection conn = getWrappedConnection();
    if (conn == null)
        return false;

    return conn.isOpen();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:AbstractClientConnAdapter.java


示例8: isStale

import org.apache.http.conn.OperatedClientConnection; //导入依赖的package包/类
public boolean isStale() {
    if (isReleased())
        return true;
    OperatedClientConnection conn = getWrappedConnection();
    if (conn == null)
        return true;

    return conn.isStale();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:AbstractClientConnAdapter.java


示例9: receiveResponseEntity

import org.apache.http.conn.OperatedClientConnection; //导入依赖的package包/类
public void receiveResponseEntity(HttpResponse response)
    throws HttpException, IOException {
    OperatedClientConnection conn = getWrappedConnection();
    assertValid(conn);
    unmarkReusable();
    conn.receiveResponseEntity(response);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:AbstractClientConnAdapter.java


示例10: receiveResponseHeader

import org.apache.http.conn.OperatedClientConnection; //导入依赖的package包/类
public HttpResponse receiveResponseHeader()
    throws HttpException, IOException {
    OperatedClientConnection conn = getWrappedConnection();
    assertValid(conn);
    unmarkReusable();
    return conn.receiveResponseHeader();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:AbstractClientConnAdapter.java


示例11: sendRequestEntity

import org.apache.http.conn.OperatedClientConnection; //导入依赖的package包/类
public void sendRequestEntity(HttpEntityEnclosingRequest request)
    throws HttpException, IOException {
    OperatedClientConnection conn = getWrappedConnection();
    assertValid(conn);
    unmarkReusable();
    conn.sendRequestEntity(request);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:AbstractClientConnAdapter.java


示例12: sendRequestHeader

import org.apache.http.conn.OperatedClientConnection; //导入依赖的package包/类
public void sendRequestHeader(HttpRequest request)
    throws HttpException, IOException {
    OperatedClientConnection conn = getWrappedConnection();
    assertValid(conn);
    unmarkReusable();
    conn.sendRequestHeader(request);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:AbstractClientConnAdapter.java


示例13: getSSLSession

import org.apache.http.conn.OperatedClientConnection; //导入依赖的package包/类
public SSLSession getSSLSession() {
    OperatedClientConnection conn = getWrappedConnection();
    assertValid(conn);
    if (!isOpen())
        return null;

    SSLSession result = null;
    Socket    sock    = conn.getSocket();
    if (sock instanceof SSLSocket) {
        result = ((SSLSocket)sock).getSession();
    }
    return result;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:AbstractClientConnAdapter.java


示例14: getAttribute

import org.apache.http.conn.OperatedClientConnection; //导入依赖的package包/类
public Object getAttribute(final String id) {
    OperatedClientConnection conn = getWrappedConnection();
    assertValid(conn);
    if (conn instanceof HttpContext) {
        return ((HttpContext) conn).getAttribute(id);
    } else {
        return null;
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:AbstractClientConnAdapter.java


示例15: removeAttribute

import org.apache.http.conn.OperatedClientConnection; //导入依赖的package包/类
public Object removeAttribute(final String id) {
    OperatedClientConnection conn = getWrappedConnection();
    assertValid(conn);
    if (conn instanceof HttpContext) {
        return ((HttpContext) conn).removeAttribute(id);
    } else {
        return null;
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:AbstractClientConnAdapter.java


示例16: setAttribute

import org.apache.http.conn.OperatedClientConnection; //导入依赖的package包/类
public void setAttribute(final String id, final Object obj) {
    OperatedClientConnection conn = getWrappedConnection();
    assertValid(conn);
    if (conn instanceof HttpContext) {
        ((HttpContext) conn).setAttribute(id, obj);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:AbstractClientConnAdapter.java


示例17: getConnection

import org.apache.http.conn.OperatedClientConnection; //导入依赖的package包/类
private OperatedClientConnection getConnection() {
    HttpPoolEntry local = this.poolEntry;
    if (local == null) {
        return null;
    }
    return local.getConnection();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:ManagedClientConnectionImpl.java


示例18: ensureConnection

import org.apache.http.conn.OperatedClientConnection; //导入依赖的package包/类
private OperatedClientConnection ensureConnection() {
    HttpPoolEntry local = this.poolEntry;
    if (local == null) {
        throw new ConnectionShutdownException();
    }
    return local.getConnection();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:ManagedClientConnectionImpl.java


示例19: close

import org.apache.http.conn.OperatedClientConnection; //导入依赖的package包/类
public void close() throws IOException {
    HttpPoolEntry local = this.poolEntry;
    if (local != null) {
        OperatedClientConnection conn = local.getConnection();
        local.getTracker().reset();
        conn.close();
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:9,代码来源:ManagedClientConnectionImpl.java


示例20: shutdown

import org.apache.http.conn.OperatedClientConnection; //导入依赖的package包/类
public void shutdown() throws IOException {
    HttpPoolEntry local = this.poolEntry;
    if (local != null) {
        OperatedClientConnection conn = local.getConnection();
        local.getTracker().reset();
        conn.shutdown();
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:9,代码来源:ManagedClientConnectionImpl.java



注:本文中的org.apache.http.conn.OperatedClientConnection类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RowSorterEvent类代码示例发布时间:2022-05-21
下一篇:
Java InputFiles类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap