Skip to content

Hessian serializer #4

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

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Conversation

danomatic
Copy link

@danomatic danomatic commented Sep 14, 2017

Based on the custom-serializer branch. Adds an additional serializer, HessianSerializer, that should be more performant and avoid some of the issues we experienced with JavaSerializer.

@coveralls
Copy link

Coverage Status

Coverage decreased (-11.3%) to 82.988% when pulling 2131854 on danomatic:hessian-serializer into 99ea324 on arhs:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-11.3%) to 82.988% when pulling bcabd3a on danomatic:hessian-serializer into 99ea324 on arhs:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-4.2%) to 90.041% when pulling bcabd3a on danomatic:hessian-serializer into 99ea324 on arhs:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-3.4%) to 90.871% when pulling ad42513 on danomatic:hessian-serializer into 99ea324 on arhs:master.

@danomatic
Copy link
Author

According to this, "The efficiency of Hessian 2.0 is about twice that of java.io serialization."

@danomatic
Copy link
Author

My company has been using this in production for months without issue.

@danomatic
Copy link
Author

That being said, this does add an extra Maven dependency. If that is problematic, it could be split to another project or we could just demonstrate how to use it in the docs.

@dnlprplt
Copy link
Contributor

Ideally, we'd have to generate another jar with the serializer so that people could decide whether or not to include that dependency.

In the first place, I could live if we simply include the serializer in the main library.

public byte[] serialize(Object obj) {
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
Hessian2Output out = new Hessian2Output(bos);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If Hessian2Output implements java.lang.AutoCloseable, could you please use a try-with-reource block?

It not, you should add another try block and close the stream in case an exception is raised.

Hessian2Input in = new Hessian2Input(bin);
in.startMessage();

toReturn = in.readObject();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should close the stream once it has been read. Please also consider the comment made on the serialize() part.

@coveralls
Copy link

Coverage Status

Coverage decreased (-4.4%) to 89.837% when pulling d59bb4b on danomatic:hessian-serializer into 99ea324 on arhs:master.

@danomatic
Copy link
Author

@danielprplt I've added code to make sure that the input and output streams are closed.

@coveralls
Copy link

Coverage Status

Coverage decreased (-4.3%) to 89.96% when pulling 8d27dfb on danomatic:hessian-serializer into 99ea324 on arhs:master.

@cyrilschumacher
Copy link
Member

@danomatic Could you resolve the conflicts present in your branch? In any case, thank you for your work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants