Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
SkyWalking
提交
7e17692d
S
SkyWalking
项目概览
apache
/
SkyWalking
上一次同步 1 年多
通知
302
Star
21345
Fork
6091
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SkyWalking
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7e17692d
编写于
6月 07, 2017
作者:
P
pengys5
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add comment
上级
753cb284
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
35 addition
and
1 deletion
+35
-1
apm-collector/apm-collector-worker/src/main/java/org/skywalking/apm/collector/worker/httpserver/AbstractPost.java
...walking/apm/collector/worker/httpserver/AbstractPost.java
+17
-1
apm-collector/apm-collector-worker/src/main/java/org/skywalking/apm/collector/worker/segment/entity/SegmentDeserialize.java
...m/collector/worker/segment/entity/SegmentDeserialize.java
+18
-0
未找到文件。
apm-collector/apm-collector-worker/src/main/java/org/skywalking/apm/collector/worker/httpserver/AbstractPost.java
浏览文件 @
7e17692d
...
...
@@ -20,7 +20,6 @@ import org.skywalking.apm.collector.worker.segment.entity.SegmentDeserialize;
/**
* @author pengys5
*/
public
abstract
class
AbstractPost
extends
AbstractLocalAsyncWorker
{
public
AbstractPost
(
Role
role
,
ClusterWorkerContext
clusterContext
,
LocalWorkerContext
selfContext
)
{
...
...
@@ -43,6 +42,16 @@ public abstract class AbstractPost extends AbstractLocalAsyncWorker {
this
.
ownerWorkerRef
=
ownerWorkerRef
;
}
/**
* Get segment's buffer from request then execute deserialize operation.
*
* @param request an {@link HttpServletRequest} object that contains the request the client has made of the
* servlet
* @param response {@link HttpServletResponse} object that contains the response the servlet sends to the
* client
* @throws ServletException if the request for the POST could not be handled
* @throws IOException if an input or output error is detected when the servlet handles the request
*/
@Override
final
protected
void
doPost
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
ServletException
,
IOException
{
JsonObject
resJson
=
new
JsonObject
();
...
...
@@ -57,6 +66,13 @@ public abstract class AbstractPost extends AbstractLocalAsyncWorker {
}
}
/**
* Read segment's buffer from buffer reader by stream mode. when finish read one segment then send to analysis.
* This method in there, so post servlet just can receive segments data.
*
* @param bufferedReader an {@link BufferedReader} object that contains the segment's data using the construct of chars.
* @throws Exception
*/
private
void
streamReader
(
BufferedReader
bufferedReader
)
throws
Exception
{
Segment
segment
;
do
{
...
...
apm-collector/apm-collector-worker/src/main/java/org/skywalking/apm/collector/worker/segment/entity/SegmentDeserialize.java
浏览文件 @
7e17692d
...
...
@@ -8,18 +8,36 @@ import java.util.ArrayList;
import
java.util.List
;
/**
* The <code>SegmentDeserialize</code> provides single segment json string deserialize and segment array file
* deserialize.
*
* @author pengys5
* @since v3.0-2017
*/
public
enum
SegmentDeserialize
{
INSTANCE
;
private
final
Gson
gson
=
new
Gson
();
/**
* Single segment json string deserialize.
*
* @param singleSegmentJsonStr a segment json string
* @return an {@link Segment}
* @throws IOException if json string illegal or file broken.
*/
public
Segment
deserializeSingle
(
String
singleSegmentJsonStr
)
throws
IOException
{
Segment
segment
=
gson
.
fromJson
(
singleSegmentJsonStr
,
Segment
.
class
);
return
segment
;
}
/**
* Read a json array file contains multiple segments.
*
* @param segmentJsonFile a segments json array file path
* @return on {@link List<Segment>}
* @throws Exception if json data illegal or file broken.
*/
public
List
<
Segment
>
deserializeMultiple
(
String
segmentJsonFile
)
throws
Exception
{
List
<
Segment
>
segmentList
=
new
ArrayList
<>();
streamReader
(
segmentList
,
new
FileReader
(
segmentJsonFile
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录