public StreamClientImpl(StreamClientConfigurationImpl configuration) throws InitializationException { this.configuration = configuration; log.info("Starting Jetty HttpClient..."); client = new HttpClient(); // Jetty client needs threads for its internal expiration routines, which we don't need but // can't disable, so let's abuse the request executor service for this client.setThreadPool( new ExecutorThreadPool(getConfiguration().getRequestExecutorService()) { @Override protected void doStop() throws Exception { // Do nothing, don't shut down the Cling ExecutorService when Jetty stops! } } ); // These are some safety settings, we should never run into these timeouts as we // do our own expiration checking client.setTimeout((configuration.getTimeoutSeconds()+5) * 1000); client.setConnectTimeout((configuration.getTimeoutSeconds()+5) * 1000); client.setMaxRetries(configuration.getRequestRetryCount()); try { client.start(); } catch (Exception ex) { throw new InitializationException( "Could not start Jetty HTTP client: " + ex, ex ); } }
public StreamClientImpl(StreamClientConfigurationImpl configuration) throws InitializationException { this.configuration = configuration; log.info("Starting Jetty HttpClient..."); client = new HttpClient(); // Jetty client needs threads for its internal expiration routines, which we don't need but // can't disable, so let's abuse the request executor service for this client.setThreadPool( new ExecutorThreadPool(getConfiguration().getRequestExecutorService()) { @Override protected void doStop() throws Exception { // Do nothing, don't shut down the Cling ExecutorService when Jetty stops! } } ); // These are some safety settings, we should never run into these timeouts as we // do our own expiration checking client.setTimeout((configuration.getTimeoutSeconds()+5) * 1000); client.setConnectTimeout((configuration.getTimeoutSeconds()+5) * 1000); client.setMaxRetries(configuration.getRequestRetryCount()); try { client.start(); } catch (Exception ex) { throw new InitializationException( "Could not start Jetty HTTP client: " + ex, ex ); } }
/** * @deprecated use {@link #setTimeout(long)} instead. * @param timeout the period in ms that an exchange will wait for a response from the server. */ @Deprecated public void setSoTimeout(int timeout) { setTimeout(timeout); }
@Override public void setTimeout(long timeout) { client.setTimeout(timeout); ce.setTimeout(timeout); }
asyncclient.setConnectorType(HttpClient.CONNECTOR_SELECT_CHANNEL); asyncclient.setMaxConnectionsPerAddress(asyncmaxconns); asyncclient.setTimeout(asynctimeout); try { asyncclient.start();
httpClient.setTimeout(TIMEOUT); httpClient.start();
private BayeuxClient makeClient() throws Exception { HttpClient httpClient = new HttpClient(); httpClient.setConnectTimeout(CONNECTION_TIMEOUT); httpClient.setTimeout(READ_TIMEOUT); httpClient.start(); if (sfdcSession == null) { logger.error("Invalid session !"); return null; } logger.info("Login successful!\nServer URL: " + sfdcSession.getEndPoint() + "\nSession ID=" + sfdcSession.getSessionId()); Map<String, Object> options = new HashMap<String, Object>(); options.put(ClientTransport.TIMEOUT_OPTION, READ_TIMEOUT); LongPollingTransport transport = new LongPollingTransport( options, httpClient) { @Override protected void customize(ContentExchange exchange) { super.customize(exchange); exchange.addRequestHeader("Authorization", "OAuth " + sfdcSession.getSessionId()); } }; BayeuxClient client = new BayeuxClient(getSalesforceStreamingEndpoint( sfdcSession.getEndPoint()), transport); return client; }
client.setTimeout(Long.parseLong(t));
httpClient.setTimeout( connectionTimeoutMs );
_client.setTimeout(Long.parseLong(_timeout));
public StreamClientImpl(StreamClientConfigurationImpl configuration) throws InitializationException { this.configuration = configuration; log.info("Starting Jetty HttpClient..."); client = new HttpClient(); // Jetty client needs threads for its internal expiration routines, which we don't need but // can't disable, so let's abuse the request executor service for this client.setThreadPool( new ExecutorThreadPool(getConfiguration().getRequestExecutorService()) { @Override protected void doStop() throws Exception { // Do nothing, don't shut down the Cling ExecutorService when Jetty stops! } } ); // These are some safety settings, we should never run into these timeouts as we // do our own expiration checking client.setTimeout((configuration.getTimeoutSeconds()+5) * 1000); client.setConnectTimeout((configuration.getTimeoutSeconds()+5) * 1000); client.setMaxRetries(configuration.getRequestRetryCount()); try { client.start(); } catch (Exception ex) { throw new InitializationException( "Could not start Jetty HTTP client: " + ex, ex ); } }
public org.eclipse.jetty.client.HttpClient createNewJettyClient() throws Exception { org.eclipse.jetty.client.HttpClient tempClient = new org.eclipse.jetty.client.HttpClient(); QueuedThreadPool btp = new QueuedThreadPool(); btp.setMaxThreads(getConfiguration().getJettyClientThreadPoolSize()); tempClient.setThreadPool(btp); tempClient.setConnectorType(org.eclipse.jetty.client.HttpClient.CONNECTOR_SELECT_CHANNEL); tempClient.setTimeout(getConfiguration().getProviderExpirationTime()); tempClient.setConnectTimeout(getConfiguration().getClientConnectTimeout()); tempClient.setMaxConnectionsPerAddress(getConfiguration().getMaxConnectionsPerAddress()); tempClient.start(); return tempClient; }
public HttpClient buildHttpClient() { HttpClient client = new HttpClient(); //client.setConnectBlocking(false); client.setConnectorType(HttpClient.CONNECTOR_SELECT_CHANNEL); client.setConnectTimeout(getConnectTimeoutMillis()); client.setTimeout(getReadTimeoutMillis()); client.setMaxConnectionsPerAddress(getPoolMaximumSize()); client.setThreadPool(new QueuedThreadPool(getPoolMaximumSize())); //client.setIdleTimeout(config.get???); if (getFollowRedirects()) { client.setMaxRedirects(10); } if (getAuthentication() != null) { Realm realm = new SimpleRealm("whatever", getAuthentication().getUsername(), getAuthentication().getPassword()); client.setRealmResolver(new SimpleRealmResolver(realm)); } return client; }
jettyClient.setTimeout(getProviderExpirationTime()); jettyClient.setMaxConnectionsPerAddress(getMaxConnectionsPerAddress()); if (principal != null && credentials != null) {