Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
31842b4a
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
31842b4a
编写于
7月 21, 2011
作者:
C
chegar
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7068416: Lightweight HTTP Server should support TCP_NODELAY
Reviewed-by: alanb, michaelm
上级
7bb451c3
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
53 addition
and
45 deletion
+53
-45
src/share/classes/sun/net/httpserver/ServerConfig.java
src/share/classes/sun/net/httpserver/ServerConfig.java
+42
-42
src/share/classes/sun/net/httpserver/ServerImpl.java
src/share/classes/sun/net/httpserver/ServerImpl.java
+6
-3
test/com/sun/net/httpserver/Test1.java
test/com/sun/net/httpserver/Test1.java
+5
-0
未找到文件。
src/share/classes/sun/net/httpserver/ServerConfig.java
浏览文件 @
31842b4a
/*
* Copyright (c) 2005, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 201
1
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -25,8 +25,6 @@
package
sun.net.httpserver
;
import
com.sun.net.httpserver.*
;
import
com.sun.net.httpserver.spi.*
;
import
java.util.logging.Logger
;
import
java.security.PrivilegedAction
;
...
...
@@ -59,48 +57,46 @@ class ServerConfig {
static
long
maxReqTime
;
static
long
maxRspTime
;
static
long
timerMillis
;
static
boolean
debug
=
false
;
static
boolean
debug
;
// the value of the TCP_NODELAY socket-level option
static
boolean
noDelay
;
static
{
java
.
security
.
AccessController
.
doPrivileged
(
new
PrivilegedAction
<
Void
>()
{
@Override
public
Void
run
()
{
idleInterval
=
Long
.
getLong
(
"sun.net.httpserver.idleInterval"
,
DEFAULT_IDLE_INTERVAL
)
*
1000
;
clockTick
=
Integer
.
getInteger
(
"sun.net.httpserver.clockTick"
,
DEFAULT_CLOCK_TICK
);
maxIdleConnections
=
Integer
.
getInteger
(
"sun.net.httpserver.maxIdleConnections"
,
DEFAULT_MAX_IDLE_CONNECTIONS
);
drainAmount
=
Long
.
getLong
(
"sun.net.httpserver.drainAmount"
,
DEFAULT_DRAIN_AMOUNT
);
maxReqTime
=
Long
.
getLong
(
"sun.net.httpserver.maxReqTime"
,
DEFAULT_MAX_REQ_TIME
);
maxRspTime
=
Long
.
getLong
(
"sun.net.httpserver.maxRspTime"
,
DEFAULT_MAX_RSP_TIME
);
timerMillis
=
Long
.
getLong
(
"sun.net.httpserver.timerMillis"
,
DEFAULT_TIMER_MILLIS
);
debug
=
Boolean
.
getBoolean
(
"sun.net.httpserver.debug"
);
noDelay
=
Boolean
.
getBoolean
(
"sun.net.httpserver.nodelay"
);
return
null
;
}
});
idleInterval
=
((
Long
)
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
GetLongAction
(
"sun.net.httpserver.idleInterval"
,
DEFAULT_IDLE_INTERVAL
))).
longValue
()
*
1000
;
clockTick
=
((
Integer
)
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
GetIntegerAction
(
"sun.net.httpserver.clockTick"
,
DEFAULT_CLOCK_TICK
))).
intValue
();
maxIdleConnections
=
((
Integer
)
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
GetIntegerAction
(
"sun.net.httpserver.maxIdleConnections"
,
DEFAULT_MAX_IDLE_CONNECTIONS
))).
intValue
();
drainAmount
=
((
Long
)
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
GetLongAction
(
"sun.net.httpserver.drainAmount"
,
DEFAULT_DRAIN_AMOUNT
))).
longValue
();
maxReqTime
=
((
Long
)
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
GetLongAction
(
"sun.net.httpserver.maxReqTime"
,
DEFAULT_MAX_REQ_TIME
))).
longValue
();
maxRspTime
=
((
Long
)
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
GetLongAction
(
"sun.net.httpserver.maxRspTime"
,
DEFAULT_MAX_RSP_TIME
))).
longValue
();
timerMillis
=
((
Long
)
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
GetLongAction
(
"sun.net.httpserver.timerMillis"
,
DEFAULT_TIMER_MILLIS
))).
longValue
();
debug
=
((
Boolean
)
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
GetBooleanAction
(
"sun.net.httpserver.debug"
))).
booleanValue
();
}
...
...
@@ -172,4 +168,8 @@ class ServerConfig {
static
long
getTimerMillis
()
{
return
timerMillis
;
}
static
boolean
noDelay
()
{
return
noDelay
;
}
}
src/share/classes/sun/net/httpserver/ServerImpl.java
浏览文件 @
31842b4a
...
...
@@ -27,8 +27,6 @@ package sun.net.httpserver;
import
java.net.*
;
import
java.io.*
;
import
java.nio.*
;
import
java.security.*
;
import
java.nio.channels.*
;
import
java.util.*
;
import
java.util.concurrent.*
;
...
...
@@ -36,7 +34,6 @@ import java.util.logging.Logger;
import
java.util.logging.Level
;
import
javax.net.ssl.*
;
import
com.sun.net.httpserver.*
;
import
com.sun.net.httpserver.spi.*
;
import
sun.net.httpserver.HttpConnection.State
;
/**
...
...
@@ -358,6 +355,12 @@ class ServerImpl implements TimeSource {
continue
;
}
SocketChannel
chan
=
schan
.
accept
();
// Set TCP_NODELAY, if appropriate
if
(
ServerConfig
.
noDelay
())
{
chan
.
socket
().
setTcpNoDelay
(
true
);
}
if
(
chan
==
null
)
{
continue
;
/* cancel something ? */
}
...
...
test/com/sun/net/httpserver/Test1.java
浏览文件 @
31842b4a
...
...
@@ -26,6 +26,7 @@
* @bug 6270015
* @run main/othervm Test1
* @run main/othervm -Dsun.net.httpserver.maxReqTime=10 Test1
* @run main/othervm -Dsun.net.httpserver.nodelay=true Test1
* @summary Light weight HTTP server
*/
...
...
@@ -42,6 +43,10 @@ import javax.net.ssl.*;
* - send/receive large/small file
* - chunked encoding
* - via http and https
*
* The test is also run with sun.net.httpserver.nodelay simply to exercise
* this option. There is no specific pass or failure related to running with
* this option.
*/
public
class
Test1
extends
Test
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录