當前位置: 首頁>>代碼示例>>Java>>正文


Java ServerConnector.setSoLingerTime方法代碼示例

本文整理匯總了Java中org.eclipse.jetty.server.ServerConnector.setSoLingerTime方法的典型用法代碼示例。如果您正苦於以下問題:Java ServerConnector.setSoLingerTime方法的具體用法?Java ServerConnector.setSoLingerTime怎麽用?Java ServerConnector.setSoLingerTime使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.jetty.server.ServerConnector的用法示例。


在下文中一共展示了ServerConnector.setSoLingerTime方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testStaleConnection

import org.eclipse.jetty.server.ServerConnector; //導入方法依賴的package包/類
@Test
public final void testStaleConnection() throws Exception {
    startServer(new ResourcesResponseHandler(), 8089);
    ServerConnector sc = (ServerConnector) getServer().getConnectors()[0];
    sc.setSoLingerTime(-1);

    BaseFetcher fetcher = new SimpleHttpFetcher(1, TestUtils.CC_TEST_AGENT);
    String url = "http://localhost:8089/simple-page.html";
    fetcher.get(url);

    // TODO KKr - control keep-alive (linger?) value for Jetty, so we can
    // set it
    // to something short and thus make this sleep delay much shorter.
    Thread.sleep(2000);

    fetcher.get(url);
}
 
開發者ID:crawler-commons,項目名稱:http-fetcher,代碼行數:18,代碼來源:SimpleHttpFetcherTest.java

示例2: createConnector

import org.eclipse.jetty.server.ServerConnector; //導入方法依賴的package包/類
public ServerConnector createConnector(final Metric metric, final Server server, final ServerSocketChannel ch) {
    ServerConnector connector;
    if (connectorConfig.ssl().enabled()) {
        connector = new JDiscServerConnector(connectorConfig, metric, server, ch,
                                             newSslConnectionFactory(),
                                             newHttpConnectionFactory());
    } else {
        connector = new JDiscServerConnector(connectorConfig, metric, server, ch,
                                             newHttpConnectionFactory());
    }
    connector.setPort(connectorConfig.listenPort());
    connector.setName(connectorConfig.name());
    connector.setAcceptQueueSize(connectorConfig.acceptQueueSize());
    connector.setReuseAddress(connectorConfig.reuseAddress());
    double soLingerTimeSeconds = connectorConfig.soLingerTime();
    if (soLingerTimeSeconds == -1) {
        connector.setSoLingerTime(-1);
    } else {
        connector.setSoLingerTime((int)(soLingerTimeSeconds * 1000.0));
    }
    connector.setIdleTimeout((long)(connectorConfig.idleTimeout() * 1000.0));
    connector.setStopTimeout((long)(connectorConfig.stopTimeout() * 1000.0));
    return connector;
}
 
開發者ID:vespa-engine,項目名稱:vespa,代碼行數:25,代碼來源:ConnectorFactory.java

示例3: configureConnector

import org.eclipse.jetty.server.ServerConnector; //導入方法依賴的package包/類
/**
 * Configures the server connector.
 *
 * <p>The default configuration sets a timeout of 1 minute and disables
 * TCP linger time.
 *
 * <p>To change the configuration, override this method in a derived class.
 * The overriding method must call its super method.
 *
 * @param connector connector to be configured
 * @param port port number handed over in constructor
 */
protected ServerConnector configureConnector(ServerConnector connector, int port) {
  connector.setIdleTimeout(60 * 1000);
  connector.setSoLingerTime(-1);
  connector.setPort(port);
  return connector;
}
 
開發者ID:apache,項目名稱:calcite-avatica,代碼行數:19,代碼來源:HttpServer.java


注:本文中的org.eclipse.jetty.server.ServerConnector.setSoLingerTime方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。