Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
touzizhuo03
Dubbo
提交
17aa99e8
D
Dubbo
项目概览
touzizhuo03
/
Dubbo
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Dubbo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
17aa99e8
编写于
1月 03, 2018
作者:
K
ken.lj
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Upgrade rest integration
上级
f4dfc6e4
变更
17
隐藏空白更改
内联
并排
Showing
17 changed file
with
183 addition
and
89 deletion
+183
-89
dubbo-admin/pom.xml
dubbo-admin/pom.xml
+1
-1
dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/ServiceBean.java
...ain/java/com/alibaba/dubbo/config/spring/ServiceBean.java
+16
-1
dubbo-container/dubbo-container-api/pom.xml
dubbo-container/dubbo-container-api/pom.xml
+10
-0
dubbo-demo/dubbo-demo-consumer/pom.xml
dubbo-demo/dubbo-demo-consumer/pom.xml
+14
-0
dubbo-maven/pom.xml
dubbo-maven/pom.xml
+1
-1
dubbo-remoting/dubbo-remoting-http/pom.xml
dubbo-remoting/dubbo-remoting-http/pom.xml
+6
-0
dubbo-remoting/dubbo-remoting-http/src/main/java/com/alibaba/dubbo/remoting/http/jetty/JettyHttpServer.java
...om/alibaba/dubbo/remoting/http/jetty/JettyHttpServer.java
+11
-6
dubbo-remoting/dubbo-remoting-http/src/main/java/com/alibaba/dubbo/remoting/http/servlet/ServletManager.java
...m/alibaba/dubbo/remoting/http/servlet/ServletManager.java
+0
-2
dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/RpcContext.java
...c-api/src/main/java/com/alibaba/dubbo/rpc/RpcContext.java
+43
-24
dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/ServiceClassHolder.java
...c/main/java/com/alibaba/dubbo/rpc/ServiceClassHolder.java
+1
-1
dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/filter/ContextFilter.java
...main/java/com/alibaba/dubbo/rpc/filter/ContextFilter.java
+12
-1
dubbo-rpc/dubbo-rpc-rest/pom.xml
dubbo-rpc/dubbo-rpc-rest/pom.xml
+1
-1
dubbo-rpc/dubbo-rpc-rest/src/main/java/com/alibaba/dubbo/rpc/protocol/rest/NettyServer.java
...java/com/alibaba/dubbo/rpc/protocol/rest/NettyServer.java
+8
-2
dubbo-rpc/dubbo-rpc-rest/src/main/java/com/alibaba/dubbo/rpc/protocol/rest/RestProtocol.java
...ava/com/alibaba/dubbo/rpc/protocol/rest/RestProtocol.java
+40
-39
dubbo-simple/dubbo-monitor-simple/pom.xml
dubbo-simple/dubbo-monitor-simple/pom.xml
+1
-1
dubbo/pom.xml
dubbo/pom.xml
+10
-1
pom.xml
pom.xml
+8
-8
未找到文件。
dubbo-admin/pom.xml
浏览文件 @
17aa99e8
...
...
@@ -112,7 +112,7 @@
</dependency>
<dependency>
<groupId>
javax.servlet
</groupId>
<artifactId>
servlet-api
</artifactId>
<artifactId>
javax.
servlet-api
</artifactId>
<scope>
provided
</scope>
</dependency>
<dependency>
...
...
dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/ServiceBean.java
浏览文件 @
17aa99e8
...
...
@@ -16,9 +16,17 @@
*/
package
com.alibaba.dubbo.config.spring
;
import
com.alibaba.dubbo.config.*
;
import
com.alibaba.dubbo.config.ApplicationConfig
;
import
com.alibaba.dubbo.config.ModuleConfig
;
import
com.alibaba.dubbo.config.MonitorConfig
;
import
com.alibaba.dubbo.config.ProtocolConfig
;
import
com.alibaba.dubbo.config.ProviderConfig
;
import
com.alibaba.dubbo.config.RegistryConfig
;
import
com.alibaba.dubbo.config.ServiceConfig
;
import
com.alibaba.dubbo.config.annotation.Service
;
import
com.alibaba.dubbo.config.spring.extension.SpringExtensionFactory
;
import
org.springframework.aop.support.AopUtils
;
import
org.springframework.beans.factory.BeanFactoryUtils
;
import
org.springframework.beans.factory.BeanNameAware
;
import
org.springframework.beans.factory.DisposableBean
;
...
...
@@ -258,4 +266,11 @@ public class ServiceBean<T> extends ServiceConfig<T> implements InitializingBean
unexport
();
}
// merged from dubbox
protected
Class
getServiceClass
(
T
ref
)
{
if
(
AopUtils
.
isAopProxy
(
ref
))
{
return
AopUtils
.
getTargetClass
(
ref
);
}
return
super
.
getServiceClass
(
ref
);
}
}
\ No newline at end of file
dubbo-container/dubbo-container-api/pom.xml
浏览文件 @
17aa99e8
...
...
@@ -38,6 +38,16 @@ limitations under the License.
<dependency>
<groupId>
org.mortbay.jetty
</groupId>
<artifactId>
jetty
</artifactId>
<exclusions>
<exclusion>
<groupId>
org.mortbay.jetty
</groupId>
<artifactId>
servlet-api
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
javax.servlet
</groupId>
<artifactId>
javax.servlet-api
</artifactId>
</dependency>
</dependencies>
<build>
...
...
dubbo-demo/dubbo-demo-consumer/pom.xml
浏览文件 @
17aa99e8
...
...
@@ -60,6 +60,20 @@ limitations under the License.
<groupId>
org.slf4j
</groupId>
<artifactId>
slf4j-api
</artifactId>
</dependency>
<dependency>
<groupId>
javax.servlet
</groupId>
<artifactId>
javax.servlet-api
</artifactId>
</dependency>
<dependency>
<groupId>
org.mortbay.jetty
</groupId>
<artifactId>
jetty
</artifactId>
<exclusions>
<exclusion>
<groupId>
org.mortbay.jetty
</groupId>
<artifactId>
servlet-api
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.apache.commons
</groupId>
<artifactId>
commons-lang3
</artifactId>
...
...
dubbo-maven/pom.xml
浏览文件 @
17aa99e8
...
...
@@ -158,7 +158,7 @@ limitations under the License.
</dependency>
<dependency>
<groupId>
javax.servlet
</groupId>
<artifactId>
servlet-api
</artifactId>
<artifactId>
javax.
servlet-api
</artifactId>
<version>
2.5
</version>
<scope>
provided
</scope>
</dependency>
...
...
dubbo-remoting/dubbo-remoting-http/pom.xml
浏览文件 @
17aa99e8
...
...
@@ -38,6 +38,12 @@
<dependency>
<groupId>
org.mortbay.jetty
</groupId>
<artifactId>
jetty
</artifactId>
<exclusions>
<exclusion>
<groupId>
org.mortbay.jetty
</groupId>
<artifactId>
servlet-api
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.apache.tomcat.embed
</groupId>
...
...
dubbo-remoting/dubbo-remoting-http/src/main/java/com/alibaba/dubbo/remoting/http/jetty/JettyHttpServer.java
浏览文件 @
17aa99e8
...
...
@@ -25,6 +25,7 @@ import com.alibaba.dubbo.remoting.http.HttpHandler;
import
com.alibaba.dubbo.remoting.http.servlet.DispatcherServlet
;
import
com.alibaba.dubbo.remoting.http.servlet.ServletManager
;
import
com.alibaba.dubbo.remoting.http.support.AbstractHttpServer
;
import
org.mortbay.jetty.Server
;
import
org.mortbay.jetty.nio.SelectChannelConnector
;
import
org.mortbay.jetty.servlet.Context
;
...
...
@@ -39,16 +40,17 @@ public class JettyHttpServer extends AbstractHttpServer {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
JettyHttpServer
.
class
);
private
Server
server
;
private
URL
url
;
public
JettyHttpServer
(
URL
url
,
final
HttpHandler
handler
)
{
super
(
url
,
handler
);
this
.
url
=
url
;
// TODO we should leave this setting to slf4j
// we must disable the debug logging for production use
Log
.
setLog
(
new
StdErrLog
());
Log
.
getLog
().
setDebugEnabled
(
false
);
DispatcherServlet
.
addHttpHandler
(
url
.
getParameter
(
Constants
.
BIND_PORT_KEY
,
url
.
getPort
()),
handler
);
int
threads
=
url
.
getParameter
(
Constants
.
THREADS_KEY
,
Constants
.
DEFAULT_THREADS
);
...
...
@@ -72,13 +74,13 @@ public class JettyHttpServer extends AbstractHttpServer {
ServletHandler
servletHandler
=
new
ServletHandler
();
ServletHolder
servletHolder
=
servletHandler
.
addServletWithMapping
(
DispatcherServlet
.
class
,
"/*"
);
servletHolder
.
setInitOrder
(
2
);
// dubbo's original impl can't support the use of ServletContext
// server.addHandler(servletHandler);
// server.addHandler(servletHandler);
// TODO Context.SESSIONS is the best option here?
Context
context
=
new
Context
(
server
,
"/"
,
Context
.
SESSIONS
);
context
.
setServletHandler
(
servletHandler
);
ServletManager
.
getInstance
().
addServletContext
(
url
.
getP
ort
(
),
context
.
getServletContext
());
ServletManager
.
getInstance
().
addServletContext
(
url
.
getP
arameter
(
Constants
.
BIND_PORT_KEY
,
url
.
getPort
()
),
context
.
getServletContext
());
try
{
server
.
start
();
...
...
@@ -90,7 +92,10 @@ public class JettyHttpServer extends AbstractHttpServer {
public
void
close
()
{
super
.
close
();
ServletManager
.
getInstance
().
removeServletContext
(
url
.
getPort
());
//
ServletManager
.
getInstance
().
removeServletContext
(
url
.
getParameter
(
Constants
.
BIND_PORT_KEY
,
url
.
getPort
()));
if
(
server
!=
null
)
{
try
{
server
.
stop
();
...
...
dubbo-remoting/dubbo-remoting-http/src/main/java/com/alibaba/dubbo/remoting/http/servlet/ServletManager.java
浏览文件 @
17aa99e8
...
...
@@ -21,9 +21,7 @@ import java.util.concurrent.ConcurrentHashMap;
/**
* TODO this may not be a pretty elegant solution,
* and we may need to make change to the whole remoting-http architecture in the future
*
* @author lishen
*/
public
class
ServletManager
{
...
...
dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/RpcContext.java
浏览文件 @
17aa99e8
...
...
@@ -68,13 +68,6 @@ public class RpcContext {
private
InetSocketAddress
localAddress
;
private
InetSocketAddress
remoteAddress
;
// now we don't use the 'values' map to hold these objects
// we want these objects to be as generic as possible
private
Object
request
;
private
Object
response
;
@Deprecated
private
List
<
Invoker
<?>>
invokers
;
@Deprecated
...
...
@@ -82,11 +75,34 @@ public class RpcContext {
@Deprecated
private
Invocation
invocation
;
// now we don't use the 'values' map to hold these objects
// we want these objects to be as generic as possible
private
Object
request
;
private
Object
response
;
protected
RpcContext
()
{
}
/**
* Get the request object of the underlying RPC protocol, e.g. HttServletRequest
* get context.
*
* @return context
*/
public
static
RpcContext
getContext
()
{
return
LOCAL
.
get
();
}
/**
* remove context.
*
* @see com.alibaba.dubbo.rpc.filter.ContextFilter
*/
public
static
void
removeContext
()
{
LOCAL
.
remove
();
}
/**
* Get the request object of the underlying RPC protocol, e.g. HttpServletRequest
*
* @return null if the underlying protocol doesn't provide support for getting request
*/
...
...
@@ -94,12 +110,23 @@ public class RpcContext {
return
request
;
}
/**
* Get the request object of the underlying RPC protocol, e.g. HttpServletRequest
*
* @return null if the underlying protocol doesn't provide support for getting request or the request is not of the specified type
*/
@SuppressWarnings
(
"unchecked"
)
public
<
T
>
T
getRequest
(
Class
<
T
>
clazz
)
{
return
(
request
!=
null
&&
clazz
.
isAssignableFrom
(
request
.
getClass
()))
?
(
T
)
request
:
null
;
}
public
void
setRequest
(
Object
request
)
{
this
.
request
=
request
;
}
/**
* Get the response object of the underlying RPC protocol, e.g. HttServletResponse
* Get the response object of the underlying RPC protocol, e.g. Htt
p
ServletResponse
*
* @return null if the underlying protocol doesn't provide support for getting response
*/
...
...
@@ -107,26 +134,18 @@ public class RpcContext {
return
response
;
}
public
void
setResponse
(
Object
response
)
{
this
.
response
=
response
;
}
/**
*
get context.
*
Get the response object of the underlying RPC protocol, e.g. HttpServletResponse
*
* @return
context
* @return
null if the underlying protocol doesn't provide support for getting response or the response is not of the specified type
*/
public
static
RpcContext
getContext
()
{
return
LOCAL
.
get
();
@SuppressWarnings
(
"unchecked"
)
public
<
T
>
T
getResponse
(
Class
<
T
>
clazz
)
{
return
(
response
!=
null
&&
clazz
.
isAssignableFrom
(
response
.
getClass
()))
?
(
T
)
response
:
null
;
}
/**
* remove context.
*
* @see com.alibaba.dubbo.rpc.filter.ContextFilter
*/
public
static
void
removeContext
()
{
LOCAL
.
remove
();
public
void
setResponse
(
Object
response
)
{
this
.
response
=
response
;
}
/**
...
...
dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/ServiceClassHolder.java
浏览文件 @
17aa99e8
package
com.alibaba.dubbo.rpc
;
/**
* TODO this is just a workround for rest protocol, and now we just ensure it works in the most common dubbo usages
* TODO this is just a work
a
round for rest protocol, and now we just ensure it works in the most common dubbo usages
*
* @author lishen
*/
...
...
dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/filter/ContextFilter.java
浏览文件 @
17aa99e8
...
...
@@ -50,9 +50,20 @@ public class ContextFilter implements Filter {
RpcContext
.
getContext
()
.
setInvoker
(
invoker
)
.
setInvocation
(
invocation
)
.
setAttachments
(
attachments
)
// .setAttachments(attachments) // merged from dubbox
.
setLocalAddress
(
invoker
.
getUrl
().
getHost
(),
invoker
.
getUrl
().
getPort
());
// mreged from dubbox
// we may already added some attachments into RpcContext before this filter (e.g. in rest protocol)
if
(
attachments
!=
null
)
{
if
(
RpcContext
.
getContext
().
getAttachments
()
!=
null
)
{
RpcContext
.
getContext
().
getAttachments
().
putAll
(
attachments
);
}
else
{
RpcContext
.
getContext
().
setAttachments
(
attachments
);
}
}
if
(
invocation
instanceof
RpcInvocation
)
{
((
RpcInvocation
)
invocation
).
setInvoker
(
invoker
);
}
...
...
dubbo-rpc/dubbo-rpc-rest/pom.xml
浏览文件 @
17aa99e8
...
...
@@ -60,7 +60,7 @@
<dependency>
<groupId>
org.jboss.resteasy
</groupId>
<artifactId>
resteasy-netty
</artifactId>
<artifactId>
resteasy-netty
4
</artifactId>
</dependency>
<dependency>
...
...
dubbo-rpc/dubbo-rpc-rest/src/main/java/com/alibaba/dubbo/rpc/protocol/rest/NettyServer.java
浏览文件 @
17aa99e8
...
...
@@ -17,13 +17,17 @@ package com.alibaba.dubbo.rpc.protocol.rest;
import
com.alibaba.dubbo.common.Constants
;
import
com.alibaba.dubbo.common.URL
;
import
io.netty.channel.ChannelOption
;
import
org.jboss.resteasy.plugins.server.netty.NettyJaxrsServer
;
import
org.jboss.resteasy.spi.ResteasyDeployment
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* Netty server can't support @Context injection of servlet objects since it's not a servlet container
*
* @author lishen
*/
public
class
NettyServer
extends
BaseRestServer
{
...
...
@@ -31,7 +35,9 @@ public class NettyServer extends BaseRestServer {
protected
void
doStart
(
URL
url
)
{
server
.
setPort
(
url
.
getPort
());
server
.
setKeepAlive
(
url
.
getParameter
(
Constants
.
KEEP_ALIVE_KEY
,
true
));
Map
<
ChannelOption
,
Object
>
channelOption
=
new
HashMap
<
ChannelOption
,
Object
>();
channelOption
.
put
(
ChannelOption
.
SO_KEEPALIVE
,
url
.
getParameter
(
Constants
.
KEEP_ALIVE_KEY
,
Constants
.
DEFAULT_KEEP_ALIVE
));
server
.
setChildChannelOptions
(
channelOption
);
server
.
setExecutorThreadCount
(
url
.
getParameter
(
Constants
.
THREADS_KEY
,
Constants
.
DEFAULT_THREADS
));
server
.
setIoWorkerCount
(
url
.
getParameter
(
Constants
.
IO_THREADS_KEY
,
Constants
.
DEFAULT_IO_THREADS
));
server
.
start
();
...
...
dubbo-rpc/dubbo-rpc-rest/src/main/java/com/alibaba/dubbo/rpc/protocol/rest/RestProtocol.java
浏览文件 @
17aa99e8
...
...
@@ -22,18 +22,19 @@ import com.alibaba.dubbo.remoting.http.HttpBinder;
import
com.alibaba.dubbo.remoting.http.servlet.BootstrapListener
;
import
com.alibaba.dubbo.remoting.http.servlet.ServletManager
;
import
com.alibaba.dubbo.rpc.RpcException
;
import
com.alibaba.dubbo.rpc.protocol.AbstractProxyProtocol
;
import
com.alibaba.dubbo.rpc.ServiceClassHolder
;
import
com.alibaba.dubbo.rpc.protocol.AbstractProxyProtocol
;
import
org.apache.http.HeaderElement
;
import
org.apache.http.HeaderElementIterator
;
import
org.apache.http.HttpResponse
;
import
org.apache.http.conn.ClientConnectionManager
;
import
org.apache.http.client.config.RequestConfig
;
import
org.apache.http.config.SocketConfig
;
import
org.apache.http.conn.ConnectionKeepAliveStrategy
;
import
org.apache.http.impl.client.DefaultHttpClient
;
import
org.apache.http.impl.conn.PoolingClientConnectionManager
;
import
org.apache.http.impl.client.CloseableHttpClient
;
import
org.apache.http.impl.client.HttpClientBuilder
;
import
org.apache.http.impl.conn.PoolingHttpClientConnectionManager
;
import
org.apache.http.message.BasicHeaderElementIterator
;
import
org.apache.http.params.HttpConnectionParams
;
import
org.apache.http.params.HttpParams
;
import
org.apache.http.protocol.HTTP
;
import
org.apache.http.protocol.HttpContext
;
import
org.jboss.resteasy.client.jaxrs.ResteasyClient
;
...
...
@@ -53,7 +54,6 @@ import java.util.concurrent.ConcurrentHashMap;
import
java.util.concurrent.TimeUnit
;
/**
* @author lishen
*/
public
class
RestProtocol
extends
AbstractProxyProtocol
{
...
...
@@ -81,7 +81,7 @@ public class RestProtocol extends AbstractProxyProtocol {
}
protected
<
T
>
Runnable
doExport
(
T
impl
,
Class
<
T
>
type
,
URL
url
)
throws
RpcException
{
String
addr
=
url
.
getIp
()
+
":"
+
url
.
getPort
(
);
String
addr
=
getAddr
(
url
);
Class
implClass
=
ServiceClassHolder
.
getInstance
().
popServiceClass
();
RestServer
server
=
servers
.
get
(
addr
);
if
(
server
==
null
)
{
...
...
@@ -131,40 +131,41 @@ public class RestProtocol extends AbstractProxyProtocol {
}
// TODO more configs to add
PoolingClientConnectionManager
connectionManager
=
new
PoolingClientConnectionManager
();
PoolingHttpClientConnectionManager
connectionManager
=
new
PoolingHttpClientConnectionManager
();
// 20 is the default maxTotal of current PoolingClientConnectionManager
connectionManager
.
setMaxTotal
(
url
.
getParameter
(
Constants
.
CONNECTIONS_KEY
,
20
));
connectionManager
.
setDefaultMaxPerRoute
(
url
.
getParameter
(
Constants
.
CONNECTIONS_KEY
,
20
));
connectionMonitor
.
addConnectionManager
(
connectionManager
);
// BasicHttpContext localContext = new BasicHttpContext();
DefaultHttpClient
httpClient
=
new
DefaultHttpClient
(
connectionManager
);
httpClient
.
setKeepAliveStrategy
(
new
ConnectionKeepAliveStrategy
()
{
public
long
getKeepAliveDuration
(
HttpResponse
response
,
HttpContext
context
)
{
HeaderElementIterator
it
=
new
BasicHeaderElementIterator
(
response
.
headerIterator
(
HTTP
.
CONN_KEEP_ALIVE
));
while
(
it
.
hasNext
())
{
HeaderElement
he
=
it
.
nextElement
();
String
param
=
he
.
getName
();
String
value
=
he
.
getValue
();
if
(
value
!=
null
&&
param
.
equalsIgnoreCase
(
"timeout"
))
{
return
Long
.
parseLong
(
value
)
*
1000
;
RequestConfig
requestConfig
=
RequestConfig
.
custom
()
.
setConnectTimeout
(
url
.
getParameter
(
Constants
.
TIMEOUT_KEY
,
Constants
.
DEFAULT_TIMEOUT
))
.
setSocketTimeout
(
url
.
getParameter
(
Constants
.
TIMEOUT_KEY
,
Constants
.
DEFAULT_TIMEOUT
))
.
build
();
SocketConfig
socketConfig
=
SocketConfig
.
custom
()
.
setSoKeepAlive
(
true
)
.
setTcpNoDelay
(
true
)
.
build
();
CloseableHttpClient
httpClient
=
HttpClientBuilder
.
create
()
.
setKeepAliveStrategy
(
new
ConnectionKeepAliveStrategy
()
{
public
long
getKeepAliveDuration
(
HttpResponse
response
,
HttpContext
context
)
{
HeaderElementIterator
it
=
new
BasicHeaderElementIterator
(
response
.
headerIterator
(
HTTP
.
CONN_KEEP_ALIVE
));
while
(
it
.
hasNext
())
{
HeaderElement
he
=
it
.
nextElement
();
String
param
=
he
.
getName
();
String
value
=
he
.
getValue
();
if
(
value
!=
null
&&
param
.
equalsIgnoreCase
(
"timeout"
))
{
return
Long
.
parseLong
(
value
)
*
1000
;
}
}
// TODO constant
return
30
*
1000
;
}
}
// TODO constant
return
30
*
1000
;
}
});
HttpParams
params
=
httpClient
.
getParams
();
// TODO currently no xml config for Constants.CONNECT_TIMEOUT_KEY so we directly reuse Constants.TIMEOUT_KEY for now
HttpConnectionParams
.
setConnectionTimeout
(
params
,
url
.
getParameter
(
Constants
.
TIMEOUT_KEY
,
Constants
.
DEFAULT_TIMEOUT
));
HttpConnectionParams
.
setSoTimeout
(
params
,
url
.
getParameter
(
Constants
.
TIMEOUT_KEY
,
Constants
.
DEFAULT_TIMEOUT
));
HttpConnectionParams
.
setTcpNoDelay
(
params
,
true
);
HttpConnectionParams
.
setSoKeepalive
(
params
,
true
);
})
.
setDefaultRequestConfig
(
requestConfig
)
.
setDefaultSocketConfig
(
socketConfig
)
.
build
();
ApacheHttpClient4Engine
engine
=
new
ApacheHttpClient4Engine
(
httpClient
/*, localContext*/
);
...
...
@@ -231,9 +232,9 @@ public class RestProtocol extends AbstractProxyProtocol {
protected
class
ConnectionMonitor
extends
Thread
{
private
volatile
boolean
shutdown
;
private
final
List
<
ClientConnectionManager
>
connectionManagers
=
Collections
.
synchronizedList
(
new
LinkedList
<
ClientConnectionManager
>());
private
final
List
<
PoolingHttpClientConnectionManager
>
connectionManagers
=
Collections
.
synchronizedList
(
new
LinkedList
<
PoolingHttp
ClientConnectionManager
>());
public
void
addConnectionManager
(
ClientConnectionManager
connectionManager
)
{
public
void
addConnectionManager
(
PoolingHttp
ClientConnectionManager
connectionManager
)
{
connectionManagers
.
add
(
connectionManager
);
}
...
...
@@ -242,7 +243,7 @@ public class RestProtocol extends AbstractProxyProtocol {
while
(!
shutdown
)
{
synchronized
(
this
)
{
wait
(
1000
);
for
(
ClientConnectionManager
connectionManager
:
connectionManagers
)
{
for
(
PoolingHttp
ClientConnectionManager
connectionManager
:
connectionManagers
)
{
connectionManager
.
closeExpiredConnections
();
// TODO constant
connectionManager
.
closeIdleConnections
(
30
,
TimeUnit
.
SECONDS
);
...
...
dubbo-simple/dubbo-monitor-simple/pom.xml
浏览文件 @
17aa99e8
...
...
@@ -105,7 +105,7 @@ limitations under the License.
</dependency>
<dependency>
<groupId>
javax.servlet
</groupId>
<artifactId>
servlet-api
</artifactId>
<artifactId>
javax.
servlet-api
</artifactId>
</dependency>
<dependency>
<groupId>
org.mortbay.jetty
</groupId>
...
...
dubbo/pom.xml
浏览文件 @
17aa99e8
...
...
@@ -100,6 +100,14 @@ limitations under the License.
<groupId>
org.apache.httpcomponents
</groupId>
<artifactId>
httpclient
</artifactId>
</exclusion>
<exclusion>
<groupId>
org.apache.tomcat.embed
</groupId>
<artifactId>
tomcat-embed-core
</artifactId>
</exclusion>
<exclusion>
<groupId>
org.apache.tomcat.embed
</groupId>
<artifactId>
tomcat-embed-logging-juli
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
...
...
@@ -202,7 +210,7 @@ limitations under the License.
</exclusion>
<exclusion>
<groupId>
org.jboss.resteasy
</groupId>
<artifactId>
resteasy-netty
</artifactId>
<artifactId>
resteasy-netty
4
</artifactId>
</exclusion>
<exclusion>
<groupId>
org.jboss.resteasy
</groupId>
...
...
@@ -398,6 +406,7 @@ limitations under the License.
<include>
com.alibaba:dubbo-rpc-thrift
</include>
<include>
com.alibaba:dubbo-rpc-memcached
</include>
<include>
com.alibaba:dubbo-rpc-redis
</include>
<include>
com.alibaba:dubbo-rpc-rest
</include>
<include>
com.alibaba:dubbo-filter-validation
</include>
<include>
com.alibaba:dubbo-filter-cache
</include>
<include>
com.alibaba:dubbo-cluster
</include>
...
...
pom.xml
浏览文件 @
17aa99e8
...
...
@@ -102,7 +102,7 @@ limitations under the License.
<thrift_version>
0.8.0
</thrift_version>
<jfreechart_version>
1.0.13
</jfreechart_version>
<hessian_version>
4.0.38
</hessian_version>
<servlet_version>
2.5
</servlet_version>
<servlet_version>
3.1.0
</servlet_version>
<jetty_version>
6.1.26
</jetty_version>
<validation_version>
1.1.0.Final
</validation_version>
<hibernate_validator_version>
5.4.1.Final
</hibernate_validator_version>
...
...
@@ -113,11 +113,11 @@ limitations under the License.
<cglib_version>
2.2
</cglib_version>
<webx_version>
3.1.6
</webx_version>
<velocity_version>
1.7
</velocity_version>
<kryo_version>
2.24.0
</kryo_version>
<kryo_serializers_version>
0.
26
</kryo_serializers_version>
<fst_version>
1.55
</fst_version>
<kryo_version>
4.0.1
</kryo_version>
<kryo_serializers_version>
0.
42
</kryo_serializers_version>
<fst_version>
2.48-jdk-6
</fst_version>
<rs_api_version>
2.0
</rs_api_version>
<resteasy_version>
3.
0.7
.Final
</resteasy_version>
<resteasy_version>
3.
1.4
.Final
</resteasy_version>
<tomcat_embed_version>
8.0.11
</tomcat_embed_version>
<!-- Log libs -->
<slf4j_version>
1.7.25
</slf4j_version>
...
...
@@ -261,7 +261,7 @@ limitations under the License.
</dependency>
<dependency>
<groupId>
javax.servlet
</groupId>
<artifactId>
servlet-api
</artifactId>
<artifactId>
javax.
servlet-api
</artifactId>
<version>
${servlet_version}
</version>
</dependency>
<dependency>
...
...
@@ -310,7 +310,7 @@ limitations under the License.
<version>
${velocity_version}
</version>
</dependency>
<dependency>
<groupId>
com.esotericsoftware
.kryo
</groupId>
<groupId>
com.esotericsoftware
</groupId>
<artifactId>
kryo
</artifactId>
<version>
${kryo_version}
</version>
</dependency>
...
...
@@ -341,7 +341,7 @@ limitations under the License.
</dependency>
<dependency>
<groupId>
org.jboss.resteasy
</groupId>
<artifactId>
resteasy-netty
</artifactId>
<artifactId>
resteasy-netty
4
</artifactId>
<version>
${resteasy_version}
</version>
</dependency>
<dependency>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录