当前位置: 首页>>代码示例>>Java>>正文


Java ManagedClientConnection类代码示例

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


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

示例1: abortConnection

import org.apache.http.conn.ManagedClientConnection; //导入依赖的package包/类
/**
 * Shuts down the connection.
 * This method is called from a <code>catch</code> block in
 * {@link #execute execute} during exception handling.
 */
private void abortConnection() {
    ManagedClientConnection mcc = managedConn;
    if (mcc != null) {
        // we got here as the result of an exception
        // no response will be returned, release the connection
        managedConn = null;
        try {
            mcc.abortConnection();
        } catch (IOException ex) {
            if (this.log.isDebugEnabled()) {
                this.log.debug(ex.getMessage(), ex);
            }
        }
        // ensure the connection manager properly releases this connection
        try {
            mcc.releaseConnection();
        } catch(IOException ignored) {
            this.log.debug("Error releasing connection", ignored);
        }
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:27,代码来源:DefaultRequestDirector.java

示例2: requestConnection

import org.apache.http.conn.ManagedClientConnection; //导入依赖的package包/类
public final ClientConnectionRequest requestConnection(
        final HttpRoute route,
        final Object state) {

    return new ClientConnectionRequest() {

        public void abortRequest() {
            // Nothing to abort, since requests are immediate.
        }

        public ManagedClientConnection getConnection(
                long timeout, TimeUnit tunit) {
            return BasicClientConnectionManager.this.getConnection(
                    route, state);
        }

    };
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:19,代码来源:BasicClientConnectionManager.java

示例3: requestConnection

import org.apache.http.conn.ManagedClientConnection; //导入依赖的package包/类
public final ClientConnectionRequest requestConnection(
        final HttpRoute route,
        final Object state) {

    return new ClientConnectionRequest() {

        public void abortRequest() {
            // Nothing to abort, since requests are immediate.
        }

        public ManagedClientConnection getConnection(
                long timeout, TimeUnit tunit) {
            return SingleClientConnManager.this.getConnection(
                    route, state);
        }

    };
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:19,代码来源:SingleClientConnManager.java

示例4: requestConnection

import org.apache.http.conn.ManagedClientConnection; //导入依赖的package包/类
public ClientConnectionRequest requestConnection(
        final HttpRoute route,
        final Object state) {
    if (route == null) {
        throw new IllegalArgumentException("HTTP route may not be null");
    }
    if (this.log.isDebugEnabled()) {
        this.log.debug("Connection request: " + format(route, state) + formatStats(route));
    }
    final Future<HttpPoolEntry> future = this.pool.lease(route, state);

    return new ClientConnectionRequest() {

        public void abortRequest() {
            future.cancel(true);
        }

        public ManagedClientConnection getConnection(
                final long timeout,
                final TimeUnit tunit) throws InterruptedException, ConnectionPoolTimeoutException {
            return leaseConnection(future, timeout, tunit);
        }

    };

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:27,代码来源:PoolingClientConnectionManager.java

示例5: requestConnection

import org.apache.http.conn.ManagedClientConnection; //导入依赖的package包/类
@Override
public ClientConnectionRequest requestConnection(
        final HttpRoute route,
        final Object state) {
    Args.notNull(route, "HTTP route");
    if (this.log.isDebugEnabled()) {
        this.log.debug("Connection request: " + format(route, state) + formatStats(route));
    }
    final Future<HttpPoolEntry> future = this.pool.lease(route, state);

    return new ClientConnectionRequest() {
        @Override
        public void abortRequest() {
            future.cancel(true);
        }
        @Override
        public ManagedClientConnection getConnection(
                final long timeout,
                final TimeUnit tunit) throws InterruptedException, ConnectionPoolTimeoutException {
            return leaseConnection(future, timeout, tunit);
        }

    };

}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:26,代码来源:JMeterPoolingClientConnectionManager.java

示例6: abortConnection

import org.apache.http.conn.ManagedClientConnection; //导入依赖的package包/类
/**
 * Shuts down the connection.
 * This method is called from a {@code catch} block in
 * {@link #execute execute} during exception handling.
 */
private void abortConnection() {
    final ManagedClientConnection mcc = managedConn;
    if (mcc != null) {
        // we got here as the result of an exception
        // no response will be returned, release the connection
        managedConn = null;
        try {
            mcc.abortConnection();
        } catch (final IOException ex) {
            if (this.log.isDebugEnabled()) {
                this.log.debug(ex.getMessage(), ex);
            }
        }
        // ensure the connection manager properly releases this connection
        try {
            mcc.releaseConnection();
        } catch(final IOException ignored) {
            this.log.debug("Error releasing connection", ignored);
        }
    }
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:27,代码来源:DefaultRequestDirector.java

示例7: requestConnection

import org.apache.http.conn.ManagedClientConnection; //导入依赖的package包/类
@Override
public final ClientConnectionRequest requestConnection(
        final HttpRoute route,
        final Object state) {

    return new ClientConnectionRequest() {

        @Override
        public void abortRequest() {
            // Nothing to abort, since requests are immediate.
        }

        @Override
        public ManagedClientConnection getConnection(
                final long timeout, final TimeUnit tunit) {
            return BasicClientConnectionManager.this.getConnection(
                    route, state);
        }

    };
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:22,代码来源:BasicClientConnectionManager.java

示例8: getConnection

import org.apache.http.conn.ManagedClientConnection; //导入依赖的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

示例9: requestConnection

import org.apache.http.conn.ManagedClientConnection; //导入依赖的package包/类
@Override
public final ClientConnectionRequest requestConnection(
        final HttpRoute route,
        final Object state) {

    return new ClientConnectionRequest() {

        @Override
        public void abortRequest() {
            // Nothing to abort, since requests are immediate.
        }

        @Override
        public ManagedClientConnection getConnection(
                final long timeout, final TimeUnit tunit) {
            return SingleClientConnManager.this.getConnection(
                    route, state);
        }

    };
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:22,代码来源:SingleClientConnManager.java

示例10: requestConnection

import org.apache.http.conn.ManagedClientConnection; //导入依赖的package包/类
public final ClientConnectionRequest requestConnection(final HttpRoute paramHttpRoute, Object paramObject)
{
  new ClientConnectionRequest()
  {
    public final void abortRequest()
    {
      this.val$poolRequest.abortRequest();
    }
    
    public final ManagedClientConnection getConnection(long paramAnonymousLong, TimeUnit paramAnonymousTimeUnit)
      throws InterruptedException, ConnectionPoolTimeoutException
    {
      if (paramHttpRoute == null) {
        throw new IllegalArgumentException("Route may not be null.");
      }
      BasicPoolEntry localBasicPoolEntry = this.val$poolRequest.getPoolEntry(paramAnonymousLong, paramAnonymousTimeUnit);
      return new ElegantThreadSafeConnManager.ElegantBasicPooledConnAdapter(ElegantThreadSafeConnManager.this, localBasicPoolEntry);
    }
  };
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:21,代码来源:ElegantThreadSafeConnManager.java

示例11: releaseConnection

import org.apache.http.conn.ManagedClientConnection; //导入依赖的package包/类
public final void releaseConnection(ManagedClientConnection paramManagedClientConnection, long paramLong, TimeUnit paramTimeUnit)
{
  HttpConnectionMetrics localHttpConnectionMetrics = paramManagedClientConnection.getMetrics();
  if (localHttpConnectionMetrics != null)
  {
    long l1 = localHttpConnectionMetrics.getReceivedBytesCount();
    ArrayList localArrayList1 = (ArrayList)jsm.b.get();
    int i = localArrayList1.size();
    if (i > 0)
    {
      jso localjso2 = (jso)localArrayList1.get(i - 1);
      localjso2.d = (l1 + localjso2.d);
    }
    long l2 = localHttpConnectionMetrics.getSentBytesCount();
    ArrayList localArrayList2 = (ArrayList)jsm.b.get();
    int j = localArrayList2.size();
    if (j > 0)
    {
      jso localjso1 = (jso)localArrayList2.get(j - 1);
      localjso1.e = (l2 + localjso1.e);
    }
  }
  super.releaseConnection(paramManagedClientConnection, paramLong, paramTimeUnit);
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:25,代码来源:jsj.java

示例12: abortConnection

import org.apache.http.conn.ManagedClientConnection; //导入依赖的package包/类
/**
 * Shuts down the connection.
 * This method is called from a <code>catch</code> block in
 * {@link #execute execute} during exception handling.
 */
private void abortConnection() {
  ManagedClientConnection mcc = managedConn;
  if (mcc != null) {
    // we got here as the result of an exception
    // no response will be returned, release the connection
    managedConn = null;
    try {
      mcc.abortConnection();
    } catch (IOException ex) {
      if (this.log.isDebugEnabled()) {
        this.log.debug(ex.getMessage(), ex);
      }
    }
    // ensure the connection manager properly releases this connection
    try {
      mcc.releaseConnection();
    } catch(IOException ignored) {
      this.log.debug("Error releasing connection", ignored);
    }
  }
}
 
开发者ID:qx,项目名称:FullRobolectricTestSample,代码行数:27,代码来源:DefaultRequestDirector.java

示例13: requestConnection

import org.apache.http.conn.ManagedClientConnection; //导入依赖的package包/类
public final ClientConnectionRequest requestConnection(
        final HttpRoute route,
        final Object state) {
    
    return new ClientConnectionRequest() {
        
        public void abortRequest() {
            // Nothing to abort, since requests are immediate.
        }
        
        public ManagedClientConnection getConnection(
                long timeout, TimeUnit tunit) {
            return SingleClientConnManager.this.getConnection(
                    route, state);
        }
        
    };
}
 
开发者ID:tdopires,项目名称:cJUnit-mc626,代码行数:19,代码来源:SingleClientConnManager.java

示例14: abortConnection

import org.apache.http.conn.ManagedClientConnection; //导入依赖的package包/类
/**
 * Shuts down the connection.
 * This method is called from a <code>catch</code> block in
 * {@link #execute execute} during exception handling.
 */
private void abortConnection() {
    ManagedClientConnection mcc = managedConn;
    if (mcc != null) {
        // we got here as the result of an exception
        // no response will be returned, release the connection
        managedConn = null;
        try {
            mcc.abortConnection();
        } catch (IOException ex) {
        	if (DEBUG) {
        		Logger.debug(ex.getMessage(), ex);
            }
        }
        // ensure the connection manager properly releases this connection
        try {
            mcc.releaseConnection();
        } catch (IOException ignored) {
        	if (DEBUG) {
        		Logger.debug("Error releasing connection", ignored);
        	}
        }
    }
}
 
开发者ID:cattong,项目名称:YiBo,代码行数:29,代码来源:LibRequestDirector.java

示例15: abortConnection

import org.apache.http.conn.ManagedClientConnection; //导入依赖的package包/类
/**
 * Shuts down the connection.
 * This method is called from a <code>catch</code> block in
 * {@link #execute execute} during exception handling.
 */
private void abortConnection() {
    ManagedClientConnection mcc = managedConn;
    if (mcc != null) {
        // we got here as the result of an exception
        // no response will be returned, release the connection
        managedConn = null;
        try {
            mcc.abortConnection();
        } catch (IOException ex) {
        	if (Constants.DEBUG) {
        		logger.debug(ex.getMessage(), ex);
            }
        }
        // ensure the connection manager properly releases this connection
        try {
            mcc.releaseConnection();
        } catch (IOException ignored) {
        	if (Constants.DEBUG) {
        		logger.debug("Error releasing connection", ignored);
        	}
        }
    }
}
 
开发者ID:yibome,项目名称:yibo-library,代码行数:29,代码来源:YiBoRequestDirector.java


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