Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
pulsar
提交
ddf5429e
pulsar
项目概览
apache
/
pulsar
通知
129
Star
40
Fork
3
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Wiki
1
Wiki
分析
仓库
DevOps
项目成员
Pages
pulsar
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Pages
分析
分析
仓库分析
DevOps
Wiki
1
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
提交
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
ddf5429e
编写于
10月 22, 2019
作者:
M
Matteo Merli
提交者:
GitHub
10月 22, 2019
1
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixed StringSchema static initialization (#5445)
上级
b466b085
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
23 addition
and
15 deletion
+23
-15
pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/StringSchema.java
...va/org/apache/pulsar/client/impl/schema/StringSchema.java
+23
-15
未找到文件。
pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/StringSchema.java
浏览文件 @
ddf5429e
...
...
@@ -36,10 +36,22 @@ import java.nio.charset.StandardCharsets;
*/
public
class
StringSchema
extends
AbstractSchema
<
String
>
{
static
final
String
CHARSET_KEY
=
"__charset"
;
public
static
StringSchema
utf8
()
{
return
UTF8
;
static
final
String
CHARSET_KEY
;
private
static
final
SchemaInfo
DEFAULT_SCHEMA_INFO
;
private
static
final
Charset
DEFAULT_CHARSET
;
private
static
final
StringSchema
UTF8
;
static
{
// Ensure the ordering of the static initialization
CHARSET_KEY
=
"__charset"
;
DEFAULT_CHARSET
=
StandardCharsets
.
UTF_8
;
DEFAULT_SCHEMA_INFO
=
new
SchemaInfo
()
.
setName
(
"String"
)
.
setType
(
SchemaType
.
STRING
)
.
setSchema
(
new
byte
[
0
]);
UTF8
=
new
StringSchema
(
StandardCharsets
.
UTF_8
);
}
private
static
final
FastThreadLocal
<
byte
[]>
tmpBuffer
=
new
FastThreadLocal
<
byte
[]>()
{
...
...
@@ -59,14 +71,10 @@ public class StringSchema extends AbstractSchema<String> {
}
}
private
static
final
SchemaInfo
DEFAULT_SCHEMA_INFO
=
new
SchemaInfo
()
.
setName
(
"String"
)
.
setType
(
SchemaType
.
STRING
)
.
setSchema
(
new
byte
[
0
]);
private
static
final
Charset
DEFAULT_CHARSET
=
StandardCharsets
.
UTF_8
;
public
static
StringSchema
utf8
()
{
return
UTF8
;
}
// make sure other static fields are initialized before this field
private
static
final
StringSchema
UTF8
=
new
StringSchema
(
StandardCharsets
.
UTF_8
);
private
final
Charset
charset
;
private
final
SchemaInfo
schemaInfo
;
...
...
@@ -80,10 +88,10 @@ public class StringSchema extends AbstractSchema<String> {
Map
<
String
,
String
>
properties
=
new
HashMap
<>();
properties
.
put
(
CHARSET_KEY
,
charset
.
name
());
this
.
schemaInfo
=
new
SchemaInfo
()
.
setName
(
DEFAULT_SCHEMA_INFO
.
getName
())
.
setType
(
SchemaType
.
STRING
)
.
setSchema
(
DEFAULT_SCHEMA_INFO
.
getSchema
())
.
setProperties
(
properties
);
.
setName
(
DEFAULT_SCHEMA_INFO
.
getName
())
.
setType
(
SchemaType
.
STRING
)
.
setSchema
(
DEFAULT_SCHEMA_INFO
.
getSchema
())
.
setProperties
(
properties
);
}
public
byte
[]
encode
(
String
message
)
{
...
...
tester丶
🤺
@ssszwink
mentioned in commit
7d1c6ee4
·
9月 09, 2020
mentioned in commit
7d1c6ee4
mentioned in commit 7d1c6ee41071b4ed4dd49c3b35c3588d71f22871
开关提交列表
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录