Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Forever310
druid
提交
3f51ef63
D
druid
项目概览
Forever310
/
druid
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
druid
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3f51ef63
编写于
8月 22, 2013
作者:
F
fjy
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'guice' into guice-rt
上级
85ee8bb2
8980a4ac
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
87 addition
and
15 deletion
+87
-15
client/src/main/java/com/metamx/druid/http/StatusResource.java
...t/src/main/java/com/metamx/druid/http/StatusResource.java
+85
-13
server/src/main/java/com/metamx/druid/loading/OmniSegmentLoader.java
...main/java/com/metamx/druid/loading/OmniSegmentLoader.java
+1
-1
server/src/main/java/com/metamx/druid/loading/SingleSegmentLoader.java
...in/java/com/metamx/druid/loading/SingleSegmentLoader.java
+1
-1
未找到文件。
client/src/main/java/com/metamx/druid/http/StatusResource.java
浏览文件 @
3f51ef63
/*
* Druid - a distributed column store.
* Copyright (C) 2013 Metamarkets Group Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package
com.metamx.druid.http
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
javax.ws.rs.GET
;
import
javax.ws.rs.Path
;
import
javax.ws.rs.Produces
;
import
javax.ws.rs.core.Response
;
/**
*/
...
...
@@ -11,21 +31,73 @@ import javax.ws.rs.core.Response;
public
class
StatusResource
{
@GET
@Produces
(
"
text/plai
n"
)
public
Response
doGet
()
@Produces
(
"
application/jso
n"
)
public
Status
doGet
()
{
StringBuffer
buf
=
new
StringBuffer
();
return
new
Status
(
StatusResource
.
class
.
getPackage
().
getImplementationVersion
(),
new
Memory
(
Runtime
.
getRuntime
())
);
}
public
static
class
Status
{
final
String
version
;
final
Memory
memory
;
public
Status
(
String
version
,
Memory
memory
)
{
this
.
version
=
version
;
this
.
memory
=
memory
;
}
@JsonProperty
public
String
getVersion
()
{
return
version
;
}
@JsonProperty
public
Memory
getMemory
()
{
return
memory
;
}
}
public
static
class
Memory
{
final
long
maxMemory
;
final
long
totalMemory
;
final
long
freeMemory
;
final
long
usedMemory
;
public
Memory
(
Runtime
runtime
)
{
maxMemory
=
runtime
.
maxMemory
();
totalMemory
=
runtime
.
totalMemory
();
freeMemory
=
runtime
.
freeMemory
();
usedMemory
=
totalMemory
-
freeMemory
;
}
@JsonProperty
public
long
getMaxMemory
()
{
return
maxMemory
;
}
Runtime
runtime
=
Runtime
.
getRuntime
();
long
maxMemory
=
runtime
.
maxMemory
();
long
totalMemory
=
runtime
.
totalMemory
();
long
freeMemory
=
runtime
.
freeMemory
();
@JsonProperty
public
long
getTotalMemory
()
{
return
totalMemory
;
}
buf
.
append
(
String
.
format
(
"Max Memory:\t%,18d\t%1$d%n"
,
maxMemory
));
buf
.
append
(
String
.
format
(
"Total Memory:\t%,18d\t%1$d%n"
,
totalMemory
));
buf
.
append
(
String
.
format
(
"Free Memory:\t%,18d\t%1$d%n"
,
freeMemory
));
buf
.
append
(
String
.
format
(
"Used Memory:\t%,18d\t%1$d%n"
,
totalMemory
-
freeMemory
));
@JsonProperty
public
long
getFreeMemory
()
{
return
freeMemory
;
}
return
Response
.
ok
(
buf
.
toString
()).
build
();
@JsonProperty
public
long
getUsedMemory
()
{
return
usedMemory
;
}
}
}
server/src/main/java/com/metamx/druid/loading/OmniSegmentLoader.java
浏览文件 @
3f51ef63
...
...
@@ -211,7 +211,7 @@ public class OmniSegmentLoader implements SegmentLoader
private
synchronized
void
addSegment
(
DataSegment
segment
)
{
if
(
!
segments
.
add
(
segment
))
{
if
(
segments
.
add
(
segment
))
{
currSize
+=
segment
.
getSize
();
}
}
...
...
server/src/main/java/com/metamx/druid/loading/SingleSegmentLoader.java
浏览文件 @
3f51ef63
...
...
@@ -210,7 +210,7 @@ public class SingleSegmentLoader implements SegmentLoader
private
synchronized
void
addSegment
(
DataSegment
segment
)
{
if
(
!
segments
.
add
(
segment
))
{
if
(
segments
.
add
(
segment
))
{
currSize
+=
segment
.
getSize
();
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录