Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
pulsar
提交
75d2273e
pulsar
项目概览
apache
/
pulsar
通知
129
Star
40
Fork
3
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Wiki
1
Wiki
分析
仓库
DevOps
项目成员
Pages
pulsar
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Pages
分析
分析
仓库分析
DevOps
Wiki
1
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
提交
体验新版 GitCode,发现更多精彩内容 >>
提交
75d2273e
编写于
3月 10, 2017
作者:
A
Andrews
提交者:
GitHub
3月 10, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rlease ping/pong command buffer (#283)
上级
83605f6e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
23 addition
and
6 deletion
+23
-6
pulsar-common/src/main/java/com/yahoo/pulsar/common/api/Commands.java
...n/src/main/java/com/yahoo/pulsar/common/api/Commands.java
+23
-6
未找到文件。
pulsar-common/src/main/java/com/yahoo/pulsar/common/api/Commands.java
浏览文件 @
75d2273e
...
...
@@ -66,6 +66,7 @@ import com.yahoo.pulsar.common.util.protobuf.ByteBufCodedOutputStream;
import
io.netty.buffer.ByteBuf
;
import
io.netty.buffer.PooledByteBufAllocator
;
import
io.netty.buffer.RecyclableDuplicateByteBuf
;
import
io.netty.buffer.Unpooled
;
import
io.netty.buffer.UnpooledByteBufAllocator
;
import
io.netty.buffer.UnpooledHeapByteBuf
;
import
io.netty.util.Recycler
;
...
...
@@ -531,18 +532,34 @@ public class Commands {
return
res
;
}
private
final
static
ByteBuf
cmdPing
=
serializeWithSize
(
BaseCommand
.
newBuilder
().
setType
(
Type
.
PING
).
setPing
(
CommandPing
.
getDefaultInstance
()));
private
final
static
ByteBuf
cmdPing
;
static
{
ByteBuf
serializedCmdPing
=
serializeWithSize
(
BaseCommand
.
newBuilder
()
.
setType
(
Type
.
PING
)
.
setPing
(
CommandPing
.
getDefaultInstance
()));
cmdPing
=
Unpooled
.
copiedBuffer
(
serializedCmdPing
);
serializedCmdPing
.
release
();
}
static
ByteBuf
newPing
()
{
return
RecyclableDuplicateByteBuf
.
create
(
cmdPing
).
retain
(
);
return
RecyclableDuplicateByteBuf
.
create
(
cmdPing
);
}
private
final
static
ByteBuf
cmdPong
=
serializeWithSize
(
BaseCommand
.
newBuilder
().
setType
(
Type
.
PONG
).
setPong
(
CommandPong
.
getDefaultInstance
()));
private
final
static
ByteBuf
cmdPong
;
static
{
ByteBuf
serializedCmdPong
=
serializeWithSize
(
BaseCommand
.
newBuilder
()
.
setType
(
Type
.
PONG
)
.
setPong
(
CommandPong
.
getDefaultInstance
()));
cmdPong
=
Unpooled
.
copiedBuffer
(
serializedCmdPong
);
serializedCmdPong
.
release
();
}
static
ByteBuf
newPong
()
{
return
RecyclableDuplicateByteBuf
.
create
(
cmdPong
).
retain
(
);
return
RecyclableDuplicateByteBuf
.
create
(
cmdPong
);
}
private
static
ByteBuf
serializeWithSize
(
BaseCommand
.
Builder
cmdBuilder
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录