Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
doujutun3207
flink
提交
8af6ef49
F
flink
项目概览
doujutun3207
/
flink
与 Fork 源项目一致
从无法访问的项目Fork
通知
24
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
flink
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8af6ef49
编写于
1月 09, 2015
作者:
A
Aljoscha Krettek
提交者:
Stephan Ewen
1月 11, 2015
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[FLINK-1378] Add support for Throwables in KryoSerializer
上级
935e316a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
16 addition
and
4 deletion
+16
-4
flink-core/src/test/java/org/apache/flink/api/common/typeutils/SerializerTestBase.java
...apache/flink/api/common/typeutils/SerializerTestBase.java
+3
-0
flink-java/src/main/java/org/apache/flink/api/java/typeutils/runtime/KryoSerializer.java
...ache/flink/api/java/typeutils/runtime/KryoSerializer.java
+3
-1
flink-scala/src/test/scala/org/apache/flink/api/scala/runtime/KryoGenericTypeSerializerTest.scala
...ink/api/scala/runtime/KryoGenericTypeSerializerTest.scala
+10
-3
未找到文件。
flink-core/src/test/java/org/apache/flink/api/common/typeutils/SerializerTestBase.java
浏览文件 @
8af6ef49
...
...
@@ -384,6 +384,9 @@ public abstract class SerializerTestBase<T> {
assertArrayEquals
(
message
,
(
Object
[])
should
,
(
Object
[])
is
);
}
}
else
if
(
should
instanceof
Throwable
)
{
assertEquals
(((
Throwable
)
should
).
getMessage
(),
((
Throwable
)
is
).
getMessage
());
}
else
{
assertEquals
(
message
,
should
,
is
);
}
...
...
flink-java/src/main/java/org/apache/flink/api/java/typeutils/runtime/KryoSerializer.java
浏览文件 @
8af6ef49
...
...
@@ -22,6 +22,7 @@ import com.esotericsoftware.kryo.Kryo;
import
com.esotericsoftware.kryo.KryoException
;
import
com.esotericsoftware.kryo.io.Input
;
import
com.esotericsoftware.kryo.io.Output
;
import
com.esotericsoftware.kryo.serializers.JavaSerializer
;
import
com.twitter.chill.ScalaKryoInstantiator
;
import
org.apache.flink.api.common.typeutils.TypeSerializer
;
...
...
@@ -114,7 +115,7 @@ public class KryoSerializer<T> extends TypeSerializer<T> {
output
=
new
Output
(
outputStream
);
previousOut
=
target
;
}
try
{
kryo
.
writeClassAndObject
(
output
,
record
);
output
.
flush
();
...
...
@@ -180,6 +181,7 @@ public class KryoSerializer<T> extends TypeSerializer<T> {
private
void
checkKryoInitialized
()
{
if
(
this
.
kryo
==
null
)
{
this
.
kryo
=
new
ScalaKryoInstantiator
().
newKryo
();
this
.
kryo
.
addDefaultSerializer
(
Throwable
.
class
,
new
JavaSerializer
());
this
.
kryo
.
setRegistrationRequired
(
false
);
this
.
kryo
.
register
(
type
);
this
.
kryo
.
setClassLoader
(
Thread
.
currentThread
().
getContextClassLoader
());
...
...
flink-scala/src/test/scala/org/apache/flink/api/scala/runtime/KryoGenericTypeSerializerTest.scala
浏览文件 @
8af6ef49
...
...
@@ -25,6 +25,13 @@ import scala.reflect._
class
KryoGenericTypeSerializerTest
{
@Test
def
testThrowableSerialization
:
Unit
=
{
val
a
=
List
(
new
RuntimeException
(
"Hello"
),
new
RuntimeException
(
"there"
))
runTests
(
a
)
}
@Test
def
testScalaListSerialization
:
Unit
=
{
val
a
=
List
(
42
,
1
,
49
,
1337
)
...
...
@@ -43,14 +50,14 @@ class KryoGenericTypeSerializerTest {
def
testScalaMapSerialization
:
Unit
=
{
val
a
=
Map
((
"1"
->
1
),
(
"2"
->
2
),
(
"42"
->
42
),
(
"1337"
->
1337
))
runTests
(
a
)
runTests
(
Seq
(
a
)
)
}
@Test
def
testMutableMapSerialization
:
Unit
={
val
a
=
scala
.
collection
.
mutable
.
Map
((
1
->
"1"
),
(
2
->
"2"
),
(
3
->
"3"
))
runTests
(
a
)
runTests
(
Seq
(
a
)
)
}
@Test
...
...
@@ -115,7 +122,7 @@ class KryoGenericTypeSerializerTest {
}
}
def
runTests
[
T
:
ClassTag
](
objects
:
T
*
)
:
Unit
={
def
runTests
[
T
:
ClassTag
](
objects
:
Seq
[
T
]
)
:
Unit
={
val
clsTag
=
classTag
[
T
]
val
typeInfo
=
new
GenericTypeInfo
[
T
](
clsTag
.
runtimeClass
.
asInstanceOf
[
Class
[
T
]])
val
serializer
=
typeInfo
.
createSerializer
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录