-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Skip serialization of jvm invocation in ark #370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
QilongZhang
merged 18 commits into
sofastack:master
from
QilongZhang:skip_jvm_hessian_in_ark
Mar 8, 2019
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
4984964
prepare to release
QilongZhang d5c82e4
Merge branch 'master' of github.com:alipay/sofa-boot
QilongZhang 86b885e
Merge branch 'master' of github.com:alipay/sofa-boot
QilongZhang c36ae52
Merge branch 'master' of github.com:alipay/sofa-boot
QilongZhang 24c893c
Merge branch 'master' of github.com:alipay/sofa-boot
QilongZhang 5a74e09
Merge branch 'master' of github.com:alipay/sofa-boot
QilongZhang b43a63e
Merge branch 'master' of github.com:alipay/sofa-boot
QilongZhang ca4c93b
Merge branch 'master' of github.com:alipay/sofa-boot
QilongZhang 96abe95
upgrade version to 3.1.3
QilongZhang e787335
fix 369
QilongZhang 5f3ecd6
fix test case
QilongZhang bc823be
fix as test
QilongZhang b67c2f3
fix doc
QilongZhang bd4272e
fix as review
QilongZhang 11be85c
Merge branch 'master' into skip_jvm_hessian_in_ark
ujjboy f190434
fix typo
QilongZhang f2ec0e8
fix as review
QilongZhang 052d946
Merge branch 'skip_jvm_hessian_in_ark' of github.com:QilongZhang/sofa…
QilongZhang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
...ot-starter/src/main/java/com/alipay/sofa/runtime/service/binding/JvmBindingConverter.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package com.alipay.sofa.runtime.service.binding; | ||
|
|
||
| import com.alipay.sofa.runtime.api.annotation.SofaReference; | ||
| import com.alipay.sofa.runtime.api.annotation.SofaReferenceBinding; | ||
| import com.alipay.sofa.runtime.api.annotation.SofaService; | ||
| import com.alipay.sofa.runtime.api.annotation.SofaServiceBinding; | ||
| import com.alipay.sofa.runtime.api.binding.BindingType; | ||
| import com.alipay.sofa.runtime.spi.service.BindingConverter; | ||
| import com.alipay.sofa.runtime.spi.service.BindingConverterContext; | ||
| import org.w3c.dom.Element; | ||
|
|
||
| /** | ||
| * @author qilong.zql | ||
| * @since 3.1.3 | ||
| */ | ||
| public class JvmBindingConverter implements BindingConverter<JvmBindingParam, JvmBinding> { | ||
| @Override | ||
| public JvmBinding convert(JvmBindingParam bindingParam, | ||
| BindingConverterContext bindingConverterContext) { | ||
| return new JvmBinding().setJvmBindingParam(bindingParam); | ||
| } | ||
|
|
||
| @Override | ||
| public JvmBinding convert(Element element, BindingConverterContext bindingConverterContext) { | ||
| JvmBindingParam jvmBindingParam = new JvmBindingParam(); | ||
| if (element != null) { | ||
| jvmBindingParam.setSerialize(Boolean.TRUE.toString().equalsIgnoreCase( | ||
| element.getAttribute(JvmBinding.XmlConstants.SERIALIZE))); | ||
| } | ||
| return new JvmBinding().setJvmBindingParam(jvmBindingParam); | ||
| } | ||
|
|
||
| @Override | ||
| public JvmBinding convert(SofaService sofaServiceAnnotation, | ||
| SofaServiceBinding sofaServiceBindingAnnotation, | ||
| BindingConverterContext bindingConverterContext) { | ||
| if (JvmBinding.XmlConstants.BINDING_TYPE.equals(sofaServiceBindingAnnotation.bindingType())) { | ||
| JvmBindingParam jvmBindingParam = new JvmBindingParam(); | ||
| jvmBindingParam.setSerialize(sofaServiceBindingAnnotation.serialize()); | ||
| return new JvmBinding().setJvmBindingParam(jvmBindingParam); | ||
| } | ||
| return null; | ||
| } | ||
|
|
||
| @Override | ||
| public JvmBinding convert(SofaReference sofaReferenceAnnotation, | ||
| SofaReferenceBinding sofaReferenceBindingAnnotation, | ||
| BindingConverterContext bindingConverterContext) { | ||
| if (JvmBinding.XmlConstants.BINDING_TYPE.equals(sofaReferenceBindingAnnotation | ||
| .bindingType())) { | ||
| JvmBindingParam jvmBindingParam = new JvmBindingParam(); | ||
| jvmBindingParam.setSerialize(sofaReferenceBindingAnnotation.serialize()); | ||
| return new JvmBinding().setJvmBindingParam(jvmBindingParam); | ||
| } | ||
| return null; | ||
| } | ||
|
|
||
| @Override | ||
| public BindingType supportBindingType() { | ||
| return JvmBinding.JVM_BINDING_TYPE; | ||
| } | ||
|
|
||
| @Override | ||
| public String supportTagName() { | ||
| return JvmBinding.XmlConstants.SUPPORT_TAG_NAME; | ||
| } | ||
|
|
||
| } |
53 changes: 53 additions & 0 deletions
53
...a-boot-starter/src/main/java/com/alipay/sofa/runtime/service/binding/JvmBindingParam.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package com.alipay.sofa.runtime.service.binding; | ||
|
|
||
| import com.alipay.sofa.runtime.api.binding.BindingType; | ||
| import com.alipay.sofa.runtime.api.client.param.BindingParam; | ||
|
|
||
| /** | ||
| * @author qilong.zql | ||
| * @since 3.1.2 | ||
| */ | ||
| public class JvmBindingParam implements BindingParam { | ||
|
|
||
| private boolean serialize = true; | ||
|
|
||
| @Override | ||
| public BindingType getBindingType() { | ||
| return JvmBinding.JVM_BINDING_TYPE; | ||
| } | ||
|
|
||
| /** | ||
| * whether ignore serialize when invoke across ClassLoader. | ||
| * | ||
| * @return | ||
| */ | ||
| public boolean isSerialize() { | ||
| return serialize; | ||
| } | ||
|
|
||
| /** | ||
| * Set whether ignore serialize when invoke across ClassLoader. | ||
| * | ||
| * @param serialize | ||
| */ | ||
| public JvmBindingParam setSerialize(boolean serialize) { | ||
| this.serialize = serialize; | ||
| return this; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个为啥默认是false
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reference 默认不走序列化,service 默认走序列化. 只有两者都为 false 是,才会走直接调用模式。
服务端如果设置不走序列化,需要将相关类导出,而客户端无需变更代码。
只有当引用服务的应用配置了 deny-import 相关类,此时,客户端可能需要强制设置走序列化方式.